[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
eric at webkit.org
eric at webkit.org
Tue Jan 5 23:56:29 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 0992386b98f4ff62825b5e7c818f1d6334d61ddc
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Dec 20 15:53:37 2009 +0000
2009-12-20 Alejandro G. Castro <alex at igalia.com>
Reviewed by Xan Lopez.
[GTK] Cache control APIs
https://bugs.webkit.org/show_bug.cgi?id=24001
Original patch by Bobby Powers <bobby at laptop.org>
Added new API to specify cache models for GTK port.
* webkit/webkitprivate.cpp:
(webkit_init): set a default cache model.
* webkit/webkitwebview.cpp:
* webkit/webkitwebview.h:
(webkit_set_cache_model): Added function.
(webkit_get_cache_model): Added function.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52418 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 6356da9..ee7f2a8 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,21 @@
+2009-12-20 Alejandro G. Castro <alex at igalia.com>
+
+ Reviewed by Xan Lopez.
+
+ [GTK] Cache control APIs
+ https://bugs.webkit.org/show_bug.cgi?id=24001
+
+ Original patch by Bobby Powers <bobby at laptop.org>
+
+ Added new API to specify cache models for GTK port.
+
+ * webkit/webkitprivate.cpp:
+ (webkit_init): set a default cache model.
+ * webkit/webkitwebview.cpp:
+ * webkit/webkitwebview.h:
+ (webkit_set_cache_model): Added function.
+ (webkit_get_cache_model): Added function.
+
2009-12-20 Xan Lopez <xlopez at igalia.com>
Revert the previous patch, it introduces some failures in the
diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp
index a75bf9a..fe81e36 100644
--- a/WebKit/gtk/webkit/webkitprivate.cpp
+++ b/WebKit/gtk/webkit/webkitprivate.cpp
@@ -254,7 +254,7 @@ void webkit_init()
// 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);
+ webkit_set_cache_model(WEBKIT_CACHE_MODEL_WEB_BROWSER);
#if ENABLE(DATABASE)
gchar* databaseDirectory = g_build_filename(g_get_user_data_dir(), "webkit", "databases", NULL);
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index b87eeeb..2d2e6e7 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -9,6 +9,7 @@
* Copyright (C) 2008, 2009 Collabora Ltd.
* Copyright (C) 2009 Igalia S.L.
* Copyright (C) 2009 Movial Creative Technologies Inc.
+ * Copyright (C) 2009 Bobby Powers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -41,6 +42,7 @@
#include "AXObjectCache.h"
#include "NotImplemented.h"
#include "BackForwardList.h"
+#include "Cache.h"
#include "CString.h"
#include "ChromeClientGtk.h"
#include "ContextMenu.h"
@@ -65,6 +67,7 @@
#include "FrameLoader.h"
#include "FrameView.h"
#include "MouseEventWithHitTestResults.h"
+#include "PageCache.h"
#include "Pasteboard.h"
#include "PasteboardHelper.h"
#include "PasteboardHelperGtk.h"
@@ -113,6 +116,7 @@
*/
static const double defaultDPI = 96.0;
+static WebKitCacheModel cacheModel;
using namespace WebKit;
using namespace WebCore;
@@ -4067,3 +4071,81 @@ G_CONST_RETURN gchar* webkit_web_view_get_icon_uri(WebKitWebView* webView)
priv->iconURI = g_strdup(iconURL.utf8().data());
return priv->iconURI;
}
+
+/**
+ * webkit_set_cache_model:
+ * @cache_model: a #WebKitCacheModel
+ *
+ * Specifies a usage model for WebViews, which WebKit will use to
+ * determine its caching behavior. All web views follow the cache
+ * model. This cache model determines the RAM and disk space to use
+ * for caching previously viewed content .
+ *
+ * Research indicates that users tend to browse within clusters of
+ * documents that hold resources in common, and to revisit previously
+ * visited documents. WebKit and the frameworks below it include
+ * built-in caches that take advantage of these patterns,
+ * substantially improving document load speed in browsing
+ * situations. The WebKit cache model controls the behaviors of all of
+ * these caches, including various WebCore caches.
+ *
+ * Browsers can improve document load speed substantially by
+ * specifying WEBKIT_CACHE_MODEL_WEB_BROWSER. Applications without a
+ * browsing interface can reduce memory usage substantially by
+ * specifying WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER. Default value is
+ * WEBKIT_CACHE_MODEL_WEB_BROWSER.
+ *
+ * Since: 1.1.18
+ */
+void webkit_set_cache_model(WebKitCacheModel model)
+{
+ if (cacheModel == model)
+ return;
+
+ // FIXME: Add disk cache handling when soup has the API
+ guint cacheTotalCapacity;
+ guint cacheMinDeadCapacity;
+ guint cacheMaxDeadCapacity;
+ gdouble deadDecodedDataDeletionInterval;
+ guint pageCacheCapacity;
+
+ switch (model) {
+ case WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER:
+ pageCacheCapacity = 0;
+ cacheTotalCapacity = 0;
+ cacheMinDeadCapacity = 0;
+ cacheMaxDeadCapacity = 0;
+ deadDecodedDataDeletionInterval = 0;
+ break;
+ case WEBKIT_CACHE_MODEL_WEB_BROWSER:
+ pageCacheCapacity = 3;
+ cacheTotalCapacity = 32 * 1024 * 1024;
+ cacheMinDeadCapacity = cacheTotalCapacity / 4;
+ cacheMaxDeadCapacity = cacheTotalCapacity / 2;
+ deadDecodedDataDeletionInterval = 60;
+ break;
+ default:
+ g_return_if_reached();
+ }
+
+ cache()->setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
+ cache()->setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
+ pageCache()->setCapacity(pageCacheCapacity);
+ cacheModel = model;
+}
+
+/**
+ * webkit_get_cache_model:
+ *
+ * Returns the current cache model. For more information about this
+ * value check the documentation of the function
+ * webkit_set_cache_model().
+ *
+ * Return value: the current #WebKitCacheModel
+ *
+ * Since: 1.1.18
+ */
+WebKitCacheModel webkit_get_cache_model()
+{
+ return cacheModel;
+}
diff --git a/WebKit/gtk/webkit/webkitwebview.h b/WebKit/gtk/webkit/webkitwebview.h
index 8dd7f39..e69de0a 100644
--- a/WebKit/gtk/webkit/webkitwebview.h
+++ b/WebKit/gtk/webkit/webkitwebview.h
@@ -49,6 +49,11 @@ typedef enum {
WEBKIT_NAVIGATION_RESPONSE_DOWNLOAD
} WebKitNavigationResponse;
+typedef enum {
+ WEBKIT_CACHE_MODEL_DOCUMENT_VIEWER = 1,
+ WEBKIT_CACHE_MODEL_WEB_BROWSER
+} WebKitCacheModel;
+
typedef enum
{
WEBKIT_WEB_VIEW_TARGET_INFO_HTML,
@@ -370,6 +375,12 @@ webkit_web_view_get_hit_test_result (WebKitWebView *webView,
WEBKIT_API G_CONST_RETURN gchar *
webkit_web_view_get_icon_uri (WebKitWebView *webView);
+WEBKIT_API void
+webkit_set_cache_model (WebKitCacheModel cache_model);
+
+WEBKIT_API WebKitCacheModel
+webkit_get_cache_model (void);
+
G_END_DECLS
#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list