OLD | NEW |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 this._presentationModel.addFilter(this._windowFilter); | 60 this._presentationModel.addFilter(this._windowFilter); |
61 this._presentationModel.addFilter(new WebInspector.TimelineCategoryFilter())
; | 61 this._presentationModel.addFilter(new WebInspector.TimelineCategoryFilter())
; |
62 this._presentationModel.addFilter(this._durationFilter); | 62 this._presentationModel.addFilter(this._durationFilter); |
63 | 63 |
64 this._frameMode = mode === WebInspector.TimelinePanel.Mode.Frames; | 64 this._frameMode = mode === WebInspector.TimelinePanel.Mode.Frames; |
65 this._boundariesAreValid = true; | 65 this._boundariesAreValid = true; |
66 this._scrollTop = 0; | 66 this._scrollTop = 0; |
67 | 67 |
68 // Create layout componets. | 68 // Create layout componets. |
69 | 69 |
| 70 // ------------------------------- |
| 71 // | Overview | |
70 // |-------------------------------| | 72 // |-------------------------------| |
71 // | | | | | 73 // | | | | |
72 // | | Records | | | 74 // | | Records | | |
73 // | | | Details | | 75 // | | | Details | |
74 // |----------------| | | 76 // |----------------| | |
75 // | | Memory | | | 77 // | | Memory | | |
76 // ------------------------------- | 78 // ------------------------------- |
77 | 79 |
78 // Create top level properties splitter. | 80 // Create top level properties splitter. |
79 this._detailsSplitView = new WebInspector.SplitView(false, "timeline-details
"); | 81 this._detailsSplitView = new WebInspector.SplitView(false, "timeline-details
"); |
80 this._detailsSplitView.element.classList.remove("fill"); | 82 this._detailsSplitView.element.classList.remove("fill"); |
81 this._detailsSplitView.element.classList.add("timeline-details-split"); | 83 this._detailsSplitView.element.classList.add("timeline-details-split"); |
82 this._detailsSplitView.sidebarElement().classList.add("timeline-details"); | 84 this._detailsSplitView.sidebarElement().classList.add("timeline-details"); |
83 this._detailsSplitView.show(this.element); | 85 this._detailsSplitView.show(this.element); |
84 this._detailsSplitView.mainElement().classList.add("vbox"); | 86 this._detailsSplitView.mainElement().classList.add("vbox"); |
85 this._detailsSplitView.setMainElementConstraints(undefined, 40); | 87 this._detailsSplitView.setMainElementConstraints(undefined, 40); |
86 this._detailsView = new WebInspector.TimelineDetailsView(); | 88 this._detailsView = new WebInspector.TimelineDetailsView(); |
87 this._detailsSplitView.setSidebarView(this._detailsView); | 89 this._detailsSplitView.setSidebarView(this._detailsView); |
88 this._detailsSplitView.installResizer(this._detailsView.titleElement()); | 90 this._detailsSplitView.installResizer(this._detailsView.titleElement()); |
89 | 91 |
90 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)); |
91 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi
s._dockSideChanged.bind(this)); | 93 WebInspector.settings.splitVerticallyWhenDockedToRight.addChangeListener(thi
s._dockSideChanged.bind(this)); |
92 this._dockSideChanged(); | 94 this._dockSideChanged(); |
93 | 95 |
94 this._searchableView = new WebInspector.SearchableView(this); | 96 this._searchableView = new WebInspector.SearchableView(this); |
95 this._detailsSplitView.setMainView(this._searchableView); | 97 this._detailsSplitView.setMainView(this._searchableView); |
96 | 98 |
97 this._recordsView = this._createRecordsView(); | 99 // Create records sidebar as a top memory splitter child. |
| 100 this._recordsView = new WebInspector.SidebarView(WebInspector.SidebarView.Si
debarPosition.Start, "timeline-split"); |
| 101 this._recordsView.addEventListener(WebInspector.SidebarView.EventTypes.Resiz
ed, this._sidebarResized, this); |
| 102 this._recordsView.setSecondIsSidebar(false); |
| 103 this._containerElement = this._recordsView.element; |
| 104 this._containerElement.tabIndex = 0; |
| 105 this._containerElement.id = "timeline-container"; |
| 106 this._containerElement.addEventListener("scroll", this._onScroll.bind(this),
false); |
98 | 107 |
99 this._stackView = new WebInspector.StackView(false); | 108 // Create records list in the records sidebar. |
100 this._stackView.show(this._searchableView.element); | 109 this._recordsView.sidebarElement().classList.add("vbox"); |
101 this._recordsViewMainElement = this._stackView.appendView(this._recordsView,
"timeline-records").mainElement(); | 110 this._recordsView.sidebarElement().createChild("div", "timeline-records-titl
e").textContent = WebInspector.UIString("RECORDS"); |
102 this._recordsViewMainElement.appendChild(this._timelineGrid.gridHeaderElemen
t); | 111 this._sidebarListElement = this._recordsView.sidebarElement().createChild("d
iv", "timeline-records-list"); |
103 | 112 |
104 if (this._currentMode === WebInspector.TimelinePanel.Mode.Memory) { | 113 // Create grid in the records main area. |
105 // Create memory statistics as a bottom memory splitter child. | 114 this._gridContainer = new WebInspector.ViewWithResizeCallback(this._onViewpo
rtResize.bind(this)); |
106 this._memoryStatistics = new WebInspector.CountersGraph(this, this._mode
l); | 115 this._gridContainer.element.classList.add("fill"); |
107 this._stackView.appendView(this._memoryStatistics, "timeline-memory"); | 116 this._gridContainer.element.id = "resources-container-content"; |
108 this._memoryStatistics.setMainTimelineGrid(this._timelineGrid); | 117 this._recordsView.setMainView(this._gridContainer); |
109 } | 118 this._timelineGrid = new WebInspector.TimelineGrid(); |
| 119 this._itemsGraphsElement = this._timelineGrid.itemsGraphsElement; |
| 120 this._itemsGraphsElement.id = "timeline-graphs"; |
| 121 this._gridContainer.element.appendChild(this._timelineGrid.element); |
| 122 this._timelineGrid.gridHeaderElement.id = "timeline-grid-header"; |
| 123 this._timelineGrid.gridHeaderElement.classList.add("fill"); |
| 124 |
| 125 // Create gap elements |
| 126 this._topGapElement = this._itemsGraphsElement.createChild("div", "timeline-
gap"); |
| 127 this._graphRowsElement = this._itemsGraphsElement.createChild("div"); |
| 128 this._bottomGapElement = this._itemsGraphsElement.createChild("div", "timeli
ne-gap"); |
| 129 this._expandElements = this._itemsGraphsElement.createChild("div"); |
| 130 this._expandElements.id = "orphan-expand-elements"; |
| 131 |
| 132 // Create gpu tasks containers. |
| 133 this._mainThreadTasks = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */
([]); |
| 134 this._gpuTasks = /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ ([]); |
| 135 var utilizationStripsElement = this._timelineGrid.gridHeaderElement.createCh
ild("div", "timeline-utilization-strips vbox"); |
| 136 this._cpuBarsElement = utilizationStripsElement.createChild("div", "timeline
-utilization-strip"); |
| 137 if (WebInspector.experimentsSettings.gpuTimeline.isEnabled()) |
| 138 this._gpuBarsElement = utilizationStripsElement.createChild("div", "time
line-utilization-strip gpu"); |
| 139 |
| 140 // Create memory splitter as a left child of properties. |
| 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)); |
110 | 160 |
111 this.element.addEventListener("mousemove", this._mouseMove.bind(this), false
); | 161 this.element.addEventListener("mousemove", this._mouseMove.bind(this), false
); |
112 this.element.addEventListener("mouseout", this._mouseOut.bind(this), false); | 162 this.element.addEventListener("mouseout", this._mouseOut.bind(this), false); |
113 this.element.addEventListener("keydown", this._keyDown.bind(this), false); | 163 this.element.addEventListener("keydown", this._keyDown.bind(this), false); |
114 | 164 |
115 this._expandOffset = 15; | 165 this._expandOffset = 15; |
116 | 166 |
117 this._windowStartTime = 0; | 167 this._windowStartTime = 0; |
118 this._windowEndTime = Infinity; | 168 this._windowEndTime = Infinity; |
119 | 169 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 continue; | 213 continue; |
164 var filter = new WebInspector.CheckboxFilterUI(category.name, category.t
itle); | 214 var filter = new WebInspector.CheckboxFilterUI(category.name, category.t
itle); |
165 filters._categoryFiltersUI[category.name] = filter; | 215 filters._categoryFiltersUI[category.name] = filter; |
166 } | 216 } |
167 WebInspector.TimelineView._commonUIFilters = filters; | 217 WebInspector.TimelineView._commonUIFilters = filters; |
168 return filters; | 218 return filters; |
169 } | 219 } |
170 | 220 |
171 WebInspector.TimelineView.prototype = { | 221 WebInspector.TimelineView.prototype = { |
172 /** | 222 /** |
173 * @return {!WebInspector.SidebarView} | |
174 */ | |
175 _createRecordsView: function() | |
176 { | |
177 // Create records sidebar as a top memory splitter child. | |
178 var recordsView = new WebInspector.SidebarView(WebInspector.SidebarView.
SidebarPosition.Start, "timeline-split"); | |
179 recordsView.addEventListener(WebInspector.SidebarView.EventTypes.Resized
, this._sidebarResized, this); | |
180 recordsView.setSecondIsSidebar(false); | |
181 this._containerElement = recordsView.element; | |
182 this._containerElement.tabIndex = 0; | |
183 this._containerElement.id = "timeline-container"; | |
184 this._containerElement.addEventListener("scroll", this._onScroll.bind(th
is), false); | |
185 | |
186 // Create records list in the records sidebar. | |
187 recordsView.sidebarElement().classList.add("vbox"); | |
188 recordsView.sidebarElement().createChild("div", "timeline-records-title"
).textContent = WebInspector.UIString("RECORDS"); | |
189 this._sidebarListElement = recordsView.sidebarElement().createChild("div
", "timeline-records-list"); | |
190 | |
191 // Create grid in the records main area. | |
192 this._gridContainer = new WebInspector.ViewWithResizeCallback(this._onVi
ewportResize.bind(this)); | |
193 this._gridContainer.element.classList.add("fill"); | |
194 this._gridContainer.element.id = "resources-container-content"; | |
195 recordsView.setMainView(this._gridContainer); | |
196 this._timelineGrid = new WebInspector.TimelineGrid(); | |
197 this._itemsGraphsElement = this._timelineGrid.itemsGraphsElement; | |
198 this._itemsGraphsElement.id = "timeline-graphs"; | |
199 this._gridContainer.element.appendChild(this._timelineGrid.element); | |
200 this._timelineGrid.gridHeaderElement.id = "timeline-grid-header"; | |
201 this._timelineGrid.gridHeaderElement.classList.add("fill"); | |
202 | |
203 // Create gap elements | |
204 this._topGapElement = this._itemsGraphsElement.createChild("div", "timel
ine-gap"); | |
205 this._graphRowsElement = this._itemsGraphsElement.createChild("div"); | |
206 this._bottomGapElement = this._itemsGraphsElement.createChild("div", "ti
meline-gap"); | |
207 this._expandElements = this._itemsGraphsElement.createChild("div"); | |
208 this._expandElements.id = "orphan-expand-elements"; | |
209 | |
210 // Create gpu tasks containers. | |
211 /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ | |
212 this._mainThreadTasks = ([]); | |
213 /** @type {!Array.<!TimelineAgent.TimelineEvent>} */ | |
214 this._gpuTasks = ([]); | |
215 var utilizationStripsElement = this._timelineGrid.gridHeaderElement.crea
teChild("div", "timeline-utilization-strips vbox"); | |
216 this._cpuBarsElement = utilizationStripsElement.createChild("div", "time
line-utilization-strip"); | |
217 if (WebInspector.experimentsSettings.gpuTimeline.isEnabled()) | |
218 this._gpuBarsElement = utilizationStripsElement.createChild("div", "
timeline-utilization-strip gpu"); | |
219 | |
220 return recordsView; | |
221 }, | |
222 | |
223 /** | |
224 * @return {!WebInspector.SearchableView} | 223 * @return {!WebInspector.SearchableView} |
225 */ | 224 */ |
226 searchableView: function() | 225 searchableView: function() |
227 { | 226 { |
228 return this._searchableView; | 227 return this._searchableView; |
229 }, | 228 }, |
230 | 229 |
231 /** | 230 /** |
232 * @return {boolean} | 231 * @return {boolean} |
233 */ | 232 */ |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 _onViewportResize: function() | 541 _onViewportResize: function() |
543 { | 542 { |
544 this._resize(this._recordsView.sidebarWidth()); | 543 this._resize(this._recordsView.sidebarWidth()); |
545 }, | 544 }, |
546 | 545 |
547 /** | 546 /** |
548 * @param {number} sidebarWidth | 547 * @param {number} sidebarWidth |
549 */ | 548 */ |
550 _resize: function(sidebarWidth) | 549 _resize: function(sidebarWidth) |
551 { | 550 { |
| 551 this._closeRecordDetails(); |
552 this._graphRowsElementWidth = this._graphRowsElement.offsetWidth; | 552 this._graphRowsElementWidth = this._graphRowsElement.offsetWidth; |
553 this._containerElementHeight = this._containerElement.clientHeight; | 553 this._containerElementHeight = this._containerElement.clientHeight; |
554 this._timelineGrid.gridHeaderElement.style.width = this._itemsGraphsElem
ent.offsetWidth + "px"; | 554 this._timelineGrid.gridHeaderElement.style.width = this._itemsGraphsElem
ent.offsetWidth + "px"; |
555 this._scheduleRefresh(false, true); | 555 this._scheduleRefresh(false, true); |
556 }, | 556 }, |
557 | 557 |
558 _resetView: function() | 558 _resetView: function() |
559 { | 559 { |
560 this._presentationModel.reset(); | 560 this._presentationModel.reset(); |
561 this._boundariesAreValid = false; | 561 this._boundariesAreValid = false; |
562 this._adjustScrollPosition(0); | 562 this._adjustScrollPosition(0); |
| 563 this._closeRecordDetails(); |
563 this._allRecordsCount = 0; | 564 this._allRecordsCount = 0; |
564 this._automaticallySizeWindow = true; | 565 this._automaticallySizeWindow = true; |
565 this._mainThreadTasks = []; | 566 this._mainThreadTasks = []; |
566 this._gpuTasks = []; | 567 this._gpuTasks = []; |
567 }, | 568 }, |
568 | 569 |
569 _onRecordsCleared: function() | 570 _onRecordsCleared: function() |
570 { | 571 { |
571 this._windowStartTime = 0; | 572 this._windowStartTime = 0; |
572 this._windowEndTime = Infinity; | 573 this._windowEndTime = Infinity; |
(...skipping 24 matching lines...) Expand all Loading... |
597 if (!WebInspector.TimelinePanel._categoryStylesInitialized) { | 598 if (!WebInspector.TimelinePanel._categoryStylesInitialized) { |
598 WebInspector.TimelinePanel._categoryStylesInitialized = true; | 599 WebInspector.TimelinePanel._categoryStylesInitialized = true; |
599 this._injectCategoryStyles(); | 600 this._injectCategoryStyles(); |
600 } | 601 } |
601 this._onViewportResize(); | 602 this._onViewportResize(); |
602 this._refresh(); | 603 this._refresh(); |
603 }, | 604 }, |
604 | 605 |
605 willHide: function() | 606 willHide: function() |
606 { | 607 { |
| 608 this._closeRecordDetails(); |
607 WebInspector.View.prototype.willHide.call(this); | 609 WebInspector.View.prototype.willHide.call(this); |
608 }, | 610 }, |
609 | 611 |
610 _onScroll: function(event) | 612 _onScroll: function(event) |
611 { | 613 { |
| 614 this._closeRecordDetails(); |
612 this._scrollTop = this._containerElement.scrollTop; | 615 this._scrollTop = this._containerElement.scrollTop; |
613 var dividersTop = Math.max(0, this._scrollTop); | 616 var dividersTop = Math.max(0, this._scrollTop); |
614 this._timelineGrid.setScrollAndDividerTop(this._scrollTop, dividersTop); | 617 this._timelineGrid.setScrollAndDividerTop(this._scrollTop, dividersTop); |
615 this._scheduleRefresh(true, true); | 618 this._scheduleRefresh(true, true); |
616 }, | 619 }, |
617 | 620 |
618 /** | 621 /** |
619 * @param {boolean} preserveBoundaries | 622 * @param {boolean} preserveBoundaries |
620 * @param {boolean} userGesture | 623 * @param {boolean} userGesture |
621 */ | 624 */ |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 this._invalidateAndScheduleRefresh(false, true); | 754 this._invalidateAndScheduleRefresh(false, true); |
752 this._selectRecord(null); | 755 this._selectRecord(null); |
753 }, | 756 }, |
754 | 757 |
755 /** | 758 /** |
756 * @param {boolean} preserveBoundaries | 759 * @param {boolean} preserveBoundaries |
757 * @param {boolean} userGesture | 760 * @param {boolean} userGesture |
758 */ | 761 */ |
759 _scheduleRefresh: function(preserveBoundaries, userGesture) | 762 _scheduleRefresh: function(preserveBoundaries, userGesture) |
760 { | 763 { |
| 764 this._closeRecordDetails(); |
761 this._boundariesAreValid &= preserveBoundaries; | 765 this._boundariesAreValid &= preserveBoundaries; |
762 | 766 |
763 if (!this.isShowing()) | 767 if (!this.isShowing()) |
764 return; | 768 return; |
765 | 769 |
766 if (preserveBoundaries || userGesture) | 770 if (preserveBoundaries || userGesture) |
767 this._refresh(); | 771 this._refresh(); |
768 else { | 772 else { |
769 if (!this._refreshTimeout) | 773 if (!this._refreshTimeout) |
770 this._refreshTimeout = setTimeout(this._refresh.bind(this), 300)
; | 774 this._refreshTimeout = setTimeout(this._refresh.bind(this), 300)
; |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 else if (anchor._tasksInfo) | 1205 else if (anchor._tasksInfo) |
1202 popover.show(this._presentationModel.generateMainThreadBarPopupC
ontent(anchor._tasksInfo), anchor, null, null, WebInspector.Popover.Orientation.
Bottom); | 1206 popover.show(this._presentationModel.generateMainThreadBarPopupC
ontent(anchor._tasksInfo), anchor, null, null, WebInspector.Popover.Orientation.
Bottom); |
1203 } | 1207 } |
1204 | 1208 |
1205 function showCallback(popupContent) | 1209 function showCallback(popupContent) |
1206 { | 1210 { |
1207 popover.show(popupContent, anchor); | 1211 popover.show(popupContent, anchor); |
1208 } | 1212 } |
1209 }, | 1213 }, |
1210 | 1214 |
| 1215 _closeRecordDetails: function() |
| 1216 { |
| 1217 this._popoverHelper.hidePopover(); |
| 1218 }, |
| 1219 |
1211 _injectCategoryStyles: function() | 1220 _injectCategoryStyles: function() |
1212 { | 1221 { |
1213 var style = document.createElement("style"); | 1222 var style = document.createElement("style"); |
1214 var categories = WebInspector.TimelinePresentationModel.categories(); | 1223 var categories = WebInspector.TimelinePresentationModel.categories(); |
1215 | 1224 |
1216 style.textContent = Object.values(categories).map(WebInspector.TimelineP
resentationModel.createStyleRuleForCategory).join("\n"); | 1225 style.textContent = Object.values(categories).map(WebInspector.TimelineP
resentationModel.createStyleRuleForCategory).join("\n"); |
1217 document.head.appendChild(style); | 1226 document.head.appendChild(style); |
1218 }, | 1227 }, |
1219 | 1228 |
1220 jumpToNextSearchResult: function() | 1229 jumpToNextSearchResult: function() |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 * @param {boolean} vertical | 1885 * @param {boolean} vertical |
1877 */ | 1886 */ |
1878 setVertical: function(vertical) | 1887 setVertical: function(vertical) |
1879 { | 1888 { |
1880 this._contentElement.enableStyleClass("hbox", !vertical); | 1889 this._contentElement.enableStyleClass("hbox", !vertical); |
1881 this._contentElement.enableStyleClass("vbox", vertical); | 1890 this._contentElement.enableStyleClass("vbox", vertical); |
1882 }, | 1891 }, |
1883 | 1892 |
1884 __proto__: WebInspector.View.prototype | 1893 __proto__: WebInspector.View.prototype |
1885 } | 1894 } |
OLD | NEW |