diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-08-23 16:18:08 -0700 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2011-08-24 13:19:10 -0700 |
commit | 349594acdaf53d8b35f1d153139231c25420e8de (patch) | |
tree | 933e9c7b6618f299db132ca87937caee9acf4dd9 /Source | |
parent | 5a1bad665e3c27495e4ccb9a73996ce3a84b0a26 (diff) | |
download | external_webkit-349594acdaf53d8b35f1d153139231c25420e8de.zip external_webkit-349594acdaf53d8b35f1d153139231c25420e8de.tar.gz external_webkit-349594acdaf53d8b35f1d153139231c25420e8de.tar.bz2 |
Prevent preparing a page with an invalid size.
bug:5185840
Change-Id: I9ac0ad0fcee76be8864494fd55398edf1e68506f
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebCore/platform/graphics/android/TiledPage.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/Source/WebCore/platform/graphics/android/TiledPage.cpp b/Source/WebCore/platform/graphics/android/TiledPage.cpp index a69f9d1..600b3f1 100644 --- a/Source/WebCore/platform/graphics/android/TiledPage.cpp +++ b/Source/WebCore/platform/graphics/android/TiledPage.cpp @@ -33,12 +33,15 @@ #include "PaintTileOperation.h" #include "TilesManager.h" -#ifdef DEBUG - #include <cutils/log.h> #include <wtf/CurrentTime.h> #include <wtf/text/CString.h> +#undef XLOGC +#define XLOGC(...) android_printLog(ANDROID_LOG_DEBUG, "TiledPage", __VA_ARGS__) + +#ifdef DEBUG + #undef XLOG #define XLOG(...) android_printLog(ANDROID_LOG_DEBUG, "TiledPage", __VA_ARGS__) @@ -248,7 +251,6 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBound TilesManager::instance()->gatherTextures(); // update the tiles distance from the viewport updateTileState(tileBounds); - m_prepare = true; m_scrollingDown = goingDown; int firstTileX = tileBounds.fLeft; @@ -279,8 +281,15 @@ void TiledPage::prepare(bool goingDown, bool goingLeft, const SkIRect& tileBound m_expandedTileBounds.fRight = lastTileX; m_expandedTileBounds.fBottom = lastTileY; + if (nbTilesHeight * nbTilesWidth > TilesManager::getMaxTextureAllocation() + 1) { + XLOGC("ERROR: We don't have enough tiles for this page!" + " nbTilesHeight %d nbTilesWidth %d", nbTilesHeight, nbTilesWidth); + return; + } for (int i = 0; i < nbTilesHeight; i++) prepareRow(goingLeft, nbTilesWidth, firstTileX, firstTileY + i, tileBounds); + + m_prepare = true; } bool TiledPage::ready(const SkIRect& tileBounds, float scale) |