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

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

Issue 2450663004: DevTools: do not allow using 'this' before call into super. (Closed)
Patch Set: rebaselined Created 4 years, 1 month 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 // 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.VBox} 7 * @extends {WebInspector.VBox}
8 * @param {!WebInspector.TimelineModel} model
9 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters
10 */ 8 */
11 WebInspector.TimelineTreeView = function(model, filters) 9 WebInspector.TimelineTreeView = function()
12 { 10 {
13 WebInspector.VBox.call(this); 11 WebInspector.VBox.call(this);
14 this.element.classList.add("timeline-tree-view"); 12 this.element.classList.add("timeline-tree-view");
15
16 this._model = model;
17 this._linkifier = new WebInspector.Linkifier();
18
19 this._filters = filters.slice();
20
21 var columns = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor>} */ ([]);
22 this._populateColumns(columns);
23
24 var mainView = new WebInspector.VBox();
25 this._populateToolbar(mainView.element);
26 this._dataGrid = new WebInspector.SortableDataGrid(columns);
27 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChanged, this._sortingChanged, this);
28 this._dataGrid.element.addEventListener("mousemove", this._onMouseMove.bind( this), true);
29 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last);
30 this._dataGrid.asWidget().show(mainView.element);
31
32 this._splitWidget = new WebInspector.SplitWidget(true, true, "timelineTreeVi ewDetailsSplitWidget");
33 this._splitWidget.show(this.element);
34 this._splitWidget.setMainWidget(mainView);
35
36 this._detailsView = new WebInspector.VBox();
37 this._detailsView.element.classList.add("timeline-details-view", "timeline-d etails-view-body");
38 this._splitWidget.setSidebarWidget(this._detailsView);
39 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, t his._updateDetailsForSelection, this);
40
41 /** @type {?WebInspector.TimelineProfileTree.Node|undefined} */
42 this._lastSelectedNode;
43 }; 13 };
44 14
45 WebInspector.TimelineTreeView.prototype = { 15 WebInspector.TimelineTreeView.prototype = {
46 /** 16 /**
17 * @param {!WebInspector.TimelineModel} model
18 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters
19 */
20 _init: function(model, filters)
21 {
22 this._model = model;
23 this._linkifier = new WebInspector.Linkifier();
24
25 this._filters = filters.slice();
26
27 var columns = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor> } */ ([]);
28 this._populateColumns(columns);
29
30 var mainView = new WebInspector.VBox();
31 this._populateToolbar(mainView.element);
32 this._dataGrid = new WebInspector.SortableDataGrid(columns);
33 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SortingChan ged, this._sortingChanged, this);
34 this._dataGrid.element.addEventListener("mousemove", this._onMouseMove.b ind(this), true);
35 this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last);
36 this._dataGrid.asWidget().show(mainView.element);
37
38 this._splitWidget = new WebInspector.SplitWidget(true, true, "timelineTr eeViewDetailsSplitWidget");
39 this._splitWidget.show(this.element);
40 this._splitWidget.setMainWidget(mainView);
41
42 this._detailsView = new WebInspector.VBox();
43 this._detailsView.element.classList.add("timeline-details-view", "timeli ne-details-view-body");
44 this._splitWidget.setSidebarWidget(this._detailsView);
45 this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNod e, this._updateDetailsForSelection, this);
46
47 /** @type {?WebInspector.TimelineProfileTree.Node|undefined} */
48 this._lastSelectedNode;
49 },
50
51 /**
47 * @param {!WebInspector.TimelineSelection} selection 52 * @param {!WebInspector.TimelineSelection} selection
48 */ 53 */
49 updateContents: function(selection) 54 updateContents: function(selection)
50 { 55 {
51 this.setRange(selection.startTime(), selection.endTime()); 56 this.setRange(selection.startTime(), selection.endTime());
52 }, 57 },
53 58
54 /** 59 /**
55 * @param {number} startTime 60 * @param {number} startTime
56 * @param {number} endTime 61 * @param {number} endTime
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 * @constructor 302 * @constructor
298 * @extends {WebInspector.SortableDataGridNode} 303 * @extends {WebInspector.SortableDataGridNode}
299 * @param {!WebInspector.TimelineProfileTree.Node} profileNode 304 * @param {!WebInspector.TimelineProfileTree.Node} profileNode
300 * @param {number} grandTotalTime 305 * @param {number} grandTotalTime
301 * @param {number} maxSelfTime 306 * @param {number} maxSelfTime
302 * @param {number} maxTotalTime 307 * @param {number} maxTotalTime
303 * @param {!WebInspector.TimelineTreeView} treeView 308 * @param {!WebInspector.TimelineTreeView} treeView
304 */ 309 */
305 WebInspector.TimelineTreeView.GridNode = function(profileNode, grandTotalTime, m axSelfTime, maxTotalTime, treeView) 310 WebInspector.TimelineTreeView.GridNode = function(profileNode, grandTotalTime, m axSelfTime, maxTotalTime, treeView)
306 { 311 {
312 WebInspector.SortableDataGridNode.call(this, null, false);
313
307 this._populated = false; 314 this._populated = false;
308 this._profileNode = profileNode; 315 this._profileNode = profileNode;
309 this._treeView = treeView; 316 this._treeView = treeView;
310 this._grandTotalTime = grandTotalTime; 317 this._grandTotalTime = grandTotalTime;
311 this._maxSelfTime = maxSelfTime; 318 this._maxSelfTime = maxSelfTime;
312 this._maxTotalTime = maxTotalTime; 319 this._maxTotalTime = maxTotalTime;
313 WebInspector.SortableDataGridNode.call(this, null, false);
314 }; 320 };
315 321
316 WebInspector.TimelineTreeView.GridNode.prototype = { 322 WebInspector.TimelineTreeView.GridNode.prototype = {
317 /** 323 /**
318 * @override 324 * @override
319 * @param {string} columnId 325 * @param {string} columnId
320 * @return {!Element} 326 * @return {!Element}
321 */ 327 */
322 createCell: function(columnId) 328 createCell: function(columnId)
323 { 329 {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 450
445 451
446 /** 452 /**
447 * @constructor 453 * @constructor
448 * @extends {WebInspector.TimelineTreeView} 454 * @extends {WebInspector.TimelineTreeView}
449 * @param {!WebInspector.TimelineModel} model 455 * @param {!WebInspector.TimelineModel} model
450 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters 456 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters
451 */ 457 */
452 WebInspector.AggregatedTimelineTreeView = function(model, filters) 458 WebInspector.AggregatedTimelineTreeView = function(model, filters)
453 { 459 {
460 WebInspector.TimelineTreeView.call(this);
454 this._groupBySetting = WebInspector.settings.createSetting("timelineTreeGrou pBy", WebInspector.TimelineAggregator.GroupBy.Category); 461 this._groupBySetting = WebInspector.settings.createSetting("timelineTreeGrou pBy", WebInspector.TimelineAggregator.GroupBy.Category);
455 WebInspector.TimelineTreeView.call(this, model, filters); 462 this._init(model, filters);
456 var nonessentialEvents = [ 463 var nonessentialEvents = [
457 WebInspector.TimelineModel.RecordType.EventDispatch, 464 WebInspector.TimelineModel.RecordType.EventDispatch,
458 WebInspector.TimelineModel.RecordType.FunctionCall, 465 WebInspector.TimelineModel.RecordType.FunctionCall,
459 WebInspector.TimelineModel.RecordType.TimerFire 466 WebInspector.TimelineModel.RecordType.TimerFire
460 ]; 467 ];
461 this._filters.push(new WebInspector.ExclusiveNameFilter(nonessentialEvents)) ; 468 this._filters.push(new WebInspector.ExclusiveNameFilter(nonessentialEvents)) ;
462 this._stackView = new WebInspector.TimelineStackView(this); 469 this._stackView = new WebInspector.TimelineStackView(this);
463 this._stackView.addEventListener(WebInspector.TimelineStackView.Events.Selec tionChanged, this._onStackViewSelectionChanged, this); 470 this._stackView.addEventListener(WebInspector.TimelineStackView.Events.Selec tionChanged, this._onStackViewSelectionChanged, this);
464 }; 471 };
465 472
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 692
686 /** 693 /**
687 * @constructor 694 * @constructor
688 * @extends {WebInspector.TimelineTreeView} 695 * @extends {WebInspector.TimelineTreeView}
689 * @param {!WebInspector.TimelineModel} model 696 * @param {!WebInspector.TimelineModel} model
690 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters 697 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters
691 * @param {!WebInspector.TimelineModeViewDelegate} delegate 698 * @param {!WebInspector.TimelineModeViewDelegate} delegate
692 */ 699 */
693 WebInspector.EventsTimelineTreeView = function(model, filters, delegate) 700 WebInspector.EventsTimelineTreeView = function(model, filters, delegate)
694 { 701 {
702 WebInspector.TimelineTreeView.call(this);
695 this._filtersControl = new WebInspector.TimelineFilters(); 703 this._filtersControl = new WebInspector.TimelineFilters();
696 this._filtersControl.addEventListener(WebInspector.TimelineFilters.Events.Fi lterChanged, this._onFilterChanged, this); 704 this._filtersControl.addEventListener(WebInspector.TimelineFilters.Events.Fi lterChanged, this._onFilterChanged, this);
697 WebInspector.TimelineTreeView.call(this, model, filters); 705 this._init(model, filters);
698 this._delegate = delegate; 706 this._delegate = delegate;
699 this._filters.push.apply(this._filters, this._filtersControl.filters()); 707 this._filters.push.apply(this._filters, this._filtersControl.filters());
700 this._dataGrid.markColumnAsSortedBy("startTime", WebInspector.DataGrid.Order .Ascending); 708 this._dataGrid.markColumnAsSortedBy("startTime", WebInspector.DataGrid.Order .Ascending);
701 }; 709 };
702 710
703 WebInspector.EventsTimelineTreeView.prototype = { 711 WebInspector.EventsTimelineTreeView.prototype = {
704 /** 712 /**
705 * @override 713 * @override
706 * @param {!WebInspector.TimelineSelection} selection 714 * @param {!WebInspector.TimelineSelection} selection
707 */ 715 */
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 return selectedNode && /** @type {!WebInspector.TimelineTreeView.GridNod e} */ (selectedNode)._profileNode; 887 return selectedNode && /** @type {!WebInspector.TimelineTreeView.GridNod e} */ (selectedNode)._profileNode;
880 }, 888 },
881 889
882 _onSelectionChanged: function() 890 _onSelectionChanged: function()
883 { 891 {
884 this.dispatchEventToListeners(WebInspector.TimelineStackView.Events.Sele ctionChanged); 892 this.dispatchEventToListeners(WebInspector.TimelineStackView.Events.Sele ctionChanged);
885 }, 893 },
886 894
887 __proto__: WebInspector.VBox.prototype 895 __proto__: WebInspector.VBox.prototype
888 }; 896 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698