summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShimeng (Simon) Wang <swang@google.com>2011-02-15 14:30:49 -0800
committerShimeng (Simon) Wang <swang@google.com>2011-02-18 17:07:40 -0800
commit704eaca6f77288587c438291bc15a967515eaa8e (patch)
treee273c8eebcd8014f3f3e3c81485313774167e68e
parenta046a139c49a1c3e9e85101aeca4b68b89c396ca (diff)
downloadexternal_webkit-704eaca6f77288587c438291bc15a967515eaa8e.zip
external_webkit-704eaca6f77288587c438291bc15a967515eaa8e.tar.gz
external_webkit-704eaca6f77288587c438291bc15a967515eaa8e.tar.bz2
Set correct max texture allocations.
This fixes core dump or dead lock in GL code when rotating screen. Change-Id: Ia7bfa71125f1d24158084b6192d805b5b08b60f8
-rw-r--r--WebCore/platform/graphics/android/TiledPage.cpp4
-rw-r--r--WebCore/platform/graphics/android/TilesManager.cpp10
-rw-r--r--WebCore/platform/graphics/android/TilesManager.h1
3 files changed, 10 insertions, 5 deletions
diff --git a/WebCore/platform/graphics/android/TiledPage.cpp b/WebCore/platform/graphics/android/TiledPage.cpp
index 620aa6f..36988dd 100644
--- a/WebCore/platform/graphics/android/TiledPage.cpp
+++ b/WebCore/platform/graphics/android/TiledPage.cpp
@@ -49,8 +49,6 @@
#endif // DEBUG
-#define MAX_TILES 256
-
namespace WebCore {
using namespace android;
@@ -65,7 +63,7 @@ TiledPage::TiledPage(int id, GLWebViewState* state)
, m_latestPictureInval(0)
, m_prepare(false)
{
- m_baseTiles = new BaseTile[MAX_TILES];
+ m_baseTiles = new BaseTile[TilesManager::getMaxTextureAllocation() + 1];
#ifdef DEBUG_COUNT
ClassTracker::instance()->increment("TiledPage");
#endif
diff --git a/WebCore/platform/graphics/android/TilesManager.cpp b/WebCore/platform/graphics/android/TilesManager.cpp
index 571d9cc..0fb3b1b 100644
--- a/WebCore/platform/graphics/android/TilesManager.cpp
+++ b/WebCore/platform/graphics/android/TilesManager.cpp
@@ -58,7 +58,7 @@
// at least 5 * 3 = 15 textures. We can also enable offscreen textures
#define EXPANDED_TILE_BOUNDS_X 1
#define EXPANDED_TILE_BOUNDS_Y 4
-#define MAX_TEXTURE_ALLOCATION (5+EXPANDED_TILE_BOUNDS_X*2)*(3+EXPANDED_TILE_BOUNDS_Y*2)*2
+#define MAX_TEXTURE_ALLOCATION (5+1+EXPANDED_TILE_BOUNDS_X*2)*(3+1+EXPANDED_TILE_BOUNDS_Y*2)*2
#define TILE_WIDTH 300
#define TILE_HEIGHT 300
@@ -78,6 +78,11 @@ GLint TilesManager::getMaxTextureSize()
return maxTextureSize;
}
+int TilesManager::getMaxTextureAllocation()
+{
+ return MAX_TEXTURE_ALLOCATION;
+}
+
TilesManager::TilesManager()
: m_layersMemoryUsage(0)
, m_maxTextureCount(0)
@@ -369,7 +374,8 @@ int TilesManager::maxTextureCount()
void TilesManager::setMaxTextureCount(int max)
{
XLOG("setMaxTextureCount: %d", max);
- if (m_maxTextureCount >= max && m_maxTextureCount)
+ if (max > MAX_TEXTURE_ALLOCATION ||
+ (m_maxTextureCount >= max && m_maxTextureCount))
return;
android::Mutex::Autolock lock(m_texturesLock);
diff --git a/WebCore/platform/graphics/android/TilesManager.h b/WebCore/platform/graphics/android/TilesManager.h
index eeb38fe..29b7fc1 100644
--- a/WebCore/platform/graphics/android/TilesManager.h
+++ b/WebCore/platform/graphics/android/TilesManager.h
@@ -45,6 +45,7 @@ class TilesManager {
public:
static TilesManager* instance();
static GLint getMaxTextureSize();
+ static int getMaxTextureAllocation();
static bool hardwareAccelerationEnabled()
{