Changeset 112178 in webkit
- Timestamp:
- Mar 26, 2012 5:09:12 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r112177 r112178 1 2012-03-26 Fady Samuel <fsamuel@chromium.org> 2 3 [Chromium] Using WebViewPlugins with --force-compositing-mode causes an ASSERT to fail 4 https://bugs.webkit.org/show_bug.cgi?id=81954 5 6 Reviewed by James Robinson. 7 8 A static variable s_inPaintContents is set when painting, and it ensures 9 that we don't delete GraphicsLayers or create GraphicsLayers while painting. 10 11 However, because this variable is static, it does not permit the existence 12 of multiple WebViews in different stages (one laying out and one painting). 13 14 This manifests itself if one attempts to use the --force-compositing-mode 15 in Chromium and attempts to navigate to a page with a missing or old plugin 16 or a browser plugin (which uses a WebViewPlugin as a placeholder until it's 17 done loading). 18 19 The solution to simplify debugging is to make this flag per-Page. 20 We can access Page from RenderLayerBacking which is a GraphicsLayerClient. 21 We add a new method GraphicsLayerClient::verifyNotPainting with a default 22 (do nothing) implementation and override it in RenderLayerBacking to 23 test the flag set in Page. 24 25 * page/Page.cpp: 26 (WebCore::Page::Page): 27 * page/Page.h: 28 (Page): 29 (WebCore::Page::setIsPainting): 30 (WebCore::Page::isPainting): 31 * platform/graphics/GraphicsLayer.cpp: 32 (WebCore::GraphicsLayer::GraphicsLayer): 33 (WebCore::GraphicsLayer::~GraphicsLayer): 34 (WebCore::GraphicsLayer::paintGraphicsLayerContents): 35 * platform/graphics/GraphicsLayerClient.h: 36 (GraphicsLayerClient): 37 (WebCore::GraphicsLayerClient::verifyNotPainting): 38 * rendering/RenderLayerBacking.cpp: 39 (WebCore::RenderLayerBacking::paintContents): 40 (WebCore): 41 (WebCore::RenderLayerBacking::verifyNotPainting): 42 * rendering/RenderLayerBacking.h: 43 (RenderLayerBacking): 44 1 45 2012-03-23 Ryosuke Niwa <rniwa@webkit.org> 2 46 -
trunk/Source/WebCore/page/Page.cpp
r111593 r112178 161 161 , m_displayID(0) 162 162 , m_isCountingRelevantRepaintedObjects(false) 163 #ifndef NDEBUG 164 , m_isPainting(false) 165 #endif 163 166 { 164 167 if (!allPages) { -
trunk/Source/WebCore/page/Page.h
r111593 r112178 332 332 void suspendActiveDOMObjectsAndAnimations(); 333 333 void resumeActiveDOMObjectsAndAnimations(); 334 334 #ifndef NDEBUG 335 void setIsPainting(bool painting) { m_isPainting = painting; } 336 bool isPainting() const { return m_isPainting; } 337 #endif 335 338 private: 336 339 void initGroup(); … … 432 435 Region m_relevantUnpaintedRegion; 433 436 bool m_isCountingRelevantRepaintedObjects; 437 #ifndef NDEBUG 438 bool m_isPainting; 439 #endif 434 440 }; 435 441 -
trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp
r107461 r112178 64 64 } 65 65 66 #ifndef NDEBUG67 static bool s_inPaintContents = false;68 #endif69 70 66 GraphicsLayer::GraphicsLayer(GraphicsLayerClient* client) 71 67 : m_client(client) … … 92 88 , m_repaintCount(0) 93 89 { 94 ASSERT(!s_inPaintContents); 90 #ifndef NDEBUG 91 if (m_client) 92 m_client->verifyNotPainting(); 93 #endif 95 94 } 96 95 97 96 GraphicsLayer::~GraphicsLayer() 98 97 { 99 ASSERT(!s_inPaintContents); 98 #ifndef NDEBUG 99 if (m_client) 100 m_client->verifyNotPainting(); 101 #endif 100 102 removeAllChildren(); 101 103 removeFromParent(); … … 289 291 void GraphicsLayer::paintGraphicsLayerContents(GraphicsContext& context, const IntRect& clip) 290 292 { 291 #ifndef NDEBUG292 s_inPaintContents = true;293 #endif294 293 if (m_client) { 295 294 LayoutSize offset = offsetFromRenderer(); … … 301 300 m_client->paintContents(this, context, m_paintingPhase, pixelSnappedIntRect(clipRect)); 302 301 } 303 #ifndef NDEBUG304 s_inPaintContents = false;305 #endif306 302 } 307 303 -
trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h
r107422 r112178 75 75 virtual bool showDebugBorders(const GraphicsLayer*) const = 0; 76 76 virtual bool showRepaintCounter(const GraphicsLayer*) const = 0; 77 78 #ifndef NDEBUG 79 // RenderLayerBacking overrides this to verify that it is not 80 // currently painting contents. An ASSERT fails, if it is. 81 // This is executed in GraphicsLayer construction and destruction 82 // to verify that we don't create or destroy GraphicsLayers 83 // while painting. 84 virtual void verifyNotPainting() { } 85 #endif 77 86 }; 78 87 -
trunk/Source/WebCore/rendering/RenderLayerBacking.cpp
r111908 r112178 1161 1161 void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase paintingPhase, const IntRect& clip) 1162 1162 { 1163 #ifndef NDEBUG 1164 if (Page* page = renderer()->frame()->page()) 1165 page->setIsPainting(true); 1166 #endif 1163 1167 if (graphicsLayer == m_graphicsLayer.get() || graphicsLayer == m_foregroundLayer.get() || graphicsLayer == m_maskLayer.get()) { 1164 1168 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willPaint(m_owningLayer->renderer()->frame(), &context, clip); … … 1186 1190 context.restore(); 1187 1191 } 1192 #ifndef NDEBUG 1193 if (Page* page = renderer()->frame()->page()) 1194 page->setIsPainting(false); 1195 #endif 1188 1196 } 1189 1197 … … 1212 1220 return compositor() ? compositor()->compositorShowRepaintCounter() : false; 1213 1221 } 1222 1223 #ifndef NDEBUG 1224 void RenderLayerBacking::verifyNotPainting() 1225 { 1226 ASSERT(!renderer()->frame()->page() || !renderer()->frame()->page()->isPainting()); 1227 } 1228 #endif 1214 1229 1215 1230 bool RenderLayerBacking::startAnimation(double timeOffset, const Animation* anim, const KeyframeList& keyframes) -
trunk/Source/WebCore/rendering/RenderLayerBacking.h
r110601 r112178 137 137 virtual bool showRepaintCounter(const GraphicsLayer*) const; 138 138 139 #ifndef NDEBUG 140 virtual void verifyNotPainting(); 141 #endif 142 139 143 IntRect contentsBox() const; 140 144
Note: See TracChangeset
for help on using the changeset viewer.