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

Unified Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineLayersView.js

Issue 2434393002: Timeline: promisify paint profiler and Layers panel, part I (Closed)
Patch Set: review comments addressed Created 4 years, 2 months 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
Index: third_party/WebKit/Source/devtools/front_end/timeline/TimelineLayersView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLayersView.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLayersView.js
index bb2cc649d5c82cb4c8dacc92f21d47550f7ebf46..82a210930b080c72d6b0ccc83c11cbc0a5c1e9ca 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLayersView.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineLayersView.js
@@ -74,47 +74,24 @@ WebInspector.TimelineLayersView.prototype = {
_update: function()
{
var layerTree;
-
var originalTiles = this._paintTiles;
- var tilesReadyBarrier = new CallbackBarrier();
- this._frameLayerTree.resolve(tilesReadyBarrier.createCallback(onLayersReady));
- this._frameLayerTree.paints().forEach(paint => paint.loadSnapshot(tilesReadyBarrier.createCallback(onSnapshotLoaded.bind(this, paint))));
- tilesReadyBarrier.callWhenDone(onLayersAndTilesReady.bind(this));
-
- /**
- * @param {!WebInspector.LayerTreeBase} resolvedLayerTree
- */
- function onLayersReady(resolvedLayerTree)
- {
- layerTree = resolvedLayerTree;
- }
-
- /**
- * @param {!WebInspector.LayerPaintEvent} paintEvent
- * @param {?Array.<number>} rect
- * @param {?WebInspector.PaintProfilerSnapshot} snapshot
- * @this {WebInspector.TimelineLayersView}
- */
- function onSnapshotLoaded(paintEvent, rect, snapshot)
- {
- if (!rect || !snapshot)
+ var snapshotPromises = this._frameLayerTree.paints().map(paint => paint.snapshotPromise().then(snapshotWithRect => {
+ if (!snapshotWithRect)
return;
// We're too late and there's a new generation of tiles being loaded.
if (originalTiles !== this._paintTiles) {
- snapshot.dispose();
+ snapshotWithRect.snapshot.dispose();
return;
}
- this._paintTiles.push({layerId: paintEvent.layerId(), rect: rect, snapshot: snapshot, traceEvent: paintEvent.event()});
- }
-
- /**
- * @this {WebInspector.TimelineLayersView}
- */
- function onLayersAndTilesReady()
- {
+ this._paintTiles.push({layerId: paint.layerId(), rect: snapshotWithRect.rect, snapshot: snapshotWithRect.snapshot, traceEvent: paint.event()});
+ }));
+ snapshotPromises.push(this._frameLayerTree.layerTreePromise().then(resolvedTree => layerTree = resolvedTree));
+ Promise.all(snapshotPromises).then(() => {
+ if (!layerTree)
+ return;
this._layerViewHost.setLayerTree(layerTree);
this._layers3DView.setTiles(this._paintTiles);
- }
+ });
},
_disposeTiles: function()

Powered by Google App Engine
This is Rietveld 408576698