2 Copyright (C) 2011 Samsung Electronics
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #include "ewk_cache.h"
23 #include "FontCache.h"
24 #include "MemoryCache.h"
25 #include "PageCache.h"
26 #include "ewk_private.h"
28 #if ENABLE(TIZEN_CACHE_CONTROL)
29 Eina_Bool cacheEnable = true;
32 Eina_Bool ewk_cache_component_reset()
34 #if ENABLE(TIZEN_MEMORY_CONTROLLER)
35 WebCore::MemoryCache* componentCache = WebCore::memoryCache();
39 if (!componentCache->disabled()) {
40 componentCache->setDisabled(true);
41 componentCache->setDisabled(false);
51 Eina_Bool ewk_cache_component_prune()
53 #if ENABLE(TIZEN_MEMORY_CONTROLLER)
54 WebCore::MemoryCache* cache = WebCore::memoryCache();
65 Eina_Bool ewk_cache_font_invalidate()
67 #if ENABLE(TIZEN_MEMORY_CONTROLLER)
68 WebCore::FontCache* fontCache = WebCore::fontCache();
72 fontCache->invalidate();
80 Eina_Bool ewk_cache_page_release(int val)
82 #if ENABLE(TIZEN_MEMORY_CONTROLLER)
83 WebCore::PageCache* pageCache = WebCore::pageCache();
87 pageCache->setCapacity(0);
88 pageCache->releaseAutoreleasedPagesNow();
89 pageCache->setCapacity(val);
97 int ewk_cache_page_capacity_get()
99 #if ENABLE(TIZEN_MEMORY_CONTROLLER)
100 return WebCore::pageCache()->capacity();
106 void ewk_cache_page_capacity_set(int capacity)
108 #if ENABLE(TIZEN_MEMORY_CONTROLLER)
109 WebCore::pageCache()->setCapacity(capacity);
113 void ewk_cache_min_dead_bytes_set(unsigned val)
116 ewk_cache_soup_min_dead_bytes_set(val);
120 unsigned ewk_cache_min_dead_bytes_get()
123 return ewk_cache_soup_min_dead_bytes_get();
129 void ewk_cache_max_dead_bytes_set(unsigned val)
132 ewk_cache_soup_min_dead_bytes_set(val);
136 unsigned ewk_cache_max_dead_bytes_get()
139 return ewk_cache_soup_max_dead_bytes_get();
145 void ewk_cache_max_total_bytes_set(unsigned val)
148 ewk_cache_soup_max_total_bytes_set(val);
152 unsigned ewk_cache_max_total_bytes_get()
155 ewk_cache_soup_max_total_bytes_get();
161 void ewk_cache_control_set(Eina_Bool enable)
163 #if ENABLE(TIZEN_CACHE_CONTROL)
164 cacheEnable = enable;
165 ewk_settings_cache_enable_set(enable);
169 Eina_Bool ewk_cache_control_get()
171 #if ENABLE(TIZEN_CACHE_CONTROL)
178 Eina_Bool ewk_cache_init(const char* cachePath, Eina_Bool shared)
180 #if ENABLE(TIZEN_CACHE_CONTROL)
181 if (!ewk_cache_control_get())
185 return ewk_cache_soup_init(cachePath, shared);
191 Eina_Bool ewk_cache_load()
193 #if ENABLE(TIZEN_CACHE_CONTROL)
194 if (!ewk_cache_control_get())
198 return ewk_cache_soup_load();
204 Eina_Bool ewk_cache_dump()
206 #if ENABLE(TIZEN_CACHE_CONTROL)
207 if (!ewk_cache_control_get())
211 return ewk_cache_soup_dump();
217 Eina_Bool ewk_cache_flush()
220 return ewk_cache_soup_flush();
226 void ewk_cache_finalize()
229 ewk_cache_soup_finalize();
235 Eina_Bool ewk_cache_clear()
238 return ewk_cache_soup_clear();
244 Eina_Bool ewk_cache_max_size_set(unsigned int size)
247 return ewk_cache_soup_max_size_set(size);
253 unsigned int ewk_cache_max_size_get()
256 return ewk_cache_soup_max_size_get();