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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/CallStackSidebarPane.js

Issue 2916743002: [DevTools] Introduce Common.List used as a backend for list controls (Closed)
Patch Set: addressed comments Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 21 matching lines...) Expand all
32 constructor() { 32 constructor() {
33 super(Common.UIString('Call Stack'), true); 33 super(Common.UIString('Call Stack'), true);
34 this.registerRequiredCSS('sources/callStackSidebarPane.css'); 34 this.registerRequiredCSS('sources/callStackSidebarPane.css');
35 35
36 this._blackboxedMessageElement = this._createBlackboxedMessageElement(); 36 this._blackboxedMessageElement = this._createBlackboxedMessageElement();
37 this.contentElement.appendChild(this._blackboxedMessageElement); 37 this.contentElement.appendChild(this._blackboxedMessageElement);
38 38
39 this._notPausedMessageElement = this.contentElement.createChild('div', 'gray -info-message'); 39 this._notPausedMessageElement = this.contentElement.createChild('div', 'gray -info-message');
40 this._notPausedMessageElement.textContent = Common.UIString('Not Paused'); 40 this._notPausedMessageElement.textContent = Common.UIString('Not Paused');
41 41
42 /** @type {!UI.ListModel<!Sources.CallStackSidebarPane.Item>} */
43 this._items = new UI.ListModel();
42 /** @type {!UI.ListControl<!Sources.CallStackSidebarPane.Item>} */ 44 /** @type {!UI.ListControl<!Sources.CallStackSidebarPane.Item>} */
43 this._list = new UI.ListControl(this, UI.ListMode.NonViewport); 45 this._list = new UI.ListControl(this._items, this, UI.ListMode.NonViewport);
44 this.contentElement.appendChild(this._list.element); 46 this.contentElement.appendChild(this._list.element);
45 this._list.element.addEventListener('contextmenu', this._onContextMenu.bind( this), false); 47 this._list.element.addEventListener('contextmenu', this._onContextMenu.bind( this), false);
46 this._list.element.addEventListener('click', this._onClick.bind(this), false ); 48 this._list.element.addEventListener('click', this._onClick.bind(this), false );
47 49
48 this._showBlackboxed = false; 50 this._showBlackboxed = false;
49 Bindings.blackboxManager.addChangeListener(this._update.bind(this)); 51 Bindings.blackboxManager.addChangeListener(this._update.bind(this));
50 this._locationPool = new Bindings.LiveLocationPool(); 52 this._locationPool = new Bindings.LiveLocationPool();
51 53
52 this._update(); 54 this._update();
53 } 55 }
54 56
55 /** 57 /**
56 * @override 58 * @override
57 * @param {?Object} object 59 * @param {?Object} object
58 */ 60 */
59 flavorChanged(object) { 61 flavorChanged(object) {
60 this._showBlackboxed = false; 62 this._showBlackboxed = false;
61 this._update(); 63 this._update();
62 } 64 }
63 65
64 _update() { 66 _update() {
65 this._locationPool.disposeAll(); 67 this._locationPool.disposeAll();
66 68
67 var details = UI.context.flavor(SDK.DebuggerPausedDetails); 69 var details = UI.context.flavor(SDK.DebuggerPausedDetails);
68 if (!details) { 70 if (!details) {
69 this._notPausedMessageElement.classList.remove('hidden'); 71 this._notPausedMessageElement.classList.remove('hidden');
70 this._blackboxedMessageElement.classList.add('hidden'); 72 this._blackboxedMessageElement.classList.add('hidden');
71 this._list.replaceAllItems([]); 73 this._items.replaceAllItems([]);
72 this._debuggerModel = null; 74 this._debuggerModel = null;
73 UI.context.setFlavor(SDK.DebuggerModel.CallFrame, null); 75 UI.context.setFlavor(SDK.DebuggerModel.CallFrame, null);
74 return; 76 return;
75 } 77 }
76 78
77 this._debuggerModel = details.debuggerModel; 79 this._debuggerModel = details.debuggerModel;
78 this._notPausedMessageElement.classList.add('hidden'); 80 this._notPausedMessageElement.classList.add('hidden');
79 81
80 var showBlackboxed = this._showBlackboxed || 82 var showBlackboxed = this._showBlackboxed ||
81 details.callFrames.every(frame => Bindings.blackboxManager.isBlackboxedR awLocation(frame.location())); 83 details.callFrames.every(frame => Bindings.blackboxManager.isBlackboxedR awLocation(frame.location()));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 if (hiddenCallFramesCount === 1) { 134 if (hiddenCallFramesCount === 1) {
133 this._blackboxedMessageElement.firstChild.textContent = 135 this._blackboxedMessageElement.firstChild.textContent =
134 Common.UIString('1 stack frame is hidden (black-boxed).'); 136 Common.UIString('1 stack frame is hidden (black-boxed).');
135 } else { 137 } else {
136 this._blackboxedMessageElement.firstChild.textContent = 138 this._blackboxedMessageElement.firstChild.textContent =
137 Common.UIString('%d stack frames are hidden (black-boxed).', hiddenC allFramesCount); 139 Common.UIString('%d stack frames are hidden (black-boxed).', hiddenC allFramesCount);
138 } 140 }
139 this._blackboxedMessageElement.classList.remove('hidden'); 141 this._blackboxedMessageElement.classList.remove('hidden');
140 } 142 }
141 143
142 this._list.replaceAllItems(items); 144 this._items.replaceAllItems(items);
143 this._list.selectNextItem(true /* canWrap */, false /* center */); 145 this._list.selectNextItem(true /* canWrap */, false /* center */);
144 } 146 }
145 147
146 /** 148 /**
147 * @override 149 * @override
148 * @param {!Sources.CallStackSidebarPane.Item} item 150 * @param {!Sources.CallStackSidebarPane.Item} item
149 * @return {!Element} 151 * @return {!Element}
150 */ 152 */
151 createElementForItem(item) { 153 createElementForItem(item) {
152 var element = createElementWithClass('div', 'call-frame-item'); 154 var element = createElementWithClass('div', 'call-frame-item');
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 352
351 /** 353 /**
352 * @return {boolean} 354 * @return {boolean}
353 */ 355 */
354 _selectPreviousCallFrameOnStack() { 356 _selectPreviousCallFrameOnStack() {
355 return this._list.selectPreviousItem(false /* canWrap */, false /* center */ ); 357 return this._list.selectPreviousItem(false /* canWrap */, false /* center */ );
356 } 358 }
357 359
358 _copyStackTrace() { 360 _copyStackTrace() {
359 var text = []; 361 var text = [];
360 for (var i = 0; i < this._list.length(); i++) { 362 for (var i = 0; i < this._items.length(); i++) {
361 var item = this._list.itemAtIndex(i); 363 var item = this._items.itemAtIndex(i);
362 if (item.promiseCreationFrame) 364 if (item.promiseCreationFrame)
363 continue; 365 continue;
364 var itemText = this._itemTitle(item); 366 var itemText = this._itemTitle(item);
365 var location = this._itemLocation(item); 367 var location = this._itemLocation(item);
366 if (location) { 368 if (location) {
367 var uiLocation = Bindings.debuggerWorkspaceBinding.rawLocationToUILocati on(location); 369 var uiLocation = Bindings.debuggerWorkspaceBinding.rawLocationToUILocati on(location);
368 itemText += ' (' + uiLocation.linkText(true /* skipTrim */) + ')'; 370 itemText += ' (' + uiLocation.linkText(true /* skipTrim */) + ')';
369 } 371 }
370 text.push(itemText); 372 text.push(itemText);
371 } 373 }
(...skipping 13 matching lines...) Expand all
385 387
386 /** 388 /**
387 * @typedef {{ 389 * @typedef {{
388 * debuggerCallFrame: (SDK.DebuggerModel.CallFrame|undefined), 390 * debuggerCallFrame: (SDK.DebuggerModel.CallFrame|undefined),
389 * asyncStackHeader: (string|undefined), 391 * asyncStackHeader: (string|undefined),
390 * runtimeCallFrame: (Protocol.Runtime.CallFrame|undefined), 392 * runtimeCallFrame: (Protocol.Runtime.CallFrame|undefined),
391 * promiseCreationFrame: (Protocol.Runtime.CallFrame|undefined) 393 * promiseCreationFrame: (Protocol.Runtime.CallFrame|undefined)
392 * }} 394 * }}
393 */ 395 */
394 Sources.CallStackSidebarPane.Item; 396 Sources.CallStackSidebarPane.Item;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698