summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-11-07 23:58:11 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-07 23:58:11 +0000
commit3f01ade84de793f232762e9b5de3cb1549c79150 (patch)
treec656a4516b6e7b322fdea9f51c0626d7ffeee56d /Source
parentd7abaddf5e1d8a8e5caf8c2af18699d98be8b8bf (diff)
parent00d524fd5dc3e995e2b517da48e479694260ce2f (diff)
downloadexternal_webkit-3f01ade84de793f232762e9b5de3cb1549c79150.zip
external_webkit-3f01ade84de793f232762e9b5de3cb1549c79150.tar.gz
external_webkit-3f01ade84de793f232762e9b5de3cb1549c79150.tar.bz2
am 00d524fd: Merge "Change the default webView behavior to minimize the memory consumption" into ics-mr1
* commit '00d524fd5dc3e995e2b517da48e479694260ce2f': Change the default webView behavior to minimize the memory consumption
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/GLWebViewState.cpp11
-rw-r--r--Source/WebCore/platform/graphics/android/TilesManager.cpp1
-rw-r--r--Source/WebCore/platform/graphics/android/TilesManager.h12
-rw-r--r--Source/WebKit/android/nav/WebView.cpp8
4 files changed, 26 insertions, 6 deletions
diff --git a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
index a44a743..5f48773 100644
--- a/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
+++ b/Source/WebCore/platform/graphics/android/GLWebViewState.cpp
@@ -308,8 +308,10 @@ void GLWebViewState::setViewport(SkRect& viewport, float scale)
// allocate max possible number of tiles visible with this viewport
int viewMaxTileX = static_cast<int>(ceilf((viewport.width()-1) * invTileContentWidth)) + 1;
int viewMaxTileY = static_cast<int>(ceilf((viewport.height()-1) * invTileContentHeight)) + 1;
- int maxTextureCount = (viewMaxTileX + TILE_PREFETCH_DISTANCE * 2) *
- (viewMaxTileY + TILE_PREFETCH_DISTANCE * 2) * 2;
+
+ int maxTextureCount = (viewMaxTileX + m_expandedTileBoundsX * 2) *
+ (viewMaxTileY + m_expandedTileBoundsY * 2) * 2;
+
TilesManager::instance()->setMaxTextureCount(maxTextureCount);
m_tiledPageA->updateBaseTileSize();
m_tiledPageB->updateBaseTileSize();
@@ -425,8 +427,9 @@ bool GLWebViewState::drawGL(IntRect& rect, SkRect& viewport, IntRect* invalRect,
float viewWidth = (viewport.fRight - viewport.fLeft) * TILE_PREFETCH_RATIO;
float viewHeight = (viewport.fBottom - viewport.fTop) * TILE_PREFETCH_RATIO;
- bool useHorzPrefetch = viewWidth < baseContentWidth();
- bool useVertPrefetch = viewHeight < baseContentHeight();
+ bool useMinimalMemory = TilesManager::instance()->useMinimalMemory();
+ bool useHorzPrefetch = useMinimalMemory ? 0 : viewWidth < baseContentWidth();
+ bool useVertPrefetch = useMinimalMemory ? 0 : viewHeight < baseContentHeight();
m_expandedTileBoundsX = (useHorzPrefetch) ? TILE_PREFETCH_DISTANCE : 0;
m_expandedTileBoundsY = (useVertPrefetch) ? TILE_PREFETCH_DISTANCE : 0;
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.cpp b/Source/WebCore/platform/graphics/android/TilesManager.cpp
index d36017f..acfe9e7 100644
--- a/Source/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/Source/WebCore/platform/graphics/android/TilesManager.cpp
@@ -99,6 +99,7 @@ TilesManager::TilesManager()
, m_showVisualIndicator(false)
, m_invertedScreen(false)
, m_invertedScreenSwitch(false)
+ , m_useMinimalMemory(true)
, m_drawGLCount(1)
{
XLOG("TilesManager ctor");
diff --git a/Source/WebCore/platform/graphics/android/TilesManager.h b/Source/WebCore/platform/graphics/android/TilesManager.h
index 4daecff..8ae9202 100644
--- a/Source/WebCore/platform/graphics/android/TilesManager.h
+++ b/Source/WebCore/platform/graphics/android/TilesManager.h
@@ -170,6 +170,16 @@ public:
m_shader.setContrast(contrast);
}
+ void setUseMinimalMemory(bool useMinimalMemory)
+ {
+ m_useMinimalMemory = useMinimalMemory;
+ }
+
+ bool useMinimalMemory()
+ {
+ return m_useMinimalMemory;
+ }
+
void incDrawGLCount()
{
m_drawGLCount++;
@@ -207,6 +217,8 @@ private:
bool m_invertedScreen;
bool m_invertedScreenSwitch;
+ bool m_useMinimalMemory;
+
sp<TexturesGenerator> m_pixmapsGenerationThread;
android::Mutex m_texturesLock;
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 64d7bbd..60bdd3e 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -2578,16 +2578,20 @@ static bool nativeSetProperty(JNIEnv *env, jobject obj, jstring jkey, jstring jv
TilesManager::instance()->setInvertedScreen(false);
return true;
}
- if (key == "inverted_contrast") {
+ else if (key == "inverted_contrast") {
float contrast = value.toFloat();
TilesManager::instance()->setInvertedScreenContrast(contrast);
return true;
}
- if (key == "enable_cpu_upload_path") {
+ else if (key == "enable_cpu_upload_path") {
TilesManager::instance()->transferQueue()->setTextureUploadType(
value == "true" ? CpuUpload : GpuUpload);
return true;
}
+ else if (key == "use_minimal_memory") {
+ TilesManager::instance()->setUseMinimalMemory(value == "true");
+ return true;
+ }
return false;
}