Title: [104288] trunk/Source/WebKit
- Revision
- 104288
- Author
- [email protected]
- Date
- 2012-01-06 06:21:14 -0800 (Fri, 06 Jan 2012)
Log Message
[BlackBerry] Upstream BlackBerry WebCoreSupport cache client
https://bugs.webkit.org/show_bug.cgi?id=75649
Patch by Jacky Jiang <[email protected]> on 2012-01-06
Reviewed by Antonio Gomes.
Initial upstream, no new tests.
* blackberry/WebCoreSupport/CacheClientBlackBerry.cpp: Added.
* blackberry/WebCoreSupport/CacheClientBlackBerry.h: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (104287 => 104288)
--- trunk/Source/WebKit/ChangeLog 2012-01-06 13:34:27 UTC (rev 104287)
+++ trunk/Source/WebKit/ChangeLog 2012-01-06 14:21:14 UTC (rev 104288)
@@ -1,3 +1,15 @@
+2012-01-06 Jacky Jiang <[email protected]>
+
+ [BlackBerry] Upstream BlackBerry WebCoreSupport cache client
+ https://bugs.webkit.org/show_bug.cgi?id=75649
+
+ Reviewed by Antonio Gomes.
+
+ Initial upstream, no new tests.
+
+ * blackberry/WebCoreSupport/CacheClientBlackBerry.cpp: Added.
+ * blackberry/WebCoreSupport/CacheClientBlackBerry.h: Added.
+
2012-01-03 Jon Lee <[email protected]>
Leak of WebNotificationClient when page is destroyed
Added: trunk/Source/WebKit/blackberry/WebCoreSupport/CacheClientBlackBerry.cpp (0 => 104288)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/CacheClientBlackBerry.cpp (rev 0)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/CacheClientBlackBerry.cpp 2012-01-06 14:21:14 UTC (rev 104288)
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "CacheClientBlackBerry.h"
+
+#include "MemoryCache.h"
+#include <BlackBerryPlatformMisc.h>
+#include <BlackBerryPlatformSettings.h>
+
+namespace WebCore {
+
+CacheClientBlackBerry* CacheClientBlackBerry::get()
+{
+ static CacheClientBlackBerry s_cacheClient;
+ return &s_cacheClient;
+}
+
+CacheClientBlackBerry::CacheClientBlackBerry()
+ : m_lastCapacity(0)
+{
+}
+
+void CacheClientBlackBerry::initialize()
+{
+#if ENABLE(BLACKBERRY_DEBUG_MEMORY)
+ bool isDisabled = true;
+#else
+ bool isDisabled = false;
+#endif
+ memoryCache()->setDisabled(isDisabled);
+ if (!isDisabled) {
+ // We have to set a non-zero interval to schedule cache pruning after a CachedImage becoming dead.
+ memoryCache()->setDeadDecodedDataDeletionInterval(0.01);
+ updateCacheCapacity();
+ }
+}
+
+void CacheClientBlackBerry::updateCacheCapacity()
+{
+#if ENABLE(BLACKBERRY_DEBUG_MEMORY)
+ // We're debugging memory usage. So keep it disabled.
+#else
+ unsigned cacheCapacity = BlackBerry::Platform::Settings::get()->getSuggestedCacheCapacity(memoryCache()->totalSize());
+ if (m_lastCapacity == cacheCapacity) {
+ // Suggested capacity hasn't been changed.
+ return;
+ }
+
+ m_lastCapacity = cacheCapacity;
+ memoryCache()->setCapacities(0, m_lastCapacity, m_lastCapacity);
+#endif
+}
+
+} // WebCore
Added: trunk/Source/WebKit/blackberry/WebCoreSupport/CacheClientBlackBerry.h (0 => 104288)
--- trunk/Source/WebKit/blackberry/WebCoreSupport/CacheClientBlackBerry.h (rev 0)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/CacheClientBlackBerry.h 2012-01-06 14:21:14 UTC (rev 104288)
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef CacheClientBlackBerry_h
+#define CacheClientBlackBerry_h
+
+namespace WebCore {
+
+class CacheClientBlackBerry {
+public:
+ static CacheClientBlackBerry* get();
+
+ void initialize();
+ void updateCacheCapacity();
+
+private:
+ CacheClientBlackBerry();
+ unsigned m_lastCapacity;
+};
+
+} // WebCore
+
+#endif // CacheClientBlackBerry_h
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes