- Revision
- 94504
- Author
- [email protected]
- Date
- 2011-09-04 11:10:26 -0700 (Sun, 04 Sep 2011)
Log Message
[Chromium] Add memory threshold values to WebKitPlatformSupport.h
https://bugs.webkit.org/show_bug.cgi?id=67575
Reviewed by Darin Fisher.
Source/WebCore:
Grab these memory thresholds from PlatformSupport rather than hard-coding them.
* bindings/v8/V8GCController.cpp:
(WebCore::V8GCController::checkMemoryUsage):
* platform/chromium/PlatformSupport.h:
* platform/qt/PlatformSupport.h:
(WebCore::PlatformSupport::lowMemoryUsageMB):
(WebCore::PlatformSupport::highMemoryUsageMB):
(WebCore::PlatformSupport::highUsageDeltaMB):
Source/WebKit/chromium:
Instead of hard-coding these values, we now grab them from
WebKitPlatformSupport because Android wishes to configure them on a
per-device basis.
One could view grabing these values from PlatformSupport as a bit of a
layering violation (because they feel like policy), but another view is
that the alternative implementation is to query the OS for various
memory parameters. In either case, getting these values via
PlatformSupport is much easier and consistent with the other memory
related queries in PlatformSupport already.
* public/WebKitPlatformSupport.h:
(WebKit::WebKitPlatformSupport::lowMemoryUsageMB):
(WebKit::WebKitPlatformSupport::highMemoryUsageMB):
(WebKit::WebKitPlatformSupport::highUsageDeltaMB):
* src/PlatformSupport.cpp:
(WebCore::PlatformSupport::lowMemoryUsageMB):
(WebCore::PlatformSupport::highMemoryUsageMB):
(WebCore::PlatformSupport::highUsageDeltaMB):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (94503 => 94504)
--- trunk/Source/WebCore/ChangeLog 2011-09-04 18:04:45 UTC (rev 94503)
+++ trunk/Source/WebCore/ChangeLog 2011-09-04 18:10:26 UTC (rev 94504)
@@ -1,3 +1,20 @@
+2011-09-04 Adam Barth <[email protected]>
+
+ [Chromium] Add memory threshold values to WebKitPlatformSupport.h
+ https://bugs.webkit.org/show_bug.cgi?id=67575
+
+ Reviewed by Darin Fisher.
+
+ Grab these memory thresholds from PlatformSupport rather than hard-coding them.
+
+ * bindings/v8/V8GCController.cpp:
+ (WebCore::V8GCController::checkMemoryUsage):
+ * platform/chromium/PlatformSupport.h:
+ * platform/qt/PlatformSupport.h:
+ (WebCore::PlatformSupport::lowMemoryUsageMB):
+ (WebCore::PlatformSupport::highMemoryUsageMB):
+ (WebCore::PlatformSupport::highUsageDeltaMB):
+
2011-09-04 Kevin Ollivier <[email protected]>
[wx] Unreviewed build fix. Add new / moved files missing from last commit.
Modified: trunk/Source/WebCore/bindings/v8/V8GCController.cpp (94503 => 94504)
--- trunk/Source/WebCore/bindings/v8/V8GCController.cpp 2011-09-04 18:04:45 UTC (rev 94503)
+++ trunk/Source/WebCore/bindings/v8/V8GCController.cpp 2011-09-04 18:10:26 UTC (rev 94504)
@@ -464,16 +464,15 @@
void V8GCController::checkMemoryUsage()
{
#if PLATFORM(CHROMIUM) || PLATFORM(QT) && !OS(SYMBIAN)
- // These values are appropriate for Chromium only.
- const int lowUsageMB = 256; // If memory usage is below this threshold, do not bother forcing GC.
- const int highUsageMB = 1024; // If memory usage is above this threshold, force GC more aggresively.
- const int highUsageDeltaMB = 128; // Delta of memory usage growth (vs. last workingSetEstimateMB) to force GC when memory usage is high.
+ const int lowMemoryUsageMB = PlatformSupport::lowMemoryUsageMB();
+ const int highMemoryUsageMB = PlatformSupport::highMemoryUsageMB();
+ const int highUsageDeltaMB = PlatformSupport::highUsageDeltaMB();
#else
return;
#endif
int memoryUsageMB = getMemoryUsageInMB();
- if ((memoryUsageMB > lowUsageMB && memoryUsageMB > 2 * workingSetEstimateMB) || (memoryUsageMB > highUsageMB && memoryUsageMB > workingSetEstimateMB + highUsageDeltaMB))
+ if ((memoryUsageMB > lowMemoryUsageMB && memoryUsageMB > 2 * workingSetEstimateMB) || (memoryUsageMB > highMemoryUsageMB && memoryUsageMB > workingSetEstimateMB + highUsageDeltaMB))
v8::V8::LowMemoryNotification();
}
Modified: trunk/Source/WebCore/platform/chromium/PlatformSupport.h (94503 => 94504)
--- trunk/Source/WebCore/platform/chromium/PlatformSupport.h 2011-09-04 18:04:45 UTC (rev 94503)
+++ trunk/Source/WebCore/platform/chromium/PlatformSupport.h 2011-09-04 18:10:26 UTC (rev 94504)
@@ -197,9 +197,14 @@
// Returns the current space allocated for the pagefile, in MB.
// That is committed size for Windows and virtual memory size for POSIX
static int memoryUsageMB();
-
// Same as above, but always returns actual value, without any caches.
static int actualMemoryUsageMB();
+ // If memory usage is below this threshold, do not bother forcing GC.
+ static int lowMemoryUsageMB();
+ // If memory usage is above this threshold, force GC more aggressively.
+ static int highMemoryUsageMB();
+ // Delta of memory usage growth (vs. last actualMemoryUsageMB()) to force GC when memory usage is high.
+ static int highUsageDeltaMB();
// MimeType -----------------------------------------------------------
static bool isSupportedImageMIMEType(const String& mimeType);
Modified: trunk/Source/WebCore/platform/qt/PlatformSupport.h (94503 => 94504)
--- trunk/Source/WebCore/platform/qt/PlatformSupport.h 2011-09-04 18:04:45 UTC (rev 94503)
+++ trunk/Source/WebCore/platform/qt/PlatformSupport.h 2011-09-04 18:10:26 UTC (rev 94504)
@@ -91,6 +91,15 @@
static bool popupsAllowed(NPP npp);
// Plugin
static NPObject* pluginScriptableObject(Widget*);
+
+ // If memory usage is below this threshold, do not bother forcing GC.
+ static int lowMemoryUsageMB() { return 256; }
+
+ // If memory usage is above this threshold, force GC more aggressively.
+ static int highMemoryUsageMB() { return 1024; }
+
+ // Delta of memory usage growth (vs. last actualMemoryUsageMB()) to force GC when memory usage is high.
+ static int highUsageDeltaMB() { return 128; }
};
}
Modified: trunk/Source/WebKit/chromium/ChangeLog (94503 => 94504)
--- trunk/Source/WebKit/chromium/ChangeLog 2011-09-04 18:04:45 UTC (rev 94503)
+++ trunk/Source/WebKit/chromium/ChangeLog 2011-09-04 18:10:26 UTC (rev 94504)
@@ -1,3 +1,30 @@
+2011-09-04 Adam Barth <[email protected]>
+
+ [Chromium] Add memory threshold values to WebKitPlatformSupport.h
+ https://bugs.webkit.org/show_bug.cgi?id=67575
+
+ Reviewed by Darin Fisher.
+
+ Instead of hard-coding these values, we now grab them from
+ WebKitPlatformSupport because Android wishes to configure them on a
+ per-device basis.
+
+ One could view grabing these values from PlatformSupport as a bit of a
+ layering violation (because they feel like policy), but another view is
+ that the alternative implementation is to query the OS for various
+ memory parameters. In either case, getting these values via
+ PlatformSupport is much easier and consistent with the other memory
+ related queries in PlatformSupport already.
+
+ * public/WebKitPlatformSupport.h:
+ (WebKit::WebKitPlatformSupport::lowMemoryUsageMB):
+ (WebKit::WebKitPlatformSupport::highMemoryUsageMB):
+ (WebKit::WebKitPlatformSupport::highUsageDeltaMB):
+ * src/PlatformSupport.cpp:
+ (WebCore::PlatformSupport::lowMemoryUsageMB):
+ (WebCore::PlatformSupport::highMemoryUsageMB):
+ (WebCore::PlatformSupport::highUsageDeltaMB):
+
2011-09-02 Adam Barth <[email protected]>
Remove WebKitClient.h
Modified: trunk/Source/WebKit/chromium/public/WebKitPlatformSupport.h (94503 => 94504)
--- trunk/Source/WebKit/chromium/public/WebKitPlatformSupport.h 2011-09-04 18:04:45 UTC (rev 94503)
+++ trunk/Source/WebKit/chromium/public/WebKitPlatformSupport.h 2011-09-04 18:10:26 UTC (rev 94504)
@@ -171,7 +171,16 @@
// Same as above, but always returns actual value, without any caches.
virtual size_t actualMemoryUsageMB() { return 0; }
+ // If memory usage is below this threshold, do not bother forcing GC.
+ virtual size_t lowMemoryUsageMB() { return 256; }
+ // If memory usage is above this threshold, force GC more aggressively.
+ virtual size_t highMemoryUsageMB() { return 1024; }
+
+ // Delta of memory usage growth (vs. last actualMemoryUsageMB()) to force GC when memory usage is high.
+ virtual size_t highUsageDeltaMB() { return 128; }
+
+
// Threads -------------------------------------------------------
// Creates an embedder-defined thread.
Modified: trunk/Source/WebKit/chromium/src/PlatformSupport.cpp (94503 => 94504)
--- trunk/Source/WebKit/chromium/src/PlatformSupport.cpp 2011-09-04 18:04:45 UTC (rev 94503)
+++ trunk/Source/WebKit/chromium/src/PlatformSupport.cpp 2011-09-04 18:10:26 UTC (rev 94504)
@@ -1010,6 +1010,21 @@
return static_cast<int>(webKitPlatformSupport()->actualMemoryUsageMB());
}
+int PlatformSupport::lowMemoryUsageMB()
+{
+ return static_cast<int>(webKitPlatformSupport()->lowMemoryUsageMB());
+}
+
+int PlatformSupport::highMemoryUsageMB()
+{
+ return static_cast<int>(webKitPlatformSupport()->highMemoryUsageMB());
+}
+
+int PlatformSupport::highUsageDeltaMB()
+{
+ return static_cast<int>(webKitPlatformSupport()->highUsageDeltaMB());
+}
+
int PlatformSupport::screenDepth(Widget* widget)
{
WebWidgetClient* client = toWebWidgetClient(widget);