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

Side by Side Diff: Source/devtools/front_end/TimelineView.js

Issue 136363003: TimelinePanel: rename _sidebarView to _recordsView (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 this._detailsSplitView.mainElement().classList.add("vbox"); 86 this._detailsSplitView.mainElement().classList.add("vbox");
87 this._detailsSplitView.setMainElementConstraints(undefined, 40); 87 this._detailsSplitView.setMainElementConstraints(undefined, 40);
88 this._detailsView = new WebInspector.TimelineDetailsView(); 88 this._detailsView = new WebInspector.TimelineDetailsView();
89 this._detailsSplitView.setSidebarView(this._detailsView); 89 this._detailsSplitView.setSidebarView(this._detailsView);
90 this._detailsSplitView.installResizer(this._detailsView.titleElement()); 90 this._detailsSplitView.installResizer(this._detailsView.titleElement());
91 91
92 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._dockSideChanged.bind(this)); 92 WebInspector.dockController.addEventListener(WebInspector.DockController.Eve nts.DockSideChanged, this._dockSideChanged.bind(this));
93 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi s._dockSideChanged.bind(this)); 93 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi s._dockSideChanged.bind(this));
94 this._dockSideChanged(); 94 this._dockSideChanged();
95 95
96 // Create memory splitter as a left child of properties.
97 this._searchableView = new WebInspector.SearchableView(this); 96 this._searchableView = new WebInspector.SearchableView(this);
98 this._detailsSplitView.setMainView(this._searchableView); 97 this._detailsSplitView.setMainView(this._searchableView);
99 98
100 this._timelineMemorySplitter = new WebInspector.SplitView(false, "timeline-m emory");
101 this._timelineMemorySplitter.element.classList.remove("fill");
102 this._timelineMemorySplitter.element.classList.add("timeline-memory-split");
103 this._timelineMemorySplitter.show(this._searchableView.element);
104
105 // Create records sidebar as a top memory splitter child. 99 // Create records sidebar as a top memory splitter child.
106 this._sidebarView = new WebInspector.SidebarView(WebInspector.SidebarView.Si debarPosition.Start, "timeline-split"); 100 this._recordsView = new WebInspector.SidebarView(WebInspector.SidebarView.Si debarPosition.Start, "timeline-split");
107 this._sidebarView.addEventListener(WebInspector.SidebarView.EventTypes.Resiz ed, this._sidebarResized, this); 101 this._recordsView.addEventListener(WebInspector.SidebarView.EventTypes.Resiz ed, this._sidebarResized, this);
108 this._sidebarView.setSecondIsSidebar(false); 102 this._recordsView.setSecondIsSidebar(false);
109 this._timelineMemorySplitter.setMainView(this._sidebarView); 103 this._containerElement = this._recordsView.element;
110 this._containerElement = this._sidebarView.element;
111 this._containerElement.tabIndex = 0; 104 this._containerElement.tabIndex = 0;
112 this._containerElement.id = "timeline-container"; 105 this._containerElement.id = "timeline-container";
113 this._containerElement.addEventListener("scroll", this._onScroll.bind(this), false); 106 this._containerElement.addEventListener("scroll", this._onScroll.bind(this), false);
114 107
115 // Create memory statistics as a bottom memory splitter child.
116 this._memoryStatistics = new WebInspector.CountersGraph(this, this._model);
117 this._timelineMemorySplitter.setSidebarView(this._memoryStatistics);
118 this._timelineMemorySplitter.installResizer(this._memoryStatistics.resizeEle ment());
119
120 // Create records list in the records sidebar. 108 // Create records list in the records sidebar.
121 this._sidebarView.sidebarElement().classList.add("vbox"); 109 this._recordsView.sidebarElement().classList.add("vbox");
122 this._sidebarView.sidebarElement().createChild("div", "timeline-records-titl e").textContent = WebInspector.UIString("RECORDS"); 110 this._recordsView.sidebarElement().createChild("div", "timeline-records-titl e").textContent = WebInspector.UIString("RECORDS");
123 this._sidebarListElement = this._sidebarView.sidebarElement().createChild("d iv", "timeline-records-list"); 111 this._sidebarListElement = this._recordsView.sidebarElement().createChild("d iv", "timeline-records-list");
124 112
125 // Create grid in the records main area. 113 // Create grid in the records main area.
126 this._gridContainer = new WebInspector.ViewWithResizeCallback(this._onViewpo rtResize.bind(this)); 114 this._gridContainer = new WebInspector.ViewWithResizeCallback(this._onViewpo rtResize.bind(this));
127 this._gridContainer.element.classList.add("fill"); 115 this._gridContainer.element.classList.add("fill");
128 this._gridContainer.element.id = "resources-container-content"; 116 this._gridContainer.element.id = "resources-container-content";
129 this._sidebarView.setMainView(this._gridContainer); 117 this._recordsView.setMainView(this._gridContainer);
130 this._timelineGrid = new WebInspector.TimelineGrid(); 118 this._timelineGrid = new WebInspector.TimelineGrid();
131 this._itemsGraphsElement = this._timelineGrid.itemsGraphsElement; 119 this._itemsGraphsElement = this._timelineGrid.itemsGraphsElement;
132 this._itemsGraphsElement.id = "timeline-graphs"; 120 this._itemsGraphsElement.id = "timeline-graphs";
133 this._gridContainer.element.appendChild(this._timelineGrid.element); 121 this._gridContainer.element.appendChild(this._timelineGrid.element);
134 this._timelineGrid.gridHeaderElement.id = "timeline-grid-header"; 122 this._timelineGrid.gridHeaderElement.id = "timeline-grid-header";
135 this._timelineGrid.gridHeaderElement.classList.add("fill"); 123 this._timelineGrid.gridHeaderElement.classList.add("fill");
136 this._memoryStatistics.setMainTimelineGrid(this._timelineGrid);
137 this._timelineMemorySplitter.mainElement().appendChild(this._timelineGrid.gr idHeaderElement);
138 if (this._currentMode === WebInspector.TimelinePanel.Mode.Memory)
139 this._timelineMemorySplitter.showBoth();
140 else
141 this._timelineMemorySplitter.showOnlyFirst();
142 124
143 // Create gap elements 125 // Create gap elements
144 this._topGapElement = this._itemsGraphsElement.createChild("div", "timeline- gap"); 126 this._topGapElement = this._itemsGraphsElement.createChild("div", "timeline- gap");
145 this._graphRowsElement = this._itemsGraphsElement.createChild("div"); 127 this._graphRowsElement = this._itemsGraphsElement.createChild("div");
146 this._bottomGapElement = this._itemsGraphsElement.createChild("div", "timeli ne-gap"); 128 this._bottomGapElement = this._itemsGraphsElement.createChild("div", "timeli ne-gap");
147 this._expandElements = this._itemsGraphsElement.createChild("div"); 129 this._expandElements = this._itemsGraphsElement.createChild("div");
148 this._expandElements.id = "orphan-expand-elements"; 130 this._expandElements.id = "orphan-expand-elements";
149 131
150 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._get PopoverAnchor.bind(this), this._showPopover.bind(this));
151
152 this.element.addEventListener("mousemove", this._mouseMove.bind(this), false );
153 this.element.addEventListener("mouseout", this._mouseOut.bind(this), false);
154 this.element.addEventListener("keydown", this._keyDown.bind(this), false);
155
156 this._expandOffset = 15;
157
158 // Create gpu tasks containers. 132 // Create gpu tasks containers.
159 this._mainThreadTasks = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ ([]); 133 this._mainThreadTasks = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ ([]);
160 this._gpuTasks = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ ([]); 134 this._gpuTasks = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ ([]);
161 var utilizationStripsElement = this._timelineGrid.gridHeaderElement.createCh ild("div", "timeline-utilization-strips vbox"); 135 var utilizationStripsElement = this._timelineGrid.gridHeaderElement.createCh ild("div", "timeline-utilization-strips vbox");
162 this._cpuBarsElement = utilizationStripsElement.createChild("div", "timeline -utilization-strip"); 136 this._cpuBarsElement = utilizationStripsElement.createChild("div", "timeline -utilization-strip");
163 if (WebInspector.experimentsSettings.gpuTimeline.isEnabled()) 137 if (WebInspector.experimentsSettings.gpuTimeline.isEnabled())
164 this._gpuBarsElement = utilizationStripsElement.createChild("div", "time line-utilization-strip gpu"); 138 this._gpuBarsElement = utilizationStripsElement.createChild("div", "time line-utilization-strip gpu");
165 139
140 // Create memory splitter as a left child of properties.
pfeldman 2014/01/13 12:49:02 Why reordering?
141 this._timelineMemorySplitter = new WebInspector.SplitView(false, "timeline-m emory");
142 this._timelineMemorySplitter.element.classList.remove("fill");
143 this._timelineMemorySplitter.element.classList.add("timeline-memory-split");
144 this._timelineMemorySplitter.show(this._searchableView.element);
145 this._timelineMemorySplitter.setMainView(this._recordsView);
146
147 // Create memory statistics as a bottom memory splitter child.
148 this._memoryStatistics = new WebInspector.CountersGraph(this, this._model);
149 this._timelineMemorySplitter.setSidebarView(this._memoryStatistics);
150 this._timelineMemorySplitter.installResizer(this._memoryStatistics.resizeEle ment());
151
152 this._memoryStatistics.setMainTimelineGrid(this._timelineGrid);
153 this._timelineMemorySplitter.mainElement().appendChild(this._timelineGrid.gr idHeaderElement);
154 if (this._currentMode === WebInspector.TimelinePanel.Mode.Memory)
155 this._timelineMemorySplitter.showBoth();
156 else
157 this._timelineMemorySplitter.showOnlyFirst();
158
159 this._popoverHelper = new WebInspector.PopoverHelper(this.element, this._get PopoverAnchor.bind(this), this._showPopover.bind(this));
160
161 this.element.addEventListener("mousemove", this._mouseMove.bind(this), false );
162 this.element.addEventListener("mouseout", this._mouseOut.bind(this), false);
163 this.element.addEventListener("keydown", this._keyDown.bind(this), false);
164
165 this._expandOffset = 15;
166
166 this._windowStartTime = 0; 167 this._windowStartTime = 0;
167 this._windowEndTime = Infinity; 168 this._windowEndTime = Infinity;
168 169
169 this._allRecordsCount = 0; 170 this._allRecordsCount = 0;
170 this._createOverviewControls(); 171 this._createOverviewControls();
171 if (this._frameMode) { 172 if (this._frameMode) {
172 this._presentationModel.setGlueRecords(false); 173 this._presentationModel.setGlueRecords(false);
173 this._frameController = new WebInspector.TimelineFrameController(this._m odel, this._frameOverviewControl, this._presentationModel); 174 this._frameController = new WebInspector.TimelineFrameController(this._m odel, this._frameOverviewControl, this._presentationModel);
174 } else { 175 } else {
175 this._presentationModel.setGlueRecords(glueRecordsSetting.get()); 176 this._presentationModel.setGlueRecords(glueRecordsSetting.get());
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 function isAdoptedRecord(record) 515 function isAdoptedRecord(record)
515 { 516 {
516 return record.parent !== presentationModel.rootRecord; 517 return record.parent !== presentationModel.rootRecord;
517 } 518 }
518 // Tell caller update is necessary either if we added a visible record o r if we re-parented a record. 519 // Tell caller update is necessary either if we added a visible record o r if we re-parented a record.
519 return hasVisibleRecords || records.some(isAdoptedRecord); 520 return hasVisibleRecords || records.some(isAdoptedRecord);
520 }, 521 },
521 522
522 _sidebarResized: function() 523 _sidebarResized: function()
523 { 524 {
524 var width = this._sidebarView.sidebarWidth(); 525 var width = this._recordsView.sidebarWidth();
525 this._panel.setSidebarWidth(width); 526 this._panel.setSidebarWidth(width);
526 if (this._currentMode === WebInspector.TimelinePanel.Mode.Memory) 527 if (this._currentMode === WebInspector.TimelinePanel.Mode.Memory)
527 this._memoryStatistics.setSidebarWidth(width); 528 this._memoryStatistics.setSidebarWidth(width);
528 this._timelineGrid.gridHeaderElement.style.left = width + "px"; 529 this._timelineGrid.gridHeaderElement.style.left = width + "px";
529 }, 530 },
530 531
531 /** 532 /**
532 * @param {number} width 533 * @param {number} width
533 */ 534 */
534 setSidebarWidth: function(width) 535 setSidebarWidth: function(width)
535 { 536 {
536 if (this._currentMode === WebInspector.TimelinePanel.Mode.Memory) 537 if (this._currentMode === WebInspector.TimelinePanel.Mode.Memory)
537 this._sidebarView.setSidebarWidth(width); 538 this._recordsView.setSidebarWidth(width);
538 }, 539 },
539 540
540 _onViewportResize: function() 541 _onViewportResize: function()
541 { 542 {
542 this._resize(this._sidebarView.sidebarWidth()); 543 this._resize(this._recordsView.sidebarWidth());
543 }, 544 },
544 545
545 /** 546 /**
546 * @param {number} sidebarWidth 547 * @param {number} sidebarWidth
547 */ 548 */
548 _resize: function(sidebarWidth) 549 _resize: function(sidebarWidth)
549 { 550 {
550 this._closeRecordDetails(); 551 this._closeRecordDetails();
551 this._graphRowsElementWidth = this._graphRowsElement.offsetWidth; 552 this._graphRowsElementWidth = this._graphRowsElement.offsetWidth;
552 this._containerElementHeight = this._containerElement.clientHeight; 553 this._containerElementHeight = this._containerElement.clientHeight;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 var windowStartTime = startIndex ? recordsInWindow[startIndex].start Time : this._model.minimumRecordTime(); 882 var windowStartTime = startIndex ? recordsInWindow[startIndex].start Time : this._model.minimumRecordTime();
882 this._setWindowTimes(windowStartTime, recordsInWindow[Math.max(0, la stVisibleLine - 1)].endTime); 883 this._setWindowTimes(windowStartTime, recordsInWindow[Math.max(0, la stVisibleLine - 1)].endTime);
883 recordsInWindow = this._presentationModel.filteredRecords(); 884 recordsInWindow = this._presentationModel.filteredRecords();
884 endIndex = Math.min(recordsInWindow.length, lastVisibleLine); 885 endIndex = Math.min(recordsInWindow.length, lastVisibleLine);
885 } else { 886 } else {
886 this._updateWindowBoundaries(); 887 this._updateWindowBoundaries();
887 } 888 }
888 889
889 // Resize gaps first. 890 // Resize gaps first.
890 this._topGapElement.style.height = (startIndex * rowHeight) + "px"; 891 this._topGapElement.style.height = (startIndex * rowHeight) + "px";
891 this._sidebarView.sidebarElement().firstChild.style.flexBasis = (startIn dex * rowHeight + headerHeight) + "px"; 892 this._recordsView.sidebarElement().firstChild.style.flexBasis = (startIn dex * rowHeight + headerHeight) + "px";
892 this._bottomGapElement.style.height = (recordsInWindow.length - endIndex ) * rowHeight + "px"; 893 this._bottomGapElement.style.height = (recordsInWindow.length - endIndex ) * rowHeight + "px";
893 var rowsHeight = headerHeight + recordsInWindow.length * rowHeight; 894 var rowsHeight = headerHeight + recordsInWindow.length * rowHeight;
894 var totalHeight = Math.max(this._containerElementHeight, rowsHeight); 895 var totalHeight = Math.max(this._containerElementHeight, rowsHeight);
895 896
896 this._sidebarView.firstElement().style.height = totalHeight + "px"; 897 this._recordsView.firstElement().style.height = totalHeight + "px";
897 this._sidebarView.secondElement().style.height = totalHeight + "px"; 898 this._recordsView.secondElement().style.height = totalHeight + "px";
898 this._sidebarView.resizerElement().style.height = totalHeight + "px"; 899 this._recordsView.resizerElement().style.height = totalHeight + "px";
899 900
900 // Update visible rows. 901 // Update visible rows.
901 var listRowElement = this._sidebarListElement.firstChild; 902 var listRowElement = this._sidebarListElement.firstChild;
902 var width = this._graphRowsElementWidth; 903 var width = this._graphRowsElementWidth;
903 this._itemsGraphsElement.removeChild(this._graphRowsElement); 904 this._itemsGraphsElement.removeChild(this._graphRowsElement);
904 var graphRowElement = this._graphRowsElement.firstChild; 905 var graphRowElement = this._graphRowsElement.firstChild;
905 var scheduleRefreshCallback = this._invalidateAndScheduleRefresh.bind(th is, true, true); 906 var scheduleRefreshCallback = this._invalidateAndScheduleRefresh.bind(th is, true, true);
906 var selectRecordCallback = this._selectRecord.bind(this); 907 var selectRecordCallback = this._selectRecord.bind(this);
907 this._itemsGraphsElement.removeChild(this._expandElements); 908 this._itemsGraphsElement.removeChild(this._expandElements);
908 this._expandElements.removeChildren(); 909 this._expandElements.removeChildren();
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1883 * @param {boolean} vertical 1884 * @param {boolean} vertical
1884 */ 1885 */
1885 setVertical: function(vertical) 1886 setVertical: function(vertical)
1886 { 1887 {
1887 this._contentElement.enableStyleClass("hbox", !vertical); 1888 this._contentElement.enableStyleClass("hbox", !vertical);
1888 this._contentElement.enableStyleClass("vbox", vertical); 1889 this._contentElement.enableStyleClass("vbox", vertical);
1889 }, 1890 },
1890 1891
1891 __proto__: WebInspector.View.prototype 1892 __proto__: WebInspector.View.prototype
1892 } 1893 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698