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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/RevisionHistoryView.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/sources/RevisionHistoryView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/RevisionHistoryView.js b/third_party/WebKit/Source/devtools/front_end/sources/RevisionHistoryView.js
index 1e803c9dc2ea46af0f9ad98e35f5a525c4cf65bf..213bc20e2c4e058259ef08ccb3dc03c26a30c415 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/RevisionHistoryView.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/RevisionHistoryView.js
@@ -209,7 +209,7 @@ WebInspector.RevisionHistoryTreeElement = function(revision, baseRevision, allow
this._revertElement = createElement("span");
this._revertElement.className = "revision-history-link";
this._revertElement.textContent = WebInspector.UIString("apply revision content");
- this._revertElement.addEventListener("click", this._revision.revertToThis.bind(this._revision), false);
+ this._revertElement.addEventListener("click", event => {this._revision.revertToThis();}, false);
if (!allowRevert)
this._revertElement.classList.add("hidden");
}
@@ -225,26 +225,17 @@ WebInspector.RevisionHistoryTreeElement.prototype = {
this.listItemElement.appendChild(this._revertElement);
this.childrenListElement.classList.add("source-code");
- if (this._baseRevision)
- this._baseRevision.requestContent(step1.bind(this));
- else
- this._revision.uiSourceCode.requestOriginalContent(step1.bind(this));
-
- /**
- * @param {?string} baseContent
- * @this {WebInspector.RevisionHistoryTreeElement}
- */
- function step1(baseContent)
- {
- this._revision.requestContent(step2.bind(this, baseContent));
- }
+ Promise.all([
+ this._baseRevision ? this._baseRevision.requestContent() : this._revision.uiSourceCode.requestOriginalContent(),
+ this._revision.requestContent()
+ ]).spread(diff.bind(this));
/**
* @param {?string} baseContent
* @param {?string} newContent
* @this {WebInspector.RevisionHistoryTreeElement}
*/
- function step2(baseContent, newContent)
+ function diff(baseContent, newContent)
{
var baseLines = baseContent.split("\n");
var newLines = newContent.split("\n");

Powered by Google App Engine
This is Rietveld 408576698