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

Unified Diff: third_party/WebKit/Source/devtools/front_end/resources/FileContentView.js

Issue 1609973002: DevTools: promisify ContentProvider.requestContent and all its clients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 11 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/resources/FileContentView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/resources/FileContentView.js b/third_party/WebKit/Source/devtools/front_end/resources/FileContentView.js
index 1429a16bd63cdff63566a3e287ecd7a7fc68a5fb..ad90386662bcd43cf8dfd09435a199d2cf499bff 100644
--- a/third_party/WebKit/Source/devtools/front_end/resources/FileContentView.js
+++ b/third_party/WebKit/Source/devtools/front_end/resources/FileContentView.js
@@ -69,7 +69,7 @@ WebInspector.FileContentView.prototype = {
if (!this._content.updateMetadata(metadata))
return;
var sourceFrame = /** @type {!WebInspector.SourceFrame} */ (this._innerView);
- this._content.requestContent(sourceFrame.setContent.bind(sourceFrame));
+ this._content.requestContent().then(sourceFrame.setContent.bind(sourceFrame));
} else {
this._innerView.detach();
this._content = new WebInspector.FileContentView.FileContentProvider(this._file, metadata);
@@ -125,12 +125,15 @@ WebInspector.FileContentView.FileContentProvider.prototype = {
/**
* @override
- * @param {function(?string)} callback
+ * @return {!Promise<?string>}
*/
- requestContent: function(callback)
+ requestContent: function()
{
+ var callback;
+ var promise = new Promise(fulfill => callback = fulfill);
var size = /** @type {number} */ (this._metadata.size);
this._file.requestFileContent(true, 0, size, this._charset || "", this._fileContentReceived.bind(this, callback));
+ return promise;
},
/**

Powered by Google App Engine
This is Rietveld 408576698