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