summaryrefslogtreecommitdiffstats
path: root/WebCore/platform
diff options
context:
space:
mode:
authorNicolas Roard <nicolas@android.com>2011-02-18 16:35:20 -0800
committerNicolas Roard <nicolas@android.com>2011-02-18 17:12:05 -0800
commit40dbb7e9ff961829a7f4402ab8657c622ec2e9f6 (patch)
treeed40a99bfbab11c8a8917c72a641e964ccf770e0 /WebCore/platform
parentc5d1392944f2445721200c02aaf7bc1181772152 (diff)
downloadexternal_webkit-40dbb7e9ff961829a7f4402ab8657c622ec2e9f6.zip
external_webkit-40dbb7e9ff961829a7f4402ab8657c622ec2e9f6.tar.gz
external_webkit-40dbb7e9ff961829a7f4402ab8657c622ec2e9f6.tar.bz2
Fix potential bug in setMaxTextureCount and limit
the number of textures to 154 Change-Id: Ie77935015d744fcfda9bfffd751df6c7f3cd10bb
Diffstat (limited to 'WebCore/platform')
-rw-r--r--WebCore/platform/graphics/android/TilesManager.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/WebCore/platform/graphics/android/TilesManager.cpp b/WebCore/platform/graphics/android/TilesManager.cpp
index a15e862..16fb782 100644
--- a/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/WebCore/platform/graphics/android/TilesManager.cpp
@@ -55,10 +55,11 @@
// We need n textures for one TiledPage, and another n textures for the
// second page used when scaling.
// In our case, we use 300x300 textures. On the tablet, this equates to
-// at least 5 * 3 = 15 textures. We can also enable offscreen textures
+// at least 5 * 3 = 15 textures. We also enable offscreen textures to a maximum
+// of 154 textures used (i.e. ~106Mb max, accounting for the double buffer textures)
#define EXPANDED_TILE_BOUNDS_X 1
#define EXPANDED_TILE_BOUNDS_Y 4
-#define MAX_TEXTURE_ALLOCATION (5+1+EXPANDED_TILE_BOUNDS_X*2)*(3+1+EXPANDED_TILE_BOUNDS_Y*2)*2
+#define MAX_TEXTURE_ALLOCATION (5+EXPANDED_TILE_BOUNDS_X*2)*(3+EXPANDED_TILE_BOUNDS_Y*2)*2
#define TILE_WIDTH 300
#define TILE_HEIGHT 300
@@ -374,13 +375,20 @@ int TilesManager::maxTextureCount()
void TilesManager::setMaxTextureCount(int max)
{
- XLOG("setMaxTextureCount: %d", max);
- if (max > MAX_TEXTURE_ALLOCATION ||
- (m_maxTextureCount >= max && m_maxTextureCount))
+ XLOG("setMaxTextureCount: %d (current: %d, total:%d)",
+ max, m_maxTextureCount, MAX_TEXTURE_ALLOCATION);
+ if (m_maxTextureCount &&
+ (max > MAX_TEXTURE_ALLOCATION ||
+ max <= m_maxTextureCount))
return;
android::Mutex::Autolock lock(m_texturesLock);
- m_maxTextureCount = max;
+
+ if (max < MAX_TEXTURE_ALLOCATION)
+ m_maxTextureCount = max;
+ else
+ m_maxTextureCount = MAX_TEXTURE_ALLOCATION;
+
allocateTiles();
}