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

Unified Diff: third_party/WebKit/Source/devtools/front_end/sources/JavaScriptOutlineDialog.js

Issue 2570263002: DevTools: introduce API for the Common.FormatterWorkerPool. (Closed)
Patch Set: rebaseline Created 4 years 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/JavaScriptOutlineDialog.js
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptOutlineDialog.js b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptOutlineDialog.js
index 7f6eb8b0592963b137baf458762cd2d39650aa41..204f34f0787d3e225bb9f1c5be4176f96aa75eb8 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptOutlineDialog.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/JavaScriptOutlineDialog.js
@@ -17,8 +17,7 @@ Sources.JavaScriptOutlineDialog = class extends UI.FilteredListWidget.Delegate {
this._functionItems = [];
this._selectItemCallback = selectItemCallback;
- Common.formatterWorkerPool.runChunkedTask(
- 'javaScriptOutline', {content: uiSourceCode.workingCopy()}, this._didBuildOutlineChunk.bind(this));
+ Common.formatterWorkerPool.javaScriptOutline(uiSourceCode.workingCopy(), this._didBuildOutlineChunk.bind(this));
}
/**
@@ -32,22 +31,11 @@ Sources.JavaScriptOutlineDialog = class extends UI.FilteredListWidget.Delegate {
}
/**
- * @param {?MessageEvent} event
+ * @param {boolean} isLastChunk
+ * @param {!Array<!Common.FormatterWorkerPool.JSOutlineItem>} items
*/
- _didBuildOutlineChunk(event) {
- if (!event) {
- this.dispose();
- this.refresh();
- return;
- }
- var data = /** @type {!Sources.JavaScriptOutlineDialog.MessageEventData} */ (event.data);
- var chunk = data.chunk;
- for (var i = 0; i < chunk.length; ++i)
- this._functionItems.push(chunk[i]);
-
- if (data.isLastChunk)
- this.dispose();
-
+ _didBuildOutlineChunk(isLastChunk, items) {
+ this._functionItems = this._functionItems.concat(items);
dgozman 2016/12/14 19:33:00 @lushnikov: tell me to use spread operator.
lushnikov 2016/12/14 23:36:56 Done.
this.refresh();
}
@@ -109,16 +97,4 @@ Sources.JavaScriptOutlineDialog = class extends UI.FilteredListWidget.Delegate {
if (!isNaN(lineNumber) && lineNumber >= 0)
this._selectItemCallback(lineNumber, this._functionItems[itemIndex].column);
}
-
- /**
- * @override
- */
- dispose() {
- }
};
-
-
-/**
- * @typedef {{isLastChunk: boolean, chunk: !Array.<!{selectorText: string, lineNumber: number, columnNumber: number}>}}
- */
-Sources.JavaScriptOutlineDialog.MessageEventData;

Powered by Google App Engine
This is Rietveld 408576698