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 * @constructor | 8 * @constructor |
9 * @extends {WebInspector.FilteredListWidget.Delegate} | 9 * @extends {WebInspector.FilteredListWidget.Delegate} |
10 * @param {!WebInspector.UISourceCode} uiSourceCode | 10 * @param {!WebInspector.UISourceCode} uiSourceCode |
11 * @param {function(number, number)} selectItemCallback | 11 * @param {function(number, number)} selectItemCallback |
12 */ | 12 */ |
13 WebInspector.JavaScriptOutlineDialog = function(uiSourceCode, selectItemCallback
) | 13 WebInspector.JavaScriptOutlineDialog = function(uiSourceCode, selectItemCallback
) |
14 { | 14 { |
15 WebInspector.FilteredListWidget.Delegate.call(this, []); | 15 WebInspector.FilteredListWidget.Delegate.call(this, []); |
16 | 16 |
17 this._functionItems = []; | 17 this._functionItems = []; |
18 this._selectItemCallback = selectItemCallback; | 18 this._selectItemCallback = selectItemCallback; |
19 WebInspector.formatterWorkerPool.runChunkedTask("javaScriptOutline", {conten
t: uiSourceCode.workingCopy() }, this._didBuildOutlineChunk.bind(this)); | 19 WebInspector.formatterWorkerPool.runChunkedTask("javaScriptOutline", {conten
t: uiSourceCode.workingCopy() }, this._didBuildOutlineChunk.bind(this)); |
20 } | 20 }; |
21 | 21 |
22 /** | 22 /** |
23 * @param {!WebInspector.UISourceCode} uiSourceCode | 23 * @param {!WebInspector.UISourceCode} uiSourceCode |
24 * @param {function(number, number)} selectItemCallback | 24 * @param {function(number, number)} selectItemCallback |
25 */ | 25 */ |
26 WebInspector.JavaScriptOutlineDialog.show = function(uiSourceCode, selectItemCal
lback) | 26 WebInspector.JavaScriptOutlineDialog.show = function(uiSourceCode, selectItemCal
lback) |
27 { | 27 { |
28 WebInspector.JavaScriptOutlineDialog._instanceForTests = new WebInspector.Ja
vaScriptOutlineDialog(uiSourceCode, selectItemCallback); | 28 WebInspector.JavaScriptOutlineDialog._instanceForTests = new WebInspector.Ja
vaScriptOutlineDialog(uiSourceCode, selectItemCallback); |
29 new WebInspector.FilteredListWidget(WebInspector.JavaScriptOutlineDialog._in
stanceForTests).showAsDialog(); | 29 new WebInspector.FilteredListWidget(WebInspector.JavaScriptOutlineDialog._in
stanceForTests).showAsDialog(); |
30 } | 30 }; |
31 | 31 |
32 WebInspector.JavaScriptOutlineDialog.prototype = { | 32 WebInspector.JavaScriptOutlineDialog.prototype = { |
33 /** | 33 /** |
34 * @param {?MessageEvent} event | 34 * @param {?MessageEvent} event |
35 */ | 35 */ |
36 _didBuildOutlineChunk: function(event) | 36 _didBuildOutlineChunk: function(event) |
37 { | 37 { |
38 if (!event) { | 38 if (!event) { |
39 this.dispose(); | 39 this.dispose(); |
40 this.refresh(); | 40 this.refresh(); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 var lineNumber = this._functionItems[itemIndex].line; | 113 var lineNumber = this._functionItems[itemIndex].line; |
114 if (!isNaN(lineNumber) && lineNumber >= 0) | 114 if (!isNaN(lineNumber) && lineNumber >= 0) |
115 this._selectItemCallback(lineNumber, this._functionItems[itemIndex].
column); | 115 this._selectItemCallback(lineNumber, this._functionItems[itemIndex].
column); |
116 }, | 116 }, |
117 | 117 |
118 dispose: function() | 118 dispose: function() |
119 { | 119 { |
120 }, | 120 }, |
121 | 121 |
122 __proto__: WebInspector.FilteredListWidget.Delegate.prototype | 122 __proto__: WebInspector.FilteredListWidget.Delegate.prototype |
123 } | 123 }; |
124 | 124 |
125 /** | 125 /** |
126 * @typedef {{isLastChunk: boolean, chunk: !Array.<!{selectorText: string, lineN
umber: number, columnNumber: number}>}} | 126 * @typedef {{isLastChunk: boolean, chunk: !Array.<!{selectorText: string, lineN
umber: number, columnNumber: number}>}} |
127 */ | 127 */ |
128 WebInspector.JavaScriptOutlineDialog.MessageEventData; | 128 WebInspector.JavaScriptOutlineDialog.MessageEventData; |
OLD | NEW |