diff options
author | Shimeng (Simon) Wang <swang@google.com> | 2011-01-21 15:09:09 -0800 |
---|---|---|
committer | Shimeng (Simon) Wang <swang@google.com> | 2011-01-24 12:18:08 -0800 |
commit | 6e8da6e69536dd9fd167ad0f7a429c43cea6e6d2 (patch) | |
tree | fc3f5b209fb4cf18b2f6792148ec0bd6250fba82 | |
parent | 908703e420f4931f74527aaeb3d5faabdd66c28a (diff) | |
download | external_webkit-6e8da6e69536dd9fd167ad0f7a429c43cea6e6d2.zip external_webkit-6e8da6e69536dd9fd167ad0f7a429c43cea6e6d2.tar.gz external_webkit-6e8da6e69536dd9fd167ad0f7a429c43cea6e6d2.tar.bz2 |
Use platform bridge to control high usage delta MB.
This change gives flexibility to change that value in Java side.
issue: 3317722
Change-Id: I71a548871783cc604e0daec63e6bbfb26ecc1e1f
-rw-r--r-- | WebCore/bindings/v8/V8GCController.cpp | 3 | ||||
-rw-r--r-- | WebCore/platform/android/PlatformBridge.h | 1 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/MemoryUsage.cpp | 2 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/MemoryUsage.h | 3 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/PlatformBridge.cpp | 5 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 3 |
6 files changed, 14 insertions, 3 deletions
diff --git a/WebCore/bindings/v8/V8GCController.cpp b/WebCore/bindings/v8/V8GCController.cpp index 3eeacec..9107b51 100644 --- a/WebCore/bindings/v8/V8GCController.cpp +++ b/WebCore/bindings/v8/V8GCController.cpp @@ -453,8 +453,7 @@ void V8GCController::checkMemoryUsage() // 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; + static const int highUsageDeltaMB = PlatformBridge::highUsageDeltaMB(); #else return; #endif diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h index c67c865..7d54ae5 100644 --- a/WebCore/platform/android/PlatformBridge.h +++ b/WebCore/platform/android/PlatformBridge.h @@ -145,6 +145,7 @@ public: // Memory details for V8 GC static int lowMemoryUsageMB(); static int highMemoryUsageMB(); + static int highUsageDeltaMB(); static int memoryUsageMB(); static int actualMemoryUsageMB(); }; diff --git a/WebKit/android/WebCoreSupport/MemoryUsage.cpp b/WebKit/android/WebCoreSupport/MemoryUsage.cpp index f799a18..32cdebf 100644 --- a/WebKit/android/WebCoreSupport/MemoryUsage.cpp +++ b/WebKit/android/WebCoreSupport/MemoryUsage.cpp @@ -78,4 +78,4 @@ int MemoryUsage::memoryUsageMb(bool forceFresh) int MemoryUsage::m_lowMemoryUsageMb = 0; int MemoryUsage::m_highMemoryUsageMb = 0; - +int MemoryUsage::m_highUsageDeltaMb = 0; diff --git a/WebKit/android/WebCoreSupport/MemoryUsage.h b/WebKit/android/WebCoreSupport/MemoryUsage.h index 899fd08..2a3d7ed 100644 --- a/WebKit/android/WebCoreSupport/MemoryUsage.h +++ b/WebKit/android/WebCoreSupport/MemoryUsage.h @@ -31,12 +31,15 @@ public: static int memoryUsageMb(bool forceFresh); static int lowMemoryUsageMb() { return m_lowMemoryUsageMb; } static int highMemoryUsageMb() { return m_highMemoryUsageMb; } + static int highUsageDeltaMb() { return m_highUsageDeltaMb; } static void setHighMemoryUsageMb(int highMemoryUsageMb) { m_highMemoryUsageMb = highMemoryUsageMb; } static void setLowMemoryUsageMb(int lowMemoryUsageMb) { m_lowMemoryUsageMb = lowMemoryUsageMb; } + static void setHighUsageDeltaMb(int highUsageDeltaMb) { m_highUsageDeltaMb = highUsageDeltaMb; } private: static int m_lowMemoryUsageMb; static int m_highMemoryUsageMb; + static int m_highUsageDeltaMb; }; #endif diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp index baeddb2..0bc2e3c 100644 --- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp +++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -201,6 +201,11 @@ int PlatformBridge::highMemoryUsageMB() return MemoryUsage::highMemoryUsageMb(); } +int PlatformBridge::highUsageDeltaMB() +{ + return MemoryUsage::highUsageDeltaMb(); +} + int PlatformBridge::memoryUsageMB() { return MemoryUsage::memoryUsageMb(false); diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 6fd7b9c..9abc061 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -240,6 +240,7 @@ struct WebViewCoreFields { jfieldID m_drawIsPaused; jfieldID m_lowMemoryUsageMb; jfieldID m_highMemoryUsageMb; + jfieldID m_highUsageDeltaMb; } gWebViewCoreFields; // ---------------------------------------------------------------------------- @@ -400,6 +401,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m MemoryUsage::setLowMemoryUsageMb(env->GetIntField(javaWebViewCore, gWebViewCoreFields.m_lowMemoryUsageMb)); MemoryUsage::setHighMemoryUsageMb(env->GetIntField(javaWebViewCore, gWebViewCoreFields.m_highMemoryUsageMb)); + MemoryUsage::setHighUsageDeltaMb(env->GetIntField(javaWebViewCore, gWebViewCoreFields.m_highUsageDeltaMb)); WebViewCore::addInstance(this); @@ -4361,6 +4363,7 @@ int registerWebViewCore(JNIEnv* env) "Unable to find android/webkit/WebViewCore.mDrawIsPaused"); gWebViewCoreFields.m_lowMemoryUsageMb = env->GetFieldID(widget, "mLowMemoryUsageThresholdMb", "I"); gWebViewCoreFields.m_highMemoryUsageMb = env->GetFieldID(widget, "mHighMemoryUsageThresholdMb", "I"); + gWebViewCoreFields.m_highUsageDeltaMb = env->GetFieldID(widget, "mHighUsageDeltaMb", "I"); gWebViewCoreStaticMethods.m_isSupportedMediaMimeType = env->GetStaticMethodID(widget, "isSupportedMediaMimeType", "(Ljava/lang/String;)Z"); |