Holger Hans Peter Freyther <holger.freyther@trolltech.com>
authorhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Apr 2008 13:50:35 +0000 (13:50 +0000)
committerhausmann@webkit.org <hausmann@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Apr 2008 13:50:35 +0000 (13:50 +0000)
* Export the PageCache and Cache capacity call one to one. This is only there
  to allow the QtLauncher to play with caching.
* TODO: make API decisions and consider following the windows Api to set a WebCacheModel
  and determine certain values automatically.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@31569 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/qt/Api/qwebsettings.cpp
WebKit/qt/Api/qwebsettings.h
WebKit/qt/ChangeLog
WebKit/qt/QtLauncher/main.cpp

index 8109de1..270221b 100644 (file)
@@ -26,7 +26,9 @@
 #include "qwebpage.h"
 #include "qwebpage_p.h"
 
+#include "Cache.h"
 #include "Page.h"
+#include "PageCache.h"
 #include "Settings.h"
 #include "KURL.h"
 #include "PlatformString.h"
@@ -313,6 +315,24 @@ QPixmap QWebSettings::webGraphic(WebGraphic type)
 }
 
 /*!
+ @internal
+*/
+void QWebSettings::setPageCacheCapacity(int numberOfPages)
+{
+    WebCore::pageCache()->setCapacity(qMax(0, numberOfPages));
+}
+
+/*!
+ @internal
+*/
+void QWebSettings::setObjectCacheCapacities(int cacheMinDeadCapacity, int cacheMaxDead, int totalCapacity)
+{
+    WebCore::cache()->setCapacities(qMax(0, cacheMinDeadCapacity),
+                                    qMax(0, cacheMaxDead),
+                                    qMax(0, totalCapacity));
+}
+
+/*!
     Sets the default font family to \a family for the specified \a type of font.
 */
 void QWebSettings::setFontFamily(FontType type, const QString &family)
index c071e51..57b032c 100644 (file)
@@ -96,6 +96,9 @@ public:
     static void setWebGraphic(WebGraphic type, const QPixmap &graphic);
     static QPixmap webGraphic(WebGraphic type);
 
+    static void setPageCacheCapacity(int numberOfPages);
+    static void setObjectCacheCapacities(int cacheMinDeadCapacity, int cacheMaxDead, int totalCapacity);
+
 private:
     friend class QWebPagePrivate;
     friend class QWebSettingsPrivate;
index 8cc9003..ffa6616 100644 (file)
@@ -2,6 +2,22 @@
 
         Reviewed by Simon.
 
+        * Export the PageCache and Cache capacity call one to one. This is only there
+        to allow the QtLauncher to play with caching.
+        * TODO: make API decisions and consider following the windows Api to set a WebCacheModel
+        and determine certain values automatically.
+        
+
+        * Api/qwebsettings.cpp:
+        (QWebSettings::setPageCacheCapacity):
+        (QWebSettings::setObjectCacheCapacities):
+        * Api/qwebsettings.h:
+        * QtLauncher/main.cpp:
+
+2008-04-02  Holger Hans Peter Freyther  <holger.freyther@trolltech.com>
+
+        Reviewed by Simon.
+
         Prepapre everything for enabling the PageCache for the Qt Platform:
         * Claim that we can cache pages
         * Create the FrameView FrameLoaderClientQt::transitionToCommittedForNewPage using
index 838ff6f..399387f 100644 (file)
@@ -387,6 +387,9 @@ int main(int argc, char **argv)
     QString url = QString("%1/%2").arg(QDir::homePath()).arg(QLatin1String("index.html"));
     QApplication app(argc, argv);
 
+    QWebSettings::setPageCacheCapacity(4);
+    QWebSettings::setObjectCacheCapacities((16*1024*1024)/8, (16*1024*1024)/8, 16*1024*1024);
+
     QWebSettings::defaultSettings()->setAttribute(QWebSettings::PluginsEnabled);
     QWebSettings::defaultSettings()->setAttribute(QWebSettings::DeveloperExtrasEnabled);