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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartView.js

Issue 2782953002: DevTools: Make EntryHighlighted an event rather than method on data provider (Closed)
Patch Set: clean up Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartNetworkDataProvider.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 * @implements {Timeline.TimelineModeView} 6 * @implements {Timeline.TimelineModeView}
7 * @implements {PerfUI.FlameChartDelegate} 7 * @implements {PerfUI.FlameChartDelegate}
8 * @implements {UI.Searchable} 8 * @implements {UI.Searchable}
9 * @unrestricted 9 * @unrestricted
10 */ 10 */
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 this._detailsView = new Timeline.TimelineDetailsView(filters, delegate); 66 this._detailsView = new Timeline.TimelineDetailsView(filters, delegate);
67 this._detailsSplitWidget.installResizer(this._detailsView.headerElement()); 67 this._detailsSplitWidget.installResizer(this._detailsView.headerElement());
68 this._detailsSplitWidget.setMainWidget(this._chartSplitWidget); 68 this._detailsSplitWidget.setMainWidget(this._chartSplitWidget);
69 this._detailsSplitWidget.setSidebarWidget(this._detailsView); 69 this._detailsSplitWidget.setSidebarWidget(this._detailsView);
70 this._detailsSplitWidget.show(this.element); 70 this._detailsSplitWidget.show(this.element);
71 71
72 this._onMainEntrySelected = this._onEntrySelected.bind(this, this._mainDataP rovider); 72 this._onMainEntrySelected = this._onEntrySelected.bind(this, this._mainDataP rovider);
73 this._onNetworkEntrySelected = this._onEntrySelected.bind(this, this._networ kDataProvider); 73 this._onNetworkEntrySelected = this._onEntrySelected.bind(this, this._networ kDataProvider);
74 this._mainFlameChart.addEventListener(PerfUI.FlameChart.Events.EntrySelected , this._onMainEntrySelected, this); 74 this._mainFlameChart.addEventListener(PerfUI.FlameChart.Events.EntrySelected , this._onMainEntrySelected, this);
75 this._networkFlameChart.addEventListener(PerfUI.FlameChart.Events.EntrySelec ted, this._onNetworkEntrySelected, this); 75 this._networkFlameChart.addEventListener(PerfUI.FlameChart.Events.EntrySelec ted, this._onNetworkEntrySelected, this);
76 this._mainFlameChart.addEventListener(PerfUI.FlameChart.Events.EntryHighligh ted, this._onEntryHighlighted, this);
76 this._nextExtensionIndex = 0; 77 this._nextExtensionIndex = 0;
77 78
78 this._boundRefresh = this._refresh.bind(this); 79 this._boundRefresh = this._refresh.bind(this);
79 } 80 }
80 81
81 /** 82 /**
82 * @override 83 * @override
83 * @return {?Element} 84 * @return {?Element}
84 */ 85 */
85 resizerElement() { 86 resizerElement() {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 _appendExtensionData() { 144 _appendExtensionData() {
144 if (!this._model) 145 if (!this._model)
145 return; 146 return;
146 var extensions = this._model.extensionInfo(); 147 var extensions = this._model.extensionInfo();
147 while (this._nextExtensionIndex < extensions.length) 148 while (this._nextExtensionIndex < extensions.length)
148 this._mainDataProvider.appendExtensionEvents(extensions[this._nextExtensio nIndex++]); 149 this._mainDataProvider.appendExtensionEvents(extensions[this._nextExtensio nIndex++]);
149 this._mainFlameChart.scheduleUpdate(); 150 this._mainFlameChart.scheduleUpdate();
150 } 151 }
151 152
152 /** 153 /**
154 * @param {!Common.Event} commonEvent
155 */
156 _onEntryHighlighted(commonEvent) {
157 SDK.DOMModel.hideDOMNodeHighlight();
158 var entryIndex = /** @type {number} */ (commonEvent.data);
159 var event = this._mainDataProvider.eventByIndex(entryIndex);
160 if (!event)
161 return;
162 var target = this._model && this._model.timelineModel().targetByEvent(event) ;
163 if (!target)
164 return;
165 var timelineData = TimelineModel.TimelineData.forEvent(event);
166 var backendNodeId = timelineData.backendNodeId;
167 if (!backendNodeId)
168 return;
169 new SDK.DeferredDOMNode(target, backendNodeId).highlight();
170 }
171
172 /**
153 * @override 173 * @override
154 * @param {?SDK.TracingModel.Event} event 174 * @param {?SDK.TracingModel.Event} event
155 */ 175 */
156 highlightEvent(event) { 176 highlightEvent(event) {
157 var entryIndex = 177 var entryIndex =
158 event ? this._mainDataProvider.entryIndexForSelection(Timeline.TimelineS election.fromTraceEvent(event)) : -1; 178 event ? this._mainDataProvider.entryIndexForSelection(Timeline.TimelineS election.fromTraceEvent(event)) : -1;
159 if (entryIndex >= 0) 179 if (entryIndex >= 0)
160 this._mainFlameChart.highlightEntry(entryIndex); 180 this._mainFlameChart.highlightEntry(entryIndex);
161 else 181 else
162 this._mainFlameChart.hideHighlight(); 182 this._mainFlameChart.hideHighlight();
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 context.translate(this._style.lineWidth < 1 || (this._style.lineWidth & 1) ? 0.5 : 0, 0.5); 524 context.translate(this._style.lineWidth < 1 || (this._style.lineWidth & 1) ? 0.5 : 0, 0.5);
505 context.beginPath(); 525 context.beginPath();
506 context.moveTo(x, height); 526 context.moveTo(x, height);
507 context.setLineDash(this._style.dashStyle); 527 context.setLineDash(this._style.dashStyle);
508 context.lineTo(x, context.canvas.height); 528 context.lineTo(x, context.canvas.height);
509 context.stroke(); 529 context.stroke();
510 } 530 }
511 context.restore(); 531 context.restore();
512 } 532 }
513 }; 533 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChartNetworkDataProvider.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698