| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 * Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * @unrestricted | 8 * @unrestricted |
| 9 */ | 9 */ |
| 10 WebInspector.JavaScriptOutlineDialog = class extends WebInspector.FilteredListWi
dget.Delegate { | 10 Sources.JavaScriptOutlineDialog = class extends UI.FilteredListWidget.Delegate { |
| 11 /** | 11 /** |
| 12 * @param {!WebInspector.UISourceCode} uiSourceCode | 12 * @param {!Workspace.UISourceCode} uiSourceCode |
| 13 * @param {function(number, number)} selectItemCallback | 13 * @param {function(number, number)} selectItemCallback |
| 14 */ | 14 */ |
| 15 constructor(uiSourceCode, selectItemCallback) { | 15 constructor(uiSourceCode, selectItemCallback) { |
| 16 super([]); | 16 super([]); |
| 17 | 17 |
| 18 this._functionItems = []; | 18 this._functionItems = []; |
| 19 this._selectItemCallback = selectItemCallback; | 19 this._selectItemCallback = selectItemCallback; |
| 20 WebInspector.formatterWorkerPool.runChunkedTask( | 20 Common.formatterWorkerPool.runChunkedTask( |
| 21 'javaScriptOutline', {content: uiSourceCode.workingCopy()}, this._didBui
ldOutlineChunk.bind(this)); | 21 'javaScriptOutline', {content: uiSourceCode.workingCopy()}, this._didBui
ldOutlineChunk.bind(this)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * @param {!WebInspector.UISourceCode} uiSourceCode | 25 * @param {!Workspace.UISourceCode} uiSourceCode |
| 26 * @param {function(number, number)} selectItemCallback | 26 * @param {function(number, number)} selectItemCallback |
| 27 */ | 27 */ |
| 28 static show(uiSourceCode, selectItemCallback) { | 28 static show(uiSourceCode, selectItemCallback) { |
| 29 WebInspector.JavaScriptOutlineDialog._instanceForTests = | 29 Sources.JavaScriptOutlineDialog._instanceForTests = |
| 30 new WebInspector.JavaScriptOutlineDialog(uiSourceCode, selectItemCallbac
k); | 30 new Sources.JavaScriptOutlineDialog(uiSourceCode, selectItemCallback); |
| 31 new WebInspector.FilteredListWidget(WebInspector.JavaScriptOutlineDialog._in
stanceForTests).showAsDialog(); | 31 new UI.FilteredListWidget(Sources.JavaScriptOutlineDialog._instanceForTests)
.showAsDialog(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * @param {?MessageEvent} event | 35 * @param {?MessageEvent} event |
| 36 */ | 36 */ |
| 37 _didBuildOutlineChunk(event) { | 37 _didBuildOutlineChunk(event) { |
| 38 if (!event) { | 38 if (!event) { |
| 39 this.dispose(); | 39 this.dispose(); |
| 40 this.refresh(); | 40 this.refresh(); |
| 41 return; | 41 return; |
| 42 } | 42 } |
| 43 var data = /** @type {!WebInspector.JavaScriptOutlineDialog.MessageEventData
} */ (event.data); | 43 var data = /** @type {!Sources.JavaScriptOutlineDialog.MessageEventData} */
(event.data); |
| 44 var chunk = data.chunk; | 44 var chunk = data.chunk; |
| 45 for (var i = 0; i < chunk.length; ++i) | 45 for (var i = 0; i < chunk.length; ++i) |
| 46 this._functionItems.push(chunk[i]); | 46 this._functionItems.push(chunk[i]); |
| 47 | 47 |
| 48 if (data.isLastChunk) | 48 if (data.isLastChunk) |
| 49 this.dispose(); | 49 this.dispose(); |
| 50 | 50 |
| 51 this.refresh(); | 51 this.refresh(); |
| 52 } | 52 } |
| 53 | 53 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 * @override | 114 * @override |
| 115 */ | 115 */ |
| 116 dispose() { | 116 dispose() { |
| 117 } | 117 } |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 | 120 |
| 121 /** | 121 /** |
| 122 * @typedef {{isLastChunk: boolean, chunk: !Array.<!{selectorText: string, lineN
umber: number, columnNumber: number}>}} | 122 * @typedef {{isLastChunk: boolean, chunk: !Array.<!{selectorText: string, lineN
umber: number, columnNumber: number}>}} |
| 123 */ | 123 */ |
| 124 WebInspector.JavaScriptOutlineDialog.MessageEventData; | 124 Sources.JavaScriptOutlineDialog.MessageEventData; |
| OLD | NEW |