summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorShimeng (Simon) Wang <swang@google.com>2011-01-25 10:27:24 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-01-25 10:27:24 -0800
commitc1e7f2d371aa6c2aa9ed3207689cb53a1f704cbc (patch)
tree8b036d6c0affdfcef64a208f5e564dc8280fc116 /core/java/android
parent7f532976baa54d2935a8ba42cc2c529b7460e57a (diff)
parent7c1bcfddcdb8665b0a73a45028fb72123e00cfd5 (diff)
downloadframeworks_base-c1e7f2d371aa6c2aa9ed3207689cb53a1f704cbc.zip
frameworks_base-c1e7f2d371aa6c2aa9ed3207689cb53a1f704cbc.tar.gz
frameworks_base-c1e7f2d371aa6c2aa9ed3207689cb53a1f704cbc.tar.bz2
Merge "Set high usage delta to 1 to avoid constant V8 GC." into honeycomb
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/webkit/WebViewCore.java14
1 files changed, 9 insertions, 5 deletions
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index bb4441f..0992079 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -130,6 +130,7 @@ final class WebViewCore {
private int mLowMemoryUsageThresholdMb;
private int mHighMemoryUsageThresholdMb;
+ private int mHighUsageDeltaMb;
// The thread name used to identify the WebCore thread and for use in
// debugging other classes that require operation within the WebCore thread.
@@ -186,12 +187,15 @@ final class WebViewCore {
// Allow us to use up to our memory class value before V8's GC kicks in.
// These values have been determined by experimentation.
- mLowMemoryUsageThresholdMb = manager.getMemoryClass();
+ mLowMemoryUsageThresholdMb = manager.getLargeMemoryClass();
// If things get crazy, allow V8 to use up to 3 times our memory class, or a third of the
- // device's total available memory, whichever is smaller. At that point V8 will start
- // attempting more aggressive garbage collection.
- mHighMemoryUsageThresholdMb = Math.min(mLowMemoryUsageThresholdMb * 3,
- (int) (memInfo.availMem / 3) >> 20);
+ // device's total available memory, whichever is smaller. This value must be no less
+ // than the low memory threshold.
+ // At that point V8 will start attempting more aggressive garbage collection.
+ mHighMemoryUsageThresholdMb = Math.max(Math.min(mLowMemoryUsageThresholdMb * 3,
+ (int) (memInfo.availMem / 3) >> 20), mLowMemoryUsageThresholdMb);
+ // Avoid constant V8 GC when memory usage equals to working set estimate.
+ mHighUsageDeltaMb = 1;
// Send a message to initialize the WebViewCore.
Message init = sWebCoreHandler.obtainMessage(