Skip to content

Instantly share code, notes, and snippets.

@qrwteyrutiyoup
Created October 8, 2013 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qrwteyrutiyoup/647d9ca085b2dc13d1d7 to your computer and use it in GitHub Desktop.
Save qrwteyrutiyoup/647d9ca085b2dc13d1d7 to your computer and use it in GitHub Desktop.
wi
diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp
index 407821c..f4001fe 100644
--- a/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp
+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CompositingCoordinator.cpp
@@ -90,7 +90,7 @@ void CompositingCoordinator::setRootCompositingLayer(GraphicsLayer* layer)
void CompositingCoordinator::sizeDidChange(const IntSize& newSize)
{
m_rootLayer->setSize(newSize);
- m_client->notifyFlushRequired();
+ notifyFlushRequired(nullptr);
}
bool CompositingCoordinator::flushPendingLayerChanges()
@@ -255,7 +255,8 @@ void CompositingCoordinator::notifyAnimationStarted(const GraphicsLayer*, double
void CompositingCoordinator::notifyFlushRequired(const GraphicsLayer*)
{
- m_client->notifyFlushRequired();
+ if (!isFlushingLayerChanges())
+ m_client->notifyFlushRequired();
}
@@ -271,7 +272,7 @@ std::unique_ptr<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(Graph
m_registeredLayers.add(layer->id(), layer);
m_state.layersToCreate.append(layer->id());
layer->setNeedsVisibleRectAdjustment();
- m_client->notifyFlushRequired();
+ notifyFlushRequired(nullptr);
return std::unique_ptr<GraphicsLayer>(layer);
}
@@ -352,7 +353,7 @@ void CompositingCoordinator::detachLayer(CoordinatedGraphicsLayer* layer)
}
m_state.layersToRemove.append(layer->id());
- m_client->notifyFlushRequired();
+ notifyFlushRequired(nullptr);
}
void CompositingCoordinator::commitScrollOffset(uint32_t layerID, const WebCore::IntSize& offset)
diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
index 83305e0..8537013 100644
--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
@@ -48,41 +48,47 @@ static CoordinatedLayerID toCoordinatedLayerID(GraphicsLayer* layer)
return layer ? toCoordinatedGraphicsLayer(layer)->id() : 0;
}
+bool CoordinatedGraphicsLayer::notifyFlushRequired()
+{
+ ASSERT(m_coordinator);
+
+ if (client() && !m_coordinator->isFlushingLayerChanges()) {
+ client()->notifyFlushRequired(this);
+ return true;
+ }
+ return false;
+}
+
void CoordinatedGraphicsLayer::didChangeLayerState()
{
m_shouldSyncLayerState = true;
- if (client())
- client()->notifyFlushRequired(this);
+ notifyFlushRequired();
}
void CoordinatedGraphicsLayer::didChangeAnimations()
{
m_shouldSyncAnimations = true;
- if (client())
- client()->notifyFlushRequired(this);
+ notifyFlushRequired();
}
void CoordinatedGraphicsLayer::didChangeChildren()
{
m_shouldSyncChildren = true;
- if (client())
- client()->notifyFlushRequired(this);
+ notifyFlushRequired();
}
#if ENABLE(CSS_FILTERS)
void CoordinatedGraphicsLayer::didChangeFilters()
{
m_shouldSyncFilters = true;
- if (client())
- client()->notifyFlushRequired(this);
+ notifyFlushRequired();
}
#endif
void CoordinatedGraphicsLayer::didChangeImageBacking()
{
m_shouldSyncImageBacking = true;
- if (client())
- client()->notifyFlushRequired(this);
+ notifyFlushRequired();
}
void CoordinatedGraphicsLayer::setShouldUpdateVisibleRect()
@@ -382,9 +388,7 @@ void CoordinatedGraphicsLayer::setContentsNeedsDisplay()
m_pendingCanvasOperation |= SyncCanvas;
#endif
- if (client())
- client()->notifyFlushRequired(this);
-
+ notifyFlushRequired();
addRepaintRect(contentsRect());
}
@@ -411,8 +415,7 @@ void CoordinatedGraphicsLayer::setContentsToCanvas(PlatformLayer* platformLayer)
m_canvasToken = m_canvasPlatformLayer ? m_canvasPlatformLayer->graphicsSurfaceToken() : GraphicsSurfaceToken();
ASSERT(!(!m_canvasToken.isValid() && m_canvasPlatformLayer));
- if (client())
- client()->notifyFlushRequired(this);
+ notifyFlushRequired();
#else
UNUSED_PARAM(platformLayer);
#endif
@@ -588,11 +591,8 @@ void CoordinatedGraphicsLayer::setFixedToViewport(bool isFixed)
void CoordinatedGraphicsLayer::flushCompositingState(const FloatRect& rect)
{
- if (!m_coordinator->isFlushingLayerChanges()) {
- if (client())
- client()->notifyFlushRequired(this);
+ if (notifyFlushRequired())
return;
- }
if (CoordinatedGraphicsLayer* mask = toCoordinatedGraphicsLayer(maskLayer()))
mask->flushCompositingStateForThisLayerOnly();
@@ -773,6 +773,7 @@ void CoordinatedGraphicsLayer::createCanvasIfNeeded()
void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly()
{
+ ASSERT(m_coordinator);
ASSERT(m_coordinator->isFlushingLayerChanges());
// When we have a transform animation, we need to update visible rect every frame to adjust the visible rect of a backing store.
@@ -918,8 +919,7 @@ void CoordinatedGraphicsLayer::tiledBackingStorePaintEnd(const Vector<IntRect>&
void CoordinatedGraphicsLayer::tiledBackingStoreHasPendingTileCreation()
{
setNeedsVisibleRectAdjustment();
- if (client())
- client()->notifyFlushRequired(this);
+ notifyFlushRequired();
}
IntRect CoordinatedGraphicsLayer::tiledBackingStoreContentsRect()
diff --git a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h
index 6105e23..0093d1f 100644
--- a/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h
+++ b/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h
@@ -196,6 +196,8 @@ private:
void createBackingStore();
void releaseImageBackingIfNeeded();
+ bool notifyFlushRequired();
+
// CoordinatedImageBacking::Host
virtual bool imageBackingVisible() OVERRIDE;
bool shouldHaveBackingStore() const;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment