Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: Source/core/inspector/InspectorLayerTreeAgent.cpp

Issue 46163008: Revert "Re-land deferred compositing updates with fixed assumptions" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InspectorLayerTreeAgent.h ('k') | Source/core/page/Page.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/inspector/InspectorLayerTreeAgent.cpp
diff --git a/Source/core/inspector/InspectorLayerTreeAgent.cpp b/Source/core/inspector/InspectorLayerTreeAgent.cpp
index 5f4df0d79a3582e0b3aacde1c19de3125c906436..2983869aaaf24099e0283a8bad25e912560c7a16 100644
--- a/Source/core/inspector/InspectorLayerTreeAgent.cpp
+++ b/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -108,6 +108,8 @@ InspectorLayerTreeAgent::InspectorLayerTreeAgent(InstrumentingAgents* instrument
, m_frontend(0)
, m_page(page)
, m_domAgent(domAgent)
+ , m_notificationTimer(this, &InspectorLayerTreeAgent::notificationTimerFired)
+ , m_notifyAfterNextLayersUpdate(false)
{
}
@@ -142,10 +144,30 @@ void InspectorLayerTreeAgent::enable(ErrorString*)
void InspectorLayerTreeAgent::disable(ErrorString*)
{
m_instrumentingAgents->setInspectorLayerTreeAgent(0);
+ m_notificationTimer.stop();
}
void InspectorLayerTreeAgent::layerTreeDidChange()
{
+ if (m_notificationTimer.isActive())
+ return;
+ if (m_notifyAfterNextLayersUpdate) {
+ m_notifyAfterNextLayersUpdate = false;
+ m_frontend->layerTreeDidChange(buildLayerTree());
+ return;
+ }
+ const double layerTreeUpdateDelayInSeconds = 0.1;
+ m_notificationTimer.startOneShot(layerTreeUpdateDelayInSeconds);
+}
+
+void InspectorLayerTreeAgent::notificationTimerFired(Timer<InspectorLayerTreeAgent>*)
+{
+ RenderLayerCompositor* compositor = renderLayerCompositor();
+ if (compositor && compositor->compositingLayersNeedRebuild()) {
+ // Bad time for building layer tree -- let's do it as soon as it gets rebuild.
+ m_notifyAfterNextLayersUpdate = true;
+ return;
+ }
m_frontend->layerTreeDidChange(buildLayerTree());
}
@@ -170,6 +192,8 @@ PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTre
RenderLayerCompositor* compositor = renderLayerCompositor();
if (!compositor || !compositor->inCompositingMode())
return 0;
+ // Caller is responsible for only calling this when layer tree is up to date (preferrably just in the end of RenderLayerCompositor::updateCompositingLayers()
+ ASSERT(!compositor->compositingLayersNeedRebuild());
LayerIdToNodeIdMap layerIdToNodeIdMap;
RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > layers = TypeBuilder::Array<TypeBuilder::LayerTree::Layer>::create();
buildLayerIdToNodeIdMap(compositor->rootRenderLayer(), layerIdToNodeIdMap);
« no previous file with comments | « Source/core/inspector/InspectorLayerTreeAgent.h ('k') | Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698