From 14bd7a69a60ae94bee4c751d07e8b0a87de3d087 Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Mon, 21 May 2012 15:54:58 +0000 Subject: [PATCH] [EFL] Clients should be able to set page cache capacity. https://bugs.webkit.org/show_bug.cgi?id=86960 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Patch by Mikhail Pozdnyakov on 2012-05-21 Reviewed by Csaba Osztrogonác. Exported memory page cache capacity getter and setter functions. Those will be used both by clients and DRT Layout Test Controller. * ewk/ewk_settings.cpp: (ewk_settings_page_cache_capacity_get): (ewk_settings_page_cache_capacity_set): * ewk/ewk_settings.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@117785 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit/efl/ChangeLog | 15 +++++++++++++++ Source/WebKit/efl/ewk/ewk_main.cpp | 4 ++-- Source/WebKit/efl/ewk/ewk_settings.cpp | 10 ++++++++++ Source/WebKit/efl/ewk/ewk_settings.h | 23 +++++++++++++++++++++++ 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index 7ce9725..cd5aa54 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,18 @@ +2012-05-21 Mikhail Pozdnyakov + + [EFL] Clients should be able to set page cache capacity. + https://bugs.webkit.org/show_bug.cgi?id=86960 + + Reviewed by Csaba Osztrogonác. + + Exported memory page cache capacity getter and setter functions. + Those will be used both by clients and DRT Layout Test Controller. + + * ewk/ewk_settings.cpp: + (ewk_settings_page_cache_capacity_get): + (ewk_settings_page_cache_capacity_set): + * ewk/ewk_settings.h: + 2012-05-21 Caio Marcelo de Oliveira Filho Move setEditingBehavior() from layoutTestController to window.internals diff --git a/Source/WebKit/efl/ewk/ewk_main.cpp b/Source/WebKit/efl/ewk/ewk_main.cpp index 8a0dd66..c205db5 100644 --- a/Source/WebKit/efl/ewk/ewk_main.cpp +++ b/Source/WebKit/efl/ewk/ewk_main.cpp @@ -150,8 +150,8 @@ Eina_Bool _ewk_init_body(void) // Page cache capacity (in pages). Comment from Mac port: // (Research indicates that value / page drops substantially after 3 pages.) - // FIXME: Expose this with an API and/or calculate based on available resources - WebCore::pageCache()->setCapacity(3); + // FIXME: Calculate based on available resources + ewk_settings_page_cache_capacity_set(3); WebCore::PageGroup::setShouldTrackVisitedLinks(true); String home = WebCore::homeDirectoryPath(); diff --git a/Source/WebKit/efl/ewk/ewk_settings.cpp b/Source/WebKit/efl/ewk/ewk_settings.cpp index f1c6e9b..36b08c0 100644 --- a/Source/WebKit/efl/ewk/ewk_settings.cpp +++ b/Source/WebKit/efl/ewk/ewk_settings.cpp @@ -248,6 +248,16 @@ void ewk_settings_object_cache_enable_set(Eina_Bool enable) WebCore::memoryCache()->setDisabled(!enable); } +unsigned ewk_settings_page_cache_capacity_get() +{ + return WebCore::pageCache()->capacity(); +} + +void ewk_settings_page_cache_capacity_set(unsigned pages) +{ + WebCore::pageCache()->setCapacity(pages); +} + void ewk_settings_memory_cache_clear() { // Turn the cache on and off. Disabling the object cache will remove all diff --git a/Source/WebKit/efl/ewk/ewk_settings.h b/Source/WebKit/efl/ewk/ewk_settings.h index e3a1047..08f7931 100644 --- a/Source/WebKit/efl/ewk/ewk_settings.h +++ b/Source/WebKit/efl/ewk/ewk_settings.h @@ -296,6 +296,29 @@ EAPI void ewk_settings_object_cache_enable_set(Eina_Bool set); EAPI void ewk_settings_object_cache_capacity_set(unsigned min_dead_bytes, unsigned max_dead_bytes, unsigned total_bytes); /** + * Returns the maximum number of pages in the memory page cache. + * + * By default, maximum number of pages is 3. + * + * @return The maximum number of pages in the memory page cache. + * + * @sa ewk_settings_page_cache_capacity_set + */ +EAPI unsigned ewk_settings_page_cache_capacity_get(void); + +/** + * Defines the capacity for the memory page cache. + * + * The page cache is responsible for holding visited web pages in memory. So it improves user experience when navigating forth or back + * to pages in the forward/back history as the cached pages do not require to be loaded from server. + * + * By default, @p pages is 3. + * + * @param pages The maximum number of pages to keep in the memory page cache. + */ +EAPI void ewk_settings_page_cache_capacity_set(unsigned pages); + +/** * Clears all memory caches. * * This function clears all memory caches, which include the object cache (for resources such as -- 2.7.4