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

Unified Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelinePaintProfilerView.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/TimelinePaintProfilerView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js
index 5265b1e69840df39af23e49966608210a55293fa..c9c8ff2f73f64a584a5618aa24888ea4a2abd9a8 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelinePaintProfilerView.js
@@ -66,38 +66,28 @@ WebInspector.TimelinePaintProfilerView.prototype = {
this._logTreeView.setCommandLog(null, []);
this._paintProfilerView.setSnapshotAndLog(null, [], null);
- if (this._event.name === WebInspector.TimelineModel.RecordType.Paint)
- this._event.picture.requestObject(onDataAvailable.bind(this));
- else if (this._event.name === WebInspector.TimelineModel.RecordType.RasterTask)
- this._frameModel.requestRasterTile(this._event, onSnapshotLoaded.bind(this))
- else
+ var snapshotPromise;
+ if (this._event.name === WebInspector.TimelineModel.RecordType.Paint) {
+ snapshotPromise = this._event.picture.objectPromise()
+ .then(data => WebInspector.PaintProfilerSnapshot.load(this._target, data["skp64"]))
+ .then(snapshot => snapshot && {rect: null, snapshot: snapshot});
+ } else if (this._event.name === WebInspector.TimelineModel.RecordType.RasterTask) {
+ snapshotPromise = this._frameModel.rasterTilePromise(this._event);
+ } else {
console.assert(false, "Unexpected event type: " + this._event.name);
-
- /**
- * @param {!Object} data
- * @this WebInspector.TimelinePaintProfilerView
- */
- function onDataAvailable(data)
- {
- if (data)
- WebInspector.PaintProfilerSnapshot.load(this._target, data["skp64"], onSnapshotLoaded.bind(this, null));
+ return;
}
- /**
- * @param {?DOMAgent.Rect} tileRect
- * @param {?WebInspector.PaintProfilerSnapshot} snapshot
- * @this WebInspector.TimelinePaintProfilerView
- */
- function onSnapshotLoaded(tileRect, snapshot)
- {
+ snapshotPromise.then(snapshotWithRect => {
this._disposeSnapshot();
- this._lastLoadedSnapshot = snapshot;
- this._imageView.setMask(tileRect);
- if (!snapshot) {
+ if (!snapshotWithRect) {
this._imageView.showImage();
return;
}
- snapshot.commandLog(onCommandLogDone.bind(this, snapshot, tileRect));
- }
+ var snapshot = snapshotWithRect.snapshot;
+ this._lastLoadedSnapshot = snapshot;
+ this._imageView.setMask(snapshotWithRect.rect);
+ snapshot.commandLog(onCommandLogDone.bind(this, snapshot, snapshotWithRect.rect));
+ });
/**
* @param {!WebInspector.PaintProfilerSnapshot} snapshot

Powered by Google App Engine
This is Rietveld 408576698