summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/v8/V8GCController.cpp
diff options
context:
space:
mode:
authorRussell Brenner <russellbrenner@google.com>2010-11-18 17:33:13 -0800
committerRussell Brenner <russellbrenner@google.com>2010-12-02 13:47:21 -0800
commit6b70adc33054f8aee8c54d0f460458a9df11b8a5 (patch)
tree103a13998c33944d6ab3b8318c509a037e639460 /WebCore/bindings/v8/V8GCController.cpp
parentbdf4ebc8e70b2d221b6ee7a65660918ecb1d33aa (diff)
downloadexternal_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.zip
external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.gz
external_webkit-6b70adc33054f8aee8c54d0f460458a9df11b8a5.tar.bz2
Merge WebKit at r72274: Initial merge by git.
Change-Id: Ie51f0b4a16da82942bd516dce59cfb79ebbe25fb
Diffstat (limited to 'WebCore/bindings/v8/V8GCController.cpp')
-rw-r--r--WebCore/bindings/v8/V8GCController.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/WebCore/bindings/v8/V8GCController.cpp b/WebCore/bindings/v8/V8GCController.cpp
index 36beece..b26882b 100644
--- a/WebCore/bindings/v8/V8GCController.cpp
+++ b/WebCore/bindings/v8/V8GCController.cpp
@@ -38,6 +38,7 @@
#include "HTMLImageElement.h"
#include "HTMLNames.h"
#include "MessagePort.h"
+#include "PlatformBridge.h"
#include "SVGElement.h"
#include "V8Binding.h"
#include "V8DOMMap.h"
@@ -266,8 +267,8 @@ public:
if (!root)
return;
} else {
- while (root->parent())
- root = root->parent();
+ while (root->parentNode())
+ root = root->parentNode();
// If the node is alone in its DOM tree (doesn't have a parent or any
// children) then the group will be filtered out later anyway.
@@ -399,8 +400,8 @@ namespace {
int getMemoryUsageInMB()
{
-#if PLATFORM(CHROMIUM)
- return ChromiumBridge::memoryUsageMB();
+#if PLATFORM(CHROMIUM) || PLATFORM(ANDROID)
+ return PlatformBridge::memoryUsageMB();
#else
return 0;
#endif
@@ -408,8 +409,8 @@ int getMemoryUsageInMB()
int getActualMemoryUsageInMB()
{
-#if PLATFORM(CHROMIUM)
- return ChromiumBridge::actualMemoryUsageMB();
+#if PLATFORM(CHROMIUM) || PLATFORM(ANDROID)
+ return PlatformBridge::actualMemoryUsageMB();
#else
return 0;
#endif
@@ -448,11 +449,19 @@ void V8GCController::checkMemoryUsage()
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.
+#elif PLATFORM(ANDROID)
+ // Query the PlatformBridge for memory thresholds as these vary device to device.
+ static const int lowUsageMB = PlatformBridge::lowMemoryUsageMB();
+ static const int highUsageMB = PlatformBridge::highMemoryUsageMB();
+ // We use a delta of -1 to ensure that when we are in a low memory situation we always trigger a GC.
+ static const int highUsageDeltaMB = -1;
+#else
+ return;
+#endif
int memoryUsageMB = getMemoryUsageInMB();
if ((memoryUsageMB > lowUsageMB && memoryUsageMB > 2 * workingSetEstimateMB) || (memoryUsageMB > highUsageMB && memoryUsageMB > workingSetEstimateMB + highUsageDeltaMB))
v8::V8::LowMemoryNotification();
-#endif
}