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

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: rebaseline 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..0e9bc8e498025641f88549c910b9836a21c90053 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,26 @@ 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));
+ var promises = [];
+ if (this._baseRevision) {
+ promises = [
+ this._baseRevision.requestContent(),
+ this._revision.requestContent()
pfeldman 2016/01/20 19:23:51 merge this below via push, use ternary operator fo
lushnikov 2016/01/20 23:35:58 Done.
+ ]
+ } else {
+ promises = [
+ this._revision.uiSourceCode.requestOriginalContent(),
+ this._revision.requestContent()
+ ]
}
+ Promise.all(promises).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