OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.BreakpointsSidebarPaneBase} | 7 * @extends {WebInspector.BreakpointsSidebarPaneBase} |
8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
9 */ | 9 */ |
10 WebInspector.AsyncOperationsSidebarPane = function() | 10 WebInspector.AsyncOperationsSidebarPane = function() |
11 { | 11 { |
12 WebInspector.BreakpointsSidebarPaneBase.call(this, WebInspector.UIString("As
ync Operation Breakpoints")); | 12 WebInspector.BreakpointsSidebarPaneBase.call(this, WebInspector.UIString("As
ync Operation Breakpoints")); |
13 this.bodyElement.classList.add("async-operations"); | 13 this.element.classList.add("async-operations"); |
14 this._updateEmptyElement(); | 14 this._updateEmptyElement(); |
15 | 15 |
16 var refreshButton = this.titleElement.createChild("button", "pane-title-butt
on refresh"); | 16 var refreshButton = new WebInspector.ToolbarButton(WebInspector.UIString("Re
fresh"), "refresh-toolbar-item"); |
17 refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this
), false); | 17 refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this
)); |
18 refreshButton.title = WebInspector.UIString("Refresh"); | 18 this.toolbar().appendToolbarItem(refreshButton); |
19 | 19 |
20 /** @type {!Map.<!WebInspector.Target, !Map.<number, !DebuggerAgent.AsyncOpe
ration>>} */ | 20 /** @type {!Map.<!WebInspector.Target, !Map.<number, !DebuggerAgent.AsyncOpe
ration>>} */ |
21 this._asyncOperationsByTarget = new Map(); | 21 this._asyncOperationsByTarget = new Map(); |
22 /** @type {!Map.<number, !Element>} */ | 22 /** @type {!Map.<number, !Element>} */ |
23 this._operationIdToElement = new Map(); | 23 this._operationIdToElement = new Map(); |
24 | 24 |
25 this._revealBlackboxedCallFrames = false; | 25 this._revealBlackboxedCallFrames = false; |
26 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa
ultFormatter(30)); | 26 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa
ultFormatter(30)); |
27 | 27 |
28 this._popoverHelper = new WebInspector.PopoverHelper(this.bodyElement, this.
_getPopoverAnchor.bind(this), this._showPopover.bind(this)); | 28 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._get
PopoverAnchor.bind(this), this._showPopover.bind(this)); |
29 this._popoverHelper.setTimeout(250, 250); | 29 this._popoverHelper.setTimeout(250, 250); |
30 this.bodyElement.addEventListener("click", this._hidePopover.bind(this), tru
e); | 30 this.element.addEventListener("click", this._hidePopover.bind(this), true); |
31 | 31 |
32 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.AsyncOperationStarted, this._onAsyncOperationStart
ed, this); | 32 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.AsyncOperationStarted, this._onAsyncOperationStart
ed, this); |
33 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.AsyncOperationCompleted, this._onAsyncOperationCom
pleted, this); | 33 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.AsyncOperationCompleted, this._onAsyncOperationCom
pleted, this); |
34 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); | 34 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.DebuggerResumed, this._debuggerResumed, this); |
35 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); | 35 WebInspector.targetManager.addModelListener(WebInspector.DebuggerModel, WebI
nspector.DebuggerModel.Events.GlobalObjectCleared, this._debuggerReset, this); |
36 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._targ
etChanged, this); | 36 WebInspector.context.addFlavorChangeListener(WebInspector.Target, this._targ
etChanged, this); |
37 | 37 |
38 WebInspector.moduleSetting("skipStackFramesPattern").addChangeListener(this.
_refresh, this); | 38 WebInspector.moduleSetting("skipStackFramesPattern").addChangeListener(this.
_refresh, this); |
39 WebInspector.moduleSetting("enableAsyncStackTraces").addChangeListener(this.
_asyncStackTracesStateChanged, this); | 39 WebInspector.moduleSetting("enableAsyncStackTraces").addChangeListener(this.
_asyncStackTracesStateChanged, this); |
40 | 40 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 */ | 197 */ |
198 _debuggerReset: function(event) | 198 _debuggerReset: function(event) |
199 { | 199 { |
200 var target = /** @type {!WebInspector.Target} */ (event.target.target())
; | 200 var target = /** @type {!WebInspector.Target} */ (event.target.target())
; |
201 this._asyncOperationsByTarget.delete(target); | 201 this._asyncOperationsByTarget.delete(target); |
202 if (this._target === target) | 202 if (this._target === target) |
203 this._clear(); | 203 this._clear(); |
204 }, | 204 }, |
205 | 205 |
206 /** | 206 /** |
207 * @param {!Event} event | 207 * @param {!WebInspector.Event} event |
208 */ | 208 */ |
209 _refreshButtonClicked: function(event) | 209 _refreshButtonClicked: function(event) |
210 { | 210 { |
211 event.consume(); | 211 event.consume(); |
212 this.expand(); | 212 this.expand(); |
213 var debuggerModel = WebInspector.DebuggerModel.fromTarget(this._target); | 213 var debuggerModel = WebInspector.DebuggerModel.fromTarget(this._target); |
214 if (debuggerModel) | 214 if (debuggerModel) |
215 debuggerModel.flushAsyncOperationEvents(); | 215 debuggerModel.flushAsyncOperationEvents(); |
216 }, | 216 }, |
217 | 217 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 /** | 275 /** |
276 * @param {!DebuggerAgent.AsyncOperation} operation | 276 * @param {!DebuggerAgent.AsyncOperation} operation |
277 */ | 277 */ |
278 _createAsyncOperationItem: function(operation) | 278 _createAsyncOperationItem: function(operation) |
279 { | 279 { |
280 var element = createElementWithClass("li", "async-operation"); | 280 var element = createElementWithClass("li", "async-operation"); |
281 | 281 |
282 var title = operation.description || WebInspector.UIString("Async Operat
ion"); | 282 var title = operation.description || WebInspector.UIString("Async Operat
ion"); |
283 var label = createCheckboxLabel(title, operation[this._checkedSymbol]); | 283 var label = createCheckboxLabel(title, operation[this._checkedSymbol]); |
284 label.classList.add("checkbox-elem"); | |
285 label.checkboxElement.addEventListener("click", this._checkboxClicked.bi
nd(this, operation.id), false); | 284 label.checkboxElement.addEventListener("click", this._checkboxClicked.bi
nd(this, operation.id), false); |
286 element.appendChild(label); | 285 element.appendChild(label); |
287 var debuggerModel = WebInspector.DebuggerModel.fromTarget(this._target); | 286 var debuggerModel = WebInspector.DebuggerModel.fromTarget(this._target); |
288 var callFrame = WebInspector.DebuggerPresentationUtils.callFrameAnchorFr
omStackTrace(debuggerModel, operation.stackTrace, operation.asyncStackTrace, thi
s._revealBlackboxedCallFrames); | 287 var callFrame = WebInspector.DebuggerPresentationUtils.callFrameAnchorFr
omStackTrace(debuggerModel, operation.stackTrace, operation.asyncStackTrace, thi
s._revealBlackboxedCallFrames); |
289 if (callFrame) | 288 if (callFrame) |
290 element.createChild("div").appendChild(this._linkifier.linkifyConsol
eCallFrame(this._target, callFrame)); | 289 element.createChild("div").appendChild(this._linkifier.linkifyConsol
eCallFrame(this._target, callFrame)); |
291 | 290 |
292 element[this._operationIdSymbol] = operation.id; | 291 element[this._operationIdSymbol] = operation.id; |
293 this._operationIdToElement.set(operation.id, element); | 292 this._operationIdToElement.set(operation.id, element); |
294 this.addListElement(element, this.listElement.firstChild); | 293 this.addListElement(element, this.listElement.firstChild); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 return null; | 372 return null; |
374 var operationId = anchor[this._operationIdSymbol]; | 373 var operationId = anchor[this._operationIdSymbol]; |
375 var operation = operationId && asyncOperations.get(operationId); | 374 var operation = operationId && asyncOperations.get(operationId); |
376 if (!operation || !operation.stackTrace) | 375 if (!operation || !operation.stackTrace) |
377 return null; | 376 return null; |
378 return operation; | 377 return operation; |
379 }, | 378 }, |
380 | 379 |
381 __proto__: WebInspector.BreakpointsSidebarPaneBase.prototype | 380 __proto__: WebInspector.BreakpointsSidebarPaneBase.prototype |
382 } | 381 } |
OLD | NEW |