OSDN Git Service

Don't create newer LayerTexture when hitting upper bound.
authorTeng-Hui Zhu <ztenghui@google.com>
Wed, 29 Jun 2011 23:48:13 +0000 (16:48 -0700)
committerTeng-Hui Zhu <ztenghui@google.com>
Thu, 30 Jun 2011 16:54:29 +0000 (09:54 -0700)
bug:4976882
Change-Id: If1c913da8bdc3a310a3a665dc895711093fb8788

Source/WebCore/platform/graphics/android/TilesManager.cpp

index b4df0a1..2259072 100644 (file)
@@ -355,6 +355,10 @@ LayerTexture* TilesManager::createTextureForLayer(LayerAndroid* layer, const Int
     if (m_layersMemoryUsage + size > MAX_LAYERS_ALLOCATION)
         cleanupLayersTextures(layer, true);
 
+    // If the cleanup can't achieve the goal, then don't create a layerTexture.
+    if (m_layersMemoryUsage + size > MAX_LAYERS_ALLOCATION)
+        return 0;
+
     LayerTexture* texture = new LayerTexture(w, h);
     texture->setId(layer->uniqueId());
     texture->setRect(rect);