1 // Copyright 2014 Samsung Electronics. All rights reseoved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef WEB_CACHE_MANAGER_EFL_H
6 #define WEB_CACHE_MANAGER_EFL_H
10 #include "base/compiler_specific.h"
11 #include "base/memory/singleton.h"
12 #include "content/public/browser/notification_observer.h"
13 #include "content/public/browser/notification_registrar.h"
14 #include "public/ewk_context.h"
19 struct CacheParamsEfl;
21 class WebCacheManagerEfl : public content::NotificationObserver {
23 explicit WebCacheManagerEfl(content::BrowserContext* browser_context);
24 virtual ~WebCacheManagerEfl();
26 // content::NotificationObserver implementation:
27 virtual void Observe(int type,
28 const content::NotificationSource& source,
29 const content::NotificationDetails& details) override;
31 void SetCacheModel(Ewk_Cache_Model model);
32 Ewk_Cache_Model GetCacheModel() const { return cache_model_; }
33 void SetBrowserContext(content::BrowserContext* browser_context);
36 static void CalculateCacheSizes(Ewk_Cache_Model cache_model, int64_t memory_size, int64_t disk_free_size,
37 int64_t* cache_total_capacity, int64_t* cache_min_dead_capacity,
38 int64_t* cache_max_dead_capacity, double* dead_decoded_data_deletion_interval,
39 int64_t* page_cache_capacity, int64_t* url_cache_memory_capacity,
40 int64_t* url_cache_disk_capacity);
42 CacheParamsEfl GetCacheParamsFromModel(Ewk_Cache_Model);
43 void SetRenderProcessCacheModel(Ewk_Cache_Model model, int render_process_id);
45 content::NotificationRegistrar registrar_;
46 std::set<int> renderers_;
47 content::BrowserContext* browser_context_;
48 Ewk_Cache_Model cache_model_;
49 DISALLOW_COPY_AND_ASSIGN(WebCacheManagerEfl);