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

Unified Diff: Source/devtools/front_end/elements/MetricsSidebarPane.js

Issue 1204393002: DevTools: [CSS] promisify CSSStyleModel fetching methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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: Source/devtools/front_end/elements/MetricsSidebarPane.js
diff --git a/Source/devtools/front_end/elements/MetricsSidebarPane.js b/Source/devtools/front_end/elements/MetricsSidebarPane.js
index f934756dd8659254a17d8c16586f08afa71f2cc7..6996392c216b5f20f54338604060640612922931 100644
--- a/Source/devtools/front_end/elements/MetricsSidebarPane.js
+++ b/Source/devtools/front_end/elements/MetricsSidebarPane.js
@@ -69,8 +69,6 @@ WebInspector.MetricsSidebarPane.prototype = {
return;
this._updateMetrics(style);
}
- cssModel.getComputedStyleAsync(node.id, callback.bind(this));
-
/**
* @param {?WebInspector.CSSStyleModel.InlineStyleResult} inlineStyleResult
* @this {WebInspector.MetricsSidebarPane}
@@ -79,9 +77,15 @@ WebInspector.MetricsSidebarPane.prototype = {
{
if (inlineStyleResult && this.node() === node)
this.inlineStyle = inlineStyleResult.inlineStyle;
- finishedCallback();
}
- cssModel.getInlineStylesAsync(node.id, inlineStyleCallback.bind(this));
+
+ var promises = [
+ cssModel.computedStylePromise(node.id).then(callback.bind(this)),
+ cssModel.inlineStylesPromise(node.id).then(inlineStyleCallback.bind(this))
+ ];
+ Promise.all(promises)
+ .then(finishedCallback.bind(null, undefined))
+ .catch(/** @type {function()} */(finishedCallback));
},
/**

Powered by Google App Engine
This is Rietveld 408576698