tizen beta release
[framework/web/webkit-efl.git] / debian / libwebkit-engine-dev / usr / include / ewebkit-0 / ewk_cache.h
1 /*
2     Copyright (C) 2011 Samsung Electronics
3
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.
8
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.
13
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.
18 */
19
20 /**
21  * @file    ewk_cache.h
22  * @brief   Collection of cache APIs.
23  */
24
25 #ifndef ewk_cache_h
26 #define ewk_cache_h
27
28 #include <Eina.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 /**
35  * Initializes soup cache at specified path
36  *
37  * @param cachePath path for a directory when cached files will be stored
38  * @param shared allows to choose between shared and single user cache
39  * @return EINA_TRUE if soup_session_add_feature was called, EINA_FALSE otherwise
40  */
41 EAPI Eina_Bool        ewk_cache_init(const char* cachePath, Eina_Bool shared);
42
43 /**
44  * Loads files cached by soup cache
45  *
46  * @return EINA_TRUE if webkit_soup_cache was initialized, EINA_FALSE otherwise
47  */
48 EAPI Eina_Bool        ewk_cache_load();
49
50 /**
51  * Dumps soup cache
52  *
53  * @return EINA_TRUE if webkit_soup_cache was initialized, EINA_FALSE otherwise
54  */
55 EAPI Eina_Bool        ewk_cache_dump();
56
57 /**
58  * Forces all pending writes in cache to be committed to disk
59  *
60  * @return EINA_TRUE if webkit_soup_cache was initialized, EINA_FALSE otherwise
61  */
62 EAPI Eina_Bool        ewk_cache_flush();
63
64 /**
65  * Finalizes soup cache
66  */
67 EAPI void             ewk_cache_finalize();
68
69 /**
70  * Clears whole soup cache
71  *
72  * @return EINA_TRUE if webkit_soup_cache was initialized, EINA_FALSE otherwise
73  */
74 EAPI Eina_Bool        ewk_cache_clear();
75
76 /**
77 * Used for reseting WebKit's component memory.
78 *
79 * @return @c EINA_FALSE if succeed, or @c EINA_FALSE otherwise
80 */
81 EAPI Eina_Bool        ewk_cache_component_reset();
82
83 /**
84 * Used for removing WebKit't cache resources (live and dead resources)
85 *
86 * @return @c EINA_TRUE if succeed, or @c EINA_FALSE otherwise
87 */
88 EAPI Eina_Bool        ewk_cache_component_prune();
89
90 /**
91 * Used for WebKit's font invalidation
92 *
93 * @return @c EINA_TRUE if succeed, or @c EINA_FALSE otherwise
94 */
95 EAPI Eina_Bool        ewk_cache_font_invalidate();
96
97 /**
98  * Page cache capacity functions
99  * Capacity is measured in number of cached pages
100  * Returns page cache capacity
101  *
102  * @return size of a page cache
103  */
104 EAPI int ewk_cache_page_capacity_get();
105
106 /**
107 * Sets page cache capacity
108 *
109 * @param capacity size of page cache
110 */
111 EAPI void ewk_cache_page_capacity_set(int capacity);
112
113 /**
114  * Used for removing WebKit's page cache
115  *
116  * @param val sets level of capacity
117  * @return @c EINA_TRUE if succeed, or @c EINA_FALSE otherwise
118  */
119 EAPI Eina_Bool        ewk_cache_page_release(int val);
120
121 /**
122  * Sets maximum size of cache in bytes
123  *
124  * @param size size of cache in bytes
125  * @return EINA_TRUE if webkit_soup_cache was initialized, EINA_FALSE otherwise
126  */
127 EAPI Eina_Bool        ewk_cache_max_size_set(unsigned int size);
128
129 /**
130  * Gets maximum size of cache in bytes
131  *
132  * @return size of cache in bytes if webkit_soup_cache was initialized, 0 otherwise
133  */
134 EAPI unsigned int     ewk_cache_max_size_get();
135
136 /**
137  * Sets maximum number of bytes that dead resources consume
138  * when the cache is under pressure
139  *
140  * @param val new value of cache
141  */
142 EAPI void             ewk_cache_min_dead_bytes_set(unsigned val);
143
144 /**
145  * Returns maximum number of bytes that dead resources consume
146  * when the cache is under pressure
147  *
148  * @return maximum number of bytes when cache is under pressure
149  */
150 EAPI unsigned         ewk_cache_min_dead_bytes_get();
151
152 /**
153  * Returns maximum number of bytes that dead resources consume
154  * when the cache is not under pressure
155  *
156  * @param val new value of cache
157  */
158 EAPI void             ewk_cache_max_dead_bytes_set(unsigned val);
159
160 /**
161  * Returns maximum number of bytes that dead resources consume
162  * when the cache is under pressure
163  *
164  * @return maximum number of bytes when cache is under pressure
165  */
166 EAPI unsigned         ewk_cache_max_dead_bytes_get();
167
168
169 /**
170  * Sets number of total bytes that deade resources consume.
171  * WebCore also prunes dead and live resources
172  *
173  * @param val new value of total cache
174  */
175 EAPI void             ewk_cache_max_total_bytes_set(unsigned val);
176
177 /**
178  * Returns number of bytes that cache consumes overall
179  *
180  * @return total number of bytes
181  */
182 EAPI unsigned         ewk_cache_max_total_bytes_get();
183
184 /**
185  * Control soup cache and memory cache usage.
186  *
187  * @param enable set cache enable or disable.
188  */
189 EAPI void ewk_cache_control_set(Eina_Bool enable);
190
191 /**
192  * Return whether soup cache and memory cache enabled or disabled.
193  *
194  * @return true if cache is enabled.
195  */
196 EAPI Eina_Bool ewk_cache_control_get();
197
198 #ifdef __cplusplus
199 }
200 #endif
201 #endif // ewk_cache_h