diff options
Diffstat (limited to 'Source/WebKit/gtk/webkit/webkitglobals.cpp')
-rw-r--r-- | Source/WebKit/gtk/webkit/webkitglobals.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/Source/WebKit/gtk/webkit/webkitglobals.cpp b/Source/WebKit/gtk/webkit/webkitglobals.cpp index a97d53f..c23824c 100644 --- a/Source/WebKit/gtk/webkit/webkitglobals.cpp +++ b/Source/WebKit/gtk/webkit/webkitglobals.cpp @@ -117,14 +117,24 @@ void webkit_set_cache_model(WebKitCacheModel model) gdouble deadDecodedDataDeletionInterval; guint pageCacheCapacity; + // FIXME: The Mac port calculates these values based on the amount of physical memory that's + // installed on the system. Currently these values match the Mac port for users with more than + // 512 MB and less than 1024 MB of physical memory. switch (model) { case WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER: pageCacheCapacity = 0; - cacheTotalCapacity = 0; + cacheTotalCapacity = 0; // FIXME: The Mac port actually sets this to larger than 0. cacheMinDeadCapacity = 0; cacheMaxDeadCapacity = 0; deadDecodedDataDeletionInterval = 0; break; + case WEBKIT_CACHE_MODEL_DOCUMENT_BROWSER: + pageCacheCapacity = 2; + cacheTotalCapacity = 16 * 1024 * 1024; + cacheMinDeadCapacity = cacheTotalCapacity / 8; + cacheMaxDeadCapacity = cacheTotalCapacity / 4; + deadDecodedDataDeletionInterval = 0; + break; case WEBKIT_CACHE_MODEL_WEB_BROWSER: // Page cache capacity (in pages). Comment from Mac port: // (Research indicates that value / page drops substantially after 3 pages.) @@ -248,13 +258,7 @@ void webkitInit() PageGroup::setShouldTrackVisitedLinks(true); Pasteboard::generalPasteboard()->setHelper(WebKit::pasteboardHelperInstance()); - - iconDatabase()->setEnabled(true); - - GOwnPtr<gchar> iconDatabasePath(g_build_filename(g_get_user_data_dir(), "webkit", "icondatabase", NULL)); - iconDatabase()->open(iconDatabasePath.get()); - - atexit(closeIconDatabaseOnExit); + WebKit::setIconDatabaseEnabled(true); SoupSession* session = webkit_get_default_session(); @@ -278,5 +282,25 @@ PasteboardHelperGtk* pasteboardHelperInstance() return helper; } +void setIconDatabaseEnabled(bool enabled) +{ + static bool initialized = false; + if (enabled && !initialized) { + initialized = true; + atexit(closeIconDatabaseOnExit); + } + + if (enabled) { + iconDatabase()->setEnabled(true); + GOwnPtr<gchar> iconDatabasePath(g_build_filename(g_get_user_data_dir(), "webkit", "icondatabase", NULL)); + iconDatabase()->open(iconDatabasePath.get()); + return; + } + + iconDatabase()->setEnabled(false); + iconDatabase()->close(); +} + + } /** end namespace WebKit */ |