summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2012-05-18 17:02:33 -0700
committerChris Craik <ccraik@google.com>2012-05-18 17:02:33 -0700
commit48605bf1f6bc77a1f037f23285baf7706f45d198 (patch)
tree0118a279c6af10fed342b9816c35f761a117bc46 /Source
parentd423988553ea721896b4ac1d3720ed04332ebbb3 (diff)
downloadexternal_webkit-48605bf1f6bc77a1f037f23285baf7706f45d198.zip
external_webkit-48605bf1f6bc77a1f037f23285baf7706f45d198.tar.gz
external_webkit-48605bf1f6bc77a1f037f23285baf7706f45d198.tar.bz2
Remove paint tile operations for stale painters
bug:6516612 also adds ClassTracker to several classes Change-Id: I9a503084240d4935fba300a3256d266a2982dcc0
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp15
-rw-r--r--Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h1
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/PaintTileOperation.cpp7
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp7
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp8
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h3
-rw-r--r--Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp7
7 files changed, 46 insertions, 2 deletions
diff --git a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp
index 3241a61..a0a1b58 100644
--- a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.cpp
@@ -31,6 +31,7 @@
#include "AndroidLog.h"
#include "CachedImage.h"
+#include "ClassTracker.h"
#include "DrawQuadData.h"
#include "FixedPositioning.h"
#include "GLWebViewState.h"
@@ -117,6 +118,10 @@ FixedBackgroundImageLayerAndroid::FixedBackgroundImageLayerAndroid(PassRefPtr<Re
setFixedPosition(position);
position->setPosition(left, top);
+
+#ifdef DEBUG_COUNT
+ ClassTracker::instance()->increment("FixedBackgroundImageLayerAndroid");
+#endif
}
FixedBackgroundImageLayerAndroid::FixedBackgroundImageLayerAndroid(const FixedBackgroundImageLayerAndroid& layer)
@@ -124,6 +129,16 @@ FixedBackgroundImageLayerAndroid::FixedBackgroundImageLayerAndroid(const FixedBa
, m_width(layer.m_width)
, m_height(layer.m_height)
{
+#ifdef DEBUG_COUNT
+ ClassTracker::instance()->increment("FixedBackgroundImageLayerAndroid");
+#endif
+}
+
+FixedBackgroundImageLayerAndroid::~FixedBackgroundImageLayerAndroid()
+{
+#ifdef DEBUG_COUNT
+ ClassTracker::instance()->decrement("FixedBackgroundImageLayerAndroid");
+#endif
}
static bool needToDisplayImage(bool repeatX, bool repeatY, float dx, float dy)
diff --git a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h
index 9ce8a07..55b4b21 100644
--- a/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/layers/BaseLayerAndroid.h
@@ -65,6 +65,7 @@ class FixedBackgroundImageLayerAndroid : public LayerAndroid {
public:
FixedBackgroundImageLayerAndroid(PassRefPtr<RenderStyle> style, int w, int h);
FixedBackgroundImageLayerAndroid(const FixedBackgroundImageLayerAndroid& layer);
+ virtual ~FixedBackgroundImageLayerAndroid();
virtual LayerAndroid* copy() const { return new FixedBackgroundImageLayerAndroid(*this); }
virtual bool needsTexture() { return true; }
virtual SubclassType subclassType() const { return LayerAndroid::FixedBackgroundImageLayer; }
diff --git a/Source/WebCore/platform/graphics/android/rendering/PaintTileOperation.cpp b/Source/WebCore/platform/graphics/android/rendering/PaintTileOperation.cpp
index 87096b0..3fcbdb2 100644
--- a/Source/WebCore/platform/graphics/android/rendering/PaintTileOperation.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/PaintTileOperation.cpp
@@ -30,6 +30,7 @@
#include "PaintTileOperation.h"
#include "AndroidLog.h"
+#include "ClassTracker.h"
#include "GLWebViewState.h"
#include "ImageTexture.h"
#include "ImagesManager.h"
@@ -49,6 +50,9 @@ PaintTileOperation::PaintTileOperation(Tile* tile, TilePainter* painter,
if (m_tile)
m_tile->setRepaintPending(true);
SkSafeRef(m_painter);
+#ifdef DEBUG_COUNT
+ ClassTracker::instance()->increment("PaintTileOperation");
+#endif
}
PaintTileOperation::~PaintTileOperation()
@@ -64,6 +68,9 @@ PaintTileOperation::~PaintTileOperation()
} else {
SkSafeUnref(m_painter);
}
+#ifdef DEBUG_COUNT
+ ClassTracker::instance()->decrement("PaintTileOperation");
+#endif
}
bool PaintTileOperation::operator==(const QueuedOperation* operation)
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp
index 78a9861..fcd9655 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceBacking.cpp
@@ -31,6 +31,7 @@
#include "AndroidLog.h"
#include "Color.h"
+#include "ClassTracker.h"
#include "GLWebViewState.h"
#include "LayerAndroid.h"
@@ -46,6 +47,9 @@ SurfaceBacking::SurfaceBacking(bool isBaseSurface)
m_scale = -1;
m_futureScale = -1;
m_zooming = false;
+#ifdef DEBUG_COUNT
+ ClassTracker::instance()->increment("SurfaceBacking");
+#endif
}
SurfaceBacking::~SurfaceBacking()
@@ -53,6 +57,9 @@ SurfaceBacking::~SurfaceBacking()
delete m_frontTileGrid;
delete m_backTileGrid;
delete m_lowResTileGrid;
+#ifdef DEBUG_COUNT
+ ClassTracker::instance()->decrement("SurfaceBacking");
+#endif
}
void SurfaceBacking::prepareGL(GLWebViewState* state, bool allowZoom,
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp
index 0e5c3ba..f577d46 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.cpp
@@ -33,7 +33,7 @@
#include "BaseLayerAndroid.h"
#include "ClassTracker.h"
#include "GLWebViewState.h"
-#include "BaseLayerAndroid.h"
+#include "PaintTileOperation.h"
#include "Surface.h"
#include "ScrollableLayerAndroid.h"
#include "TilesManager.h"
@@ -175,6 +175,12 @@ bool SurfaceCollection::isMissingBackgroundContent()
return m_surfaces[0]->isMissingContent();
}
+void SurfaceCollection::removePainterOperations()
+{
+ for (unsigned int i = 0; i < m_surfaces.size(); i++)
+ TilesManager::instance()->removeOperationsForFilter(new TilePainterFilter(m_surfaces[i]));
+}
+
void SurfaceCollection::computeTexturesAmount(TexturesResult* result)
{
for (unsigned int i = 0; i < m_surfaces.size(); i++)
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h
index 7088bec..ff4195f 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollection.h
@@ -47,7 +47,7 @@ public:
SurfaceCollection(BaseLayerAndroid* compositedRoot);
virtual ~SurfaceCollection();
- // Tiled painting methods (executed on groups)
+ // Tiled painting methods (executed on Surfaces)
void prepareGL(const SkRect& visibleContentRect, bool tryToFastBlit = false);
bool drawGL(const SkRect& visibleContentRect);
Color getBackgroundColor();
@@ -56,6 +56,7 @@ public:
bool isReady();
bool isBaseSurfaceReady();
bool isMissingBackgroundContent();
+ void removePainterOperations();
void computeTexturesAmount(TexturesResult* result);
// Recursive tree methods (animations, invals, etc)
diff --git a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
index 5abca02..724bf89 100644
--- a/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
+++ b/Source/WebCore/platform/graphics/android/rendering/SurfaceCollectionManager.cpp
@@ -69,6 +69,7 @@ void SurfaceCollectionManager::swap()
if (m_drawingCollection) {
ALOGV("destroying drawing collection %p", m_drawingCollection);
m_drawingCollection->addFrameworkInvals();
+ m_drawingCollection->removePainterOperations();
SkSafeUnref(m_drawingCollection);
}
@@ -93,6 +94,12 @@ void SurfaceCollectionManager::swap()
// clear all of the content in the three collections held by the collection manager
void SurfaceCollectionManager::clearCollections()
{
+ // remove all painting operations, since they're no longer relevant
+ if (m_drawingCollection)
+ m_drawingCollection->removePainterOperations();
+ if (m_paintingCollection)
+ m_paintingCollection->removePainterOperations();
+
SkSafeUnref(m_drawingCollection);
m_drawingCollection = 0;
SkSafeUnref(m_paintingCollection);