| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 12 matching lines...) Expand all Loading... |
| 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 */ | 30 */ |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * @implements {WebInspector.TimelineLifecycleDelegate} | 33 * @implements {Timeline.TimelineLifecycleDelegate} |
| 34 * @implements {WebInspector.TimelineModeViewDelegate} | 34 * @implements {Timeline.TimelineModeViewDelegate} |
| 35 * @implements {WebInspector.Searchable} | 35 * @implements {UI.Searchable} |
| 36 * @unrestricted | 36 * @unrestricted |
| 37 */ | 37 */ |
| 38 WebInspector.TimelinePanel = class extends WebInspector.Panel { | 38 Timeline.TimelinePanel = class extends UI.Panel { |
| 39 constructor() { | 39 constructor() { |
| 40 super('timeline'); | 40 super('timeline'); |
| 41 this.registerRequiredCSS('timeline/timelinePanel.css'); | 41 this.registerRequiredCSS('timeline/timelinePanel.css'); |
| 42 this.element.addEventListener('contextmenu', this._contextMenu.bind(this), f
alse); | 42 this.element.addEventListener('contextmenu', this._contextMenu.bind(this), f
alse); |
| 43 this._dropTarget = new WebInspector.DropTarget( | 43 this._dropTarget = new UI.DropTarget( |
| 44 this.element, [WebInspector.DropTarget.Types.Files, WebInspector.DropTar
get.Types.URIList], | 44 this.element, [UI.DropTarget.Types.Files, UI.DropTarget.Types.URIList], |
| 45 WebInspector.UIString('Drop timeline file or URL here'), this._handleDro
p.bind(this)); | 45 Common.UIString('Drop timeline file or URL here'), this._handleDrop.bind
(this)); |
| 46 | 46 |
| 47 this._state = WebInspector.TimelinePanel.State.Idle; | 47 this._state = Timeline.TimelinePanel.State.Idle; |
| 48 this._detailsLinkifier = new WebInspector.Linkifier(); | 48 this._detailsLinkifier = new Components.Linkifier(); |
| 49 this._windowStartTime = 0; | 49 this._windowStartTime = 0; |
| 50 this._windowEndTime = Infinity; | 50 this._windowEndTime = Infinity; |
| 51 this._millisecondsToRecordAfterLoadEvent = 3000; | 51 this._millisecondsToRecordAfterLoadEvent = 3000; |
| 52 this._toggleRecordAction = | 52 this._toggleRecordAction = |
| 53 /** @type {!WebInspector.Action }*/ (WebInspector.actionRegistry.action(
'timeline.toggle-recording')); | 53 /** @type {!UI.Action }*/ (UI.actionRegistry.action('timeline.toggle-rec
ording')); |
| 54 this._customCPUThrottlingRate = 0; | 54 this._customCPUThrottlingRate = 0; |
| 55 | 55 |
| 56 /** @type {!Array<!WebInspector.TimelineModel.Filter>} */ | 56 /** @type {!Array<!TimelineModel.TimelineModel.Filter>} */ |
| 57 this._filters = []; | 57 this._filters = []; |
| 58 if (!Runtime.experiments.isEnabled('timelineShowAllEvents')) { | 58 if (!Runtime.experiments.isEnabled('timelineShowAllEvents')) { |
| 59 this._filters.push(WebInspector.TimelineUIUtils.visibleEventsFilter()); | 59 this._filters.push(Timeline.TimelineUIUtils.visibleEventsFilter()); |
| 60 this._filters.push(new WebInspector.ExcludeTopLevelFilter()); | 60 this._filters.push(new TimelineModel.ExcludeTopLevelFilter()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Create models. | 63 // Create models. |
| 64 this._tracingModelBackingStorage = new WebInspector.TempFileBackingStorage('
tracing'); | 64 this._tracingModelBackingStorage = new Bindings.TempFileBackingStorage('trac
ing'); |
| 65 this._tracingModel = new WebInspector.TracingModel(this._tracingModelBacking
Storage); | 65 this._tracingModel = new SDK.TracingModel(this._tracingModelBackingStorage); |
| 66 this._model = new WebInspector.TimelineModel(WebInspector.TimelineUIUtils.vi
sibleEventsFilter()); | 66 this._model = new TimelineModel.TimelineModel(Timeline.TimelineUIUtils.visib
leEventsFilter()); |
| 67 this._frameModel = | 67 this._frameModel = |
| 68 new WebInspector.TimelineFrameModel(event => WebInspector.TimelineUIUtil
s.eventStyle(event).category.name); | 68 new TimelineModel.TimelineFrameModel(event => Timeline.TimelineUIUtils.e
ventStyle(event).category.name); |
| 69 this._filmStripModel = new WebInspector.FilmStripModel(this._tracingModel); | 69 this._filmStripModel = new Components.FilmStripModel(this._tracingModel); |
| 70 this._irModel = new WebInspector.TimelineIRModel(); | 70 this._irModel = new TimelineModel.TimelineIRModel(); |
| 71 | 71 |
| 72 this._cpuThrottlingManager = new WebInspector.CPUThrottlingManager(); | 72 this._cpuThrottlingManager = new Timeline.CPUThrottlingManager(); |
| 73 | 73 |
| 74 /** @type {!Array.<!WebInspector.TimelineModeView>} */ | 74 /** @type {!Array.<!Timeline.TimelineModeView>} */ |
| 75 this._currentViews = []; | 75 this._currentViews = []; |
| 76 | 76 |
| 77 this._captureNetworkSetting = WebInspector.settings.createSetting('timelineC
aptureNetwork', false); | 77 this._captureNetworkSetting = Common.settings.createSetting('timelineCapture
Network', false); |
| 78 this._captureJSProfileSetting = WebInspector.settings.createSetting('timelin
eEnableJSSampling', true); | 78 this._captureJSProfileSetting = Common.settings.createSetting('timelineEnabl
eJSSampling', true); |
| 79 this._captureMemorySetting = WebInspector.settings.createSetting('timelineCa
ptureMemory', false); | 79 this._captureMemorySetting = Common.settings.createSetting('timelineCaptureM
emory', false); |
| 80 this._captureLayersAndPicturesSetting = | 80 this._captureLayersAndPicturesSetting = |
| 81 WebInspector.settings.createSetting('timelineCaptureLayersAndPictures',
false); | 81 Common.settings.createSetting('timelineCaptureLayersAndPictures', false)
; |
| 82 this._captureFilmStripSetting = WebInspector.settings.createSetting('timelin
eCaptureFilmStrip', false); | 82 this._captureFilmStripSetting = Common.settings.createSetting('timelineCaptu
reFilmStrip', false); |
| 83 | 83 |
| 84 this._markUnusedCSS = WebInspector.settings.createSetting('timelineMarkUnuse
dCSS', false); | 84 this._markUnusedCSS = Common.settings.createSetting('timelineMarkUnusedCSS',
false); |
| 85 | 85 |
| 86 this._panelToolbar = new WebInspector.Toolbar('', this.element); | 86 this._panelToolbar = new UI.Toolbar('', this.element); |
| 87 this._createToolbarItems(); | 87 this._createToolbarItems(); |
| 88 | 88 |
| 89 var timelinePane = new WebInspector.VBox(); | 89 var timelinePane = new UI.VBox(); |
| 90 timelinePane.show(this.element); | 90 timelinePane.show(this.element); |
| 91 var topPaneElement = timelinePane.element.createChild('div', 'hbox'); | 91 var topPaneElement = timelinePane.element.createChild('div', 'hbox'); |
| 92 topPaneElement.id = 'timeline-overview-panel'; | 92 topPaneElement.id = 'timeline-overview-panel'; |
| 93 | 93 |
| 94 // Create top overview component. | 94 // Create top overview component. |
| 95 this._overviewPane = new WebInspector.TimelineOverviewPane('timeline'); | 95 this._overviewPane = new UI.TimelineOverviewPane('timeline'); |
| 96 this._overviewPane.addEventListener( | 96 this._overviewPane.addEventListener( |
| 97 WebInspector.TimelineOverviewPane.Events.WindowChanged, this._onWindowCh
anged.bind(this)); | 97 UI.TimelineOverviewPane.Events.WindowChanged, this._onWindowChanged.bind
(this)); |
| 98 this._overviewPane.show(topPaneElement); | 98 this._overviewPane.show(topPaneElement); |
| 99 this._statusPaneContainer = timelinePane.element.createChild('div', 'status-
pane-container fill'); | 99 this._statusPaneContainer = timelinePane.element.createChild('div', 'status-
pane-container fill'); |
| 100 | 100 |
| 101 this._createFileSelector(); | 101 this._createFileSelector(); |
| 102 | 102 |
| 103 WebInspector.targetManager.addEventListener( | 103 SDK.targetManager.addEventListener( |
| 104 WebInspector.TargetManager.Events.PageReloadRequested, this._pageReloadR
equested, this); | 104 SDK.TargetManager.Events.PageReloadRequested, this._pageReloadRequested,
this); |
| 105 WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Event
s.Load, this._loadEventFired, this); | 105 SDK.targetManager.addEventListener(SDK.TargetManager.Events.Load, this._load
EventFired, this); |
| 106 | 106 |
| 107 // Create top level properties splitter. | 107 // Create top level properties splitter. |
| 108 this._detailsSplitWidget = new WebInspector.SplitWidget(false, true, 'timeli
nePanelDetailsSplitViewState'); | 108 this._detailsSplitWidget = new UI.SplitWidget(false, true, 'timelinePanelDet
ailsSplitViewState'); |
| 109 this._detailsSplitWidget.element.classList.add('timeline-details-split'); | 109 this._detailsSplitWidget.element.classList.add('timeline-details-split'); |
| 110 this._detailsView = new WebInspector.TimelineDetailsView(this._model, this._
filters, this); | 110 this._detailsView = new Timeline.TimelineDetailsView(this._model, this._filt
ers, this); |
| 111 this._detailsSplitWidget.installResizer(this._detailsView.headerElement()); | 111 this._detailsSplitWidget.installResizer(this._detailsView.headerElement()); |
| 112 this._detailsSplitWidget.setSidebarWidget(this._detailsView); | 112 this._detailsSplitWidget.setSidebarWidget(this._detailsView); |
| 113 | 113 |
| 114 this._searchableView = new WebInspector.SearchableView(this); | 114 this._searchableView = new UI.SearchableView(this); |
| 115 this._searchableView.setMinimumSize(0, 100); | 115 this._searchableView.setMinimumSize(0, 100); |
| 116 this._searchableView.element.classList.add('searchable-view'); | 116 this._searchableView.element.classList.add('searchable-view'); |
| 117 this._detailsSplitWidget.setMainWidget(this._searchableView); | 117 this._detailsSplitWidget.setMainWidget(this._searchableView); |
| 118 | 118 |
| 119 this._stackView = new WebInspector.StackView(false); | 119 this._stackView = new UI.StackView(false); |
| 120 this._stackView.element.classList.add('timeline-view-stack'); | 120 this._stackView.element.classList.add('timeline-view-stack'); |
| 121 | 121 |
| 122 this._stackView.show(this._searchableView.element); | 122 this._stackView.show(this._searchableView.element); |
| 123 this._onModeChanged(); | 123 this._onModeChanged(); |
| 124 | 124 |
| 125 this._detailsSplitWidget.show(timelinePane.element); | 125 this._detailsSplitWidget.show(timelinePane.element); |
| 126 this._detailsSplitWidget.hideSidebar(); | 126 this._detailsSplitWidget.hideSidebar(); |
| 127 WebInspector.targetManager.addEventListener( | 127 SDK.targetManager.addEventListener( |
| 128 WebInspector.TargetManager.Events.SuspendStateChanged, this._onSuspendSt
ateChanged, this); | 128 SDK.TargetManager.Events.SuspendStateChanged, this._onSuspendStateChange
d, this); |
| 129 this._showRecordingHelpMessage(); | 129 this._showRecordingHelpMessage(); |
| 130 | 130 |
| 131 /** @type {!WebInspector.TracingModel.Event}|undefined */ | 131 /** @type {!SDK.TracingModel.Event}|undefined */ |
| 132 this._selectedSearchResult; | 132 this._selectedSearchResult; |
| 133 /** @type {!Array<!WebInspector.TracingModel.Event>}|undefined */ | 133 /** @type {!Array<!SDK.TracingModel.Event>}|undefined */ |
| 134 this._searchResults; | 134 this._searchResults; |
| 135 } | 135 } |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * @return {!WebInspector.TimelinePanel} | 138 * @return {!Timeline.TimelinePanel} |
| 139 */ | 139 */ |
| 140 static instance() { | 140 static instance() { |
| 141 return /** @type {!WebInspector.TimelinePanel} */ (self.runtime.sharedInstan
ce(WebInspector.TimelinePanel)); | 141 return /** @type {!Timeline.TimelinePanel} */ (self.runtime.sharedInstance(T
imeline.TimelinePanel)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 /** | 144 /** |
| 145 * @override | 145 * @override |
| 146 * @return {?WebInspector.SearchableView} | 146 * @return {?UI.SearchableView} |
| 147 */ | 147 */ |
| 148 searchableView() { | 148 searchableView() { |
| 149 return this._searchableView; | 149 return this._searchableView; |
| 150 } | 150 } |
| 151 | 151 |
| 152 /** | 152 /** |
| 153 * @override | 153 * @override |
| 154 */ | 154 */ |
| 155 wasShown() { | 155 wasShown() { |
| 156 WebInspector.context.setFlavor(WebInspector.TimelinePanel, this); | 156 UI.context.setFlavor(Timeline.TimelinePanel, this); |
| 157 } | 157 } |
| 158 | 158 |
| 159 /** | 159 /** |
| 160 * @override | 160 * @override |
| 161 */ | 161 */ |
| 162 willHide() { | 162 willHide() { |
| 163 WebInspector.context.setFlavor(WebInspector.TimelinePanel, null); | 163 UI.context.setFlavor(Timeline.TimelinePanel, null); |
| 164 } | 164 } |
| 165 | 165 |
| 166 /** | 166 /** |
| 167 * @return {number} | 167 * @return {number} |
| 168 */ | 168 */ |
| 169 windowStartTime() { | 169 windowStartTime() { |
| 170 if (this._windowStartTime) | 170 if (this._windowStartTime) |
| 171 return this._windowStartTime; | 171 return this._windowStartTime; |
| 172 return this._model.minimumRecordTime(); | 172 return this._model.minimumRecordTime(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 /** | 175 /** |
| 176 * @return {number} | 176 * @return {number} |
| 177 */ | 177 */ |
| 178 windowEndTime() { | 178 windowEndTime() { |
| 179 if (this._windowEndTime < Infinity) | 179 if (this._windowEndTime < Infinity) |
| 180 return this._windowEndTime; | 180 return this._windowEndTime; |
| 181 return this._model.maximumRecordTime() || Infinity; | 181 return this._model.maximumRecordTime() || Infinity; |
| 182 } | 182 } |
| 183 | 183 |
| 184 /** | 184 /** |
| 185 * @param {!WebInspector.Event} event | 185 * @param {!Common.Event} event |
| 186 */ | 186 */ |
| 187 _onWindowChanged(event) { | 187 _onWindowChanged(event) { |
| 188 this._windowStartTime = event.data.startTime; | 188 this._windowStartTime = event.data.startTime; |
| 189 this._windowEndTime = event.data.endTime; | 189 this._windowEndTime = event.data.endTime; |
| 190 | 190 |
| 191 for (var i = 0; i < this._currentViews.length; ++i) | 191 for (var i = 0; i < this._currentViews.length; ++i) |
| 192 this._currentViews[i].setWindowTimes(this._windowStartTime, this._windowEn
dTime); | 192 this._currentViews[i].setWindowTimes(this._windowStartTime, this._windowEn
dTime); |
| 193 | 193 |
| 194 if (!this._selection || this._selection.type() === WebInspector.TimelineSele
ction.Type.Range) | 194 if (!this._selection || this._selection.type() === Timeline.TimelineSelectio
n.Type.Range) |
| 195 this.select(null); | 195 this.select(null); |
| 196 } | 196 } |
| 197 | 197 |
| 198 /** | 198 /** |
| 199 * @param {!WebInspector.Event} event | 199 * @param {!Common.Event} event |
| 200 */ | 200 */ |
| 201 _onOverviewSelectionChanged(event) { | 201 _onOverviewSelectionChanged(event) { |
| 202 var selection = /** @type {!WebInspector.TimelineSelection} */ (event.data); | 202 var selection = /** @type {!Timeline.TimelineSelection} */ (event.data); |
| 203 this.select(selection); | 203 this.select(selection); |
| 204 } | 204 } |
| 205 | 205 |
| 206 /** | 206 /** |
| 207 * @override | 207 * @override |
| 208 * @param {number} windowStartTime | 208 * @param {number} windowStartTime |
| 209 * @param {number} windowEndTime | 209 * @param {number} windowEndTime |
| 210 */ | 210 */ |
| 211 requestWindowTimes(windowStartTime, windowEndTime) { | 211 requestWindowTimes(windowStartTime, windowEndTime) { |
| 212 this._overviewPane.requestWindowTimes(windowStartTime, windowEndTime); | 212 this._overviewPane.requestWindowTimes(windowStartTime, windowEndTime); |
| 213 } | 213 } |
| 214 | 214 |
| 215 /** | 215 /** |
| 216 * @return {!WebInspector.Widget} | 216 * @return {!UI.Widget} |
| 217 */ | 217 */ |
| 218 _layersView() { | 218 _layersView() { |
| 219 if (this._lazyLayersView) | 219 if (this._lazyLayersView) |
| 220 return this._lazyLayersView; | 220 return this._lazyLayersView; |
| 221 this._lazyLayersView = | 221 this._lazyLayersView = |
| 222 new WebInspector.TimelineLayersView(this._model, this._showSnapshotInPai
ntProfiler.bind(this)); | 222 new Timeline.TimelineLayersView(this._model, this._showSnapshotInPaintPr
ofiler.bind(this)); |
| 223 return this._lazyLayersView; | 223 return this._lazyLayersView; |
| 224 } | 224 } |
| 225 | 225 |
| 226 _paintProfilerView() { | 226 _paintProfilerView() { |
| 227 if (this._lazyPaintProfilerView) | 227 if (this._lazyPaintProfilerView) |
| 228 return this._lazyPaintProfilerView; | 228 return this._lazyPaintProfilerView; |
| 229 this._lazyPaintProfilerView = new WebInspector.TimelinePaintProfilerView(thi
s._frameModel); | 229 this._lazyPaintProfilerView = new Timeline.TimelinePaintProfilerView(this._f
rameModel); |
| 230 return this._lazyPaintProfilerView; | 230 return this._lazyPaintProfilerView; |
| 231 } | 231 } |
| 232 | 232 |
| 233 /** | 233 /** |
| 234 * @param {!WebInspector.TimelineModeView} modeView | 234 * @param {!Timeline.TimelineModeView} modeView |
| 235 */ | 235 */ |
| 236 _addModeView(modeView) { | 236 _addModeView(modeView) { |
| 237 modeView.setWindowTimes(this.windowStartTime(), this.windowEndTime()); | 237 modeView.setWindowTimes(this.windowStartTime(), this.windowEndTime()); |
| 238 modeView.refreshRecords(); | 238 modeView.refreshRecords(); |
| 239 var splitWidget = | 239 var splitWidget = |
| 240 this._stackView.appendView(modeView.view(), 'timelinePanelTimelineStackS
plitViewState', undefined, 112); | 240 this._stackView.appendView(modeView.view(), 'timelinePanelTimelineStackS
plitViewState', undefined, 112); |
| 241 var resizer = modeView.resizerElement(); | 241 var resizer = modeView.resizerElement(); |
| 242 if (splitWidget && resizer) { | 242 if (splitWidget && resizer) { |
| 243 splitWidget.hideDefaultResizer(); | 243 splitWidget.hideDefaultResizer(); |
| 244 splitWidget.installResizer(resizer); | 244 splitWidget.installResizer(resizer); |
| 245 } | 245 } |
| 246 this._currentViews.push(modeView); | 246 this._currentViews.push(modeView); |
| 247 } | 247 } |
| 248 | 248 |
| 249 _removeAllModeViews() { | 249 _removeAllModeViews() { |
| 250 this._currentViews.forEach(view => view.dispose()); | 250 this._currentViews.forEach(view => view.dispose()); |
| 251 this._currentViews = []; | 251 this._currentViews = []; |
| 252 this._stackView.detachChildWidgets(); | 252 this._stackView.detachChildWidgets(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 /** | 255 /** |
| 256 * @param {!WebInspector.TimelinePanel.State} state | 256 * @param {!Timeline.TimelinePanel.State} state |
| 257 */ | 257 */ |
| 258 _setState(state) { | 258 _setState(state) { |
| 259 this._state = state; | 259 this._state = state; |
| 260 this._updateTimelineControls(); | 260 this._updateTimelineControls(); |
| 261 } | 261 } |
| 262 | 262 |
| 263 /** | 263 /** |
| 264 * @param {string} name | 264 * @param {string} name |
| 265 * @param {!WebInspector.Setting} setting | 265 * @param {!Common.Setting} setting |
| 266 * @param {string} tooltip | 266 * @param {string} tooltip |
| 267 * @return {!WebInspector.ToolbarItem} | 267 * @return {!UI.ToolbarItem} |
| 268 */ | 268 */ |
| 269 _createSettingCheckbox(name, setting, tooltip) { | 269 _createSettingCheckbox(name, setting, tooltip) { |
| 270 if (!this._recordingOptionUIControls) | 270 if (!this._recordingOptionUIControls) |
| 271 this._recordingOptionUIControls = []; | 271 this._recordingOptionUIControls = []; |
| 272 var checkboxItem = new WebInspector.ToolbarCheckbox(name, tooltip, setting); | 272 var checkboxItem = new UI.ToolbarCheckbox(name, tooltip, setting); |
| 273 this._recordingOptionUIControls.push(checkboxItem); | 273 this._recordingOptionUIControls.push(checkboxItem); |
| 274 return checkboxItem; | 274 return checkboxItem; |
| 275 } | 275 } |
| 276 | 276 |
| 277 _createToolbarItems() { | 277 _createToolbarItems() { |
| 278 this._panelToolbar.removeToolbarItems(); | 278 this._panelToolbar.removeToolbarItems(); |
| 279 | 279 |
| 280 var perspectiveSetting = | 280 var perspectiveSetting = |
| 281 WebInspector.settings.createSetting('timelinePerspective', WebInspector.
TimelinePanel.Perspectives.Load); | 281 Common.settings.createSetting('timelinePerspective', Timeline.TimelinePa
nel.Perspectives.Load); |
| 282 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives')) { | 282 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives')) { |
| 283 /** | 283 /** |
| 284 * @this {!WebInspector.TimelinePanel} | 284 * @this {!Timeline.TimelinePanel} |
| 285 */ | 285 */ |
| 286 function onPerspectiveChanged() { | 286 function onPerspectiveChanged() { |
| 287 perspectiveSetting.set(perspectiveCombobox.selectElement().value); | 287 perspectiveSetting.set(perspectiveCombobox.selectElement().value); |
| 288 this._createToolbarItems(); | 288 this._createToolbarItems(); |
| 289 } | 289 } |
| 290 | 290 |
| 291 /** | 291 /** |
| 292 * @param {string} id | 292 * @param {string} id |
| 293 * @param {string} title | 293 * @param {string} title |
| 294 */ | 294 */ |
| 295 function addPerspectiveOption(id, title) { | 295 function addPerspectiveOption(id, title) { |
| 296 var option = perspectiveCombobox.createOption(title, '', id); | 296 var option = perspectiveCombobox.createOption(title, '', id); |
| 297 perspectiveCombobox.addOption(option); | 297 perspectiveCombobox.addOption(option); |
| 298 if (id === perspectiveSetting.get()) | 298 if (id === perspectiveSetting.get()) |
| 299 perspectiveCombobox.select(option); | 299 perspectiveCombobox.select(option); |
| 300 } | 300 } |
| 301 | 301 |
| 302 var perspectiveCombobox = new WebInspector.ToolbarComboBox(onPerspectiveCh
anged.bind(this)); | 302 var perspectiveCombobox = new UI.ToolbarComboBox(onPerspectiveChanged.bind
(this)); |
| 303 addPerspectiveOption(WebInspector.TimelinePanel.Perspectives.Load, WebInsp
ector.UIString('Page Load')); | 303 addPerspectiveOption(Timeline.TimelinePanel.Perspectives.Load, Common.UISt
ring('Page Load')); |
| 304 addPerspectiveOption( | 304 addPerspectiveOption( |
| 305 WebInspector.TimelinePanel.Perspectives.Responsiveness, WebInspector.U
IString('Responsiveness')); | 305 Timeline.TimelinePanel.Perspectives.Responsiveness, Common.UIString('R
esponsiveness')); |
| 306 addPerspectiveOption(WebInspector.TimelinePanel.Perspectives.Custom, WebIn
spector.UIString('Custom')); | 306 addPerspectiveOption(Timeline.TimelinePanel.Perspectives.Custom, Common.UI
String('Custom')); |
| 307 this._panelToolbar.appendToolbarItem(perspectiveCombobox); | 307 this._panelToolbar.appendToolbarItem(perspectiveCombobox); |
| 308 | 308 |
| 309 switch (perspectiveSetting.get()) { | 309 switch (perspectiveSetting.get()) { |
| 310 case WebInspector.TimelinePanel.Perspectives.Load: | 310 case Timeline.TimelinePanel.Perspectives.Load: |
| 311 this._captureNetworkSetting.set(true); | 311 this._captureNetworkSetting.set(true); |
| 312 this._captureJSProfileSetting.set(true); | 312 this._captureJSProfileSetting.set(true); |
| 313 this._captureMemorySetting.set(false); | 313 this._captureMemorySetting.set(false); |
| 314 this._captureLayersAndPicturesSetting.set(false); | 314 this._captureLayersAndPicturesSetting.set(false); |
| 315 this._captureFilmStripSetting.set(true); | 315 this._captureFilmStripSetting.set(true); |
| 316 break; | 316 break; |
| 317 case WebInspector.TimelinePanel.Perspectives.Responsiveness: | 317 case Timeline.TimelinePanel.Perspectives.Responsiveness: |
| 318 this._captureNetworkSetting.set(true); | 318 this._captureNetworkSetting.set(true); |
| 319 this._captureJSProfileSetting.set(true); | 319 this._captureJSProfileSetting.set(true); |
| 320 this._captureMemorySetting.set(false); | 320 this._captureMemorySetting.set(false); |
| 321 this._captureLayersAndPicturesSetting.set(false); | 321 this._captureLayersAndPicturesSetting.set(false); |
| 322 this._captureFilmStripSetting.set(false); | 322 this._captureFilmStripSetting.set(false); |
| 323 break; | 323 break; |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives') && | 326 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives') && |
| 327 perspectiveSetting.get() === WebInspector.TimelinePanel.Perspectives.Loa
d) { | 327 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Load) { |
| 328 this._reloadButton = | 328 this._reloadButton = |
| 329 new WebInspector.ToolbarButton(WebInspector.UIString('Record & Reload'
), 'largeicon-refresh'); | 329 new UI.ToolbarButton(Common.UIString('Record & Reload'), 'largeicon-re
fresh'); |
| 330 this._reloadButton.addEventListener('click', () => WebInspector.targetMana
ger.reloadPage()); | 330 this._reloadButton.addEventListener('click', () => SDK.targetManager.reloa
dPage()); |
| 331 this._panelToolbar.appendToolbarItem(this._reloadButton); | 331 this._panelToolbar.appendToolbarItem(this._reloadButton); |
| 332 } else { | 332 } else { |
| 333 this._panelToolbar.appendToolbarItem(WebInspector.Toolbar.createActionButt
on(this._toggleRecordAction)); | 333 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t
oggleRecordAction)); |
| 334 } | 334 } |
| 335 | 335 |
| 336 this._updateTimelineControls(); | 336 this._updateTimelineControls(); |
| 337 var clearButton = new WebInspector.ToolbarButton(WebInspector.UIString('Clea
r recording'), 'largeicon-clear'); | 337 var clearButton = new UI.ToolbarButton(Common.UIString('Clear recording'), '
largeicon-clear'); |
| 338 clearButton.addEventListener('click', this._clear, this); | 338 clearButton.addEventListener('click', this._clear, this); |
| 339 this._panelToolbar.appendToolbarItem(clearButton); | 339 this._panelToolbar.appendToolbarItem(clearButton); |
| 340 | 340 |
| 341 this._panelToolbar.appendSeparator(); | 341 this._panelToolbar.appendSeparator(); |
| 342 | 342 |
| 343 this._panelToolbar.appendText(WebInspector.UIString('Capture:')); | 343 this._panelToolbar.appendText(Common.UIString('Capture:')); |
| 344 | 344 |
| 345 var screenshotCheckbox = this._createSettingCheckbox( | 345 var screenshotCheckbox = this._createSettingCheckbox( |
| 346 WebInspector.UIString('Screenshots'), this._captureFilmStripSetting, | 346 Common.UIString('Screenshots'), this._captureFilmStripSetting, |
| 347 WebInspector.UIString('Capture screenshots while recording. (Has small p
erformance overhead)')); | 347 Common.UIString('Capture screenshots while recording. (Has small perform
ance overhead)')); |
| 348 | 348 |
| 349 if (!Runtime.experiments.isEnabled('timelineRecordingPerspectives') || | 349 if (!Runtime.experiments.isEnabled('timelineRecordingPerspectives') || |
| 350 perspectiveSetting.get() === WebInspector.TimelinePanel.Perspectives.Cus
tom) { | 350 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Custom)
{ |
| 351 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 351 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 352 WebInspector.UIString('Network'), this._captureNetworkSetting, | 352 Common.UIString('Network'), this._captureNetworkSetting, |
| 353 WebInspector.UIString('Show network requests information'))); | 353 Common.UIString('Show network requests information'))); |
| 354 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 354 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 355 WebInspector.UIString('JS Profile'), this._captureJSProfileSetting, | 355 Common.UIString('JS Profile'), this._captureJSProfileSetting, |
| 356 WebInspector.UIString('Capture JavaScript stacks with sampling profile
r. (Has small performance overhead)'))); | 356 Common.UIString('Capture JavaScript stacks with sampling profiler. (Ha
s small performance overhead)'))); |
| 357 this._panelToolbar.appendToolbarItem(screenshotCheckbox); | 357 this._panelToolbar.appendToolbarItem(screenshotCheckbox); |
| 358 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 358 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 359 WebInspector.UIString('Memory'), this._captureMemorySetting, | 359 Common.UIString('Memory'), this._captureMemorySetting, |
| 360 WebInspector.UIString('Capture memory information on every timeline ev
ent.'))); | 360 Common.UIString('Capture memory information on every timeline event.')
)); |
| 361 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 361 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 362 WebInspector.UIString('Paint'), this._captureLayersAndPicturesSetting, | 362 Common.UIString('Paint'), this._captureLayersAndPicturesSetting, |
| 363 WebInspector.UIString( | 363 Common.UIString( |
| 364 'Capture graphics layer positions and rasterization draw calls. (H
as large performance overhead)'))); | 364 'Capture graphics layer positions and rasterization draw calls. (H
as large performance overhead)'))); |
| 365 } else { | 365 } else { |
| 366 this._panelToolbar.appendToolbarItem(screenshotCheckbox); | 366 this._panelToolbar.appendToolbarItem(screenshotCheckbox); |
| 367 } | 367 } |
| 368 | 368 |
| 369 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) { | 369 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) { |
| 370 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 370 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 371 WebInspector.UIString('CSS coverage'), this._markUnusedCSS, | 371 Common.UIString('CSS coverage'), this._markUnusedCSS, |
| 372 WebInspector.UIString('Mark unused CSS in souces.'))); | 372 Common.UIString('Mark unused CSS in souces.'))); |
| 373 } | 373 } |
| 374 | 374 |
| 375 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, this); | 375 this._captureNetworkSetting.addChangeListener(this._onNetworkChanged, this); |
| 376 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); | 376 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); |
| 377 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this); | 377 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this); |
| 378 | 378 |
| 379 this._panelToolbar.appendSeparator(); | 379 this._panelToolbar.appendSeparator(); |
| 380 var garbageCollectButton = | 380 var garbageCollectButton = |
| 381 new WebInspector.ToolbarButton(WebInspector.UIString('Collect garbage'),
'largeicon-trash-bin'); | 381 new UI.ToolbarButton(Common.UIString('Collect garbage'), 'largeicon-tras
h-bin'); |
| 382 garbageCollectButton.addEventListener('click', this._garbageCollectButtonCli
cked, this); | 382 garbageCollectButton.addEventListener('click', this._garbageCollectButtonCli
cked, this); |
| 383 this._panelToolbar.appendToolbarItem(garbageCollectButton); | 383 this._panelToolbar.appendToolbarItem(garbageCollectButton); |
| 384 | 384 |
| 385 this._panelToolbar.appendSeparator(); | 385 this._panelToolbar.appendSeparator(); |
| 386 this._cpuThrottlingCombobox = new WebInspector.ToolbarComboBox(this._onCPUTh
rottlingChanged.bind(this)); | 386 this._cpuThrottlingCombobox = new UI.ToolbarComboBox(this._onCPUThrottlingCh
anged.bind(this)); |
| 387 this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox); | 387 this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox); |
| 388 this._populateCPUThrottingCombobox(); | 388 this._populateCPUThrottingCombobox(); |
| 389 } | 389 } |
| 390 | 390 |
| 391 _populateCPUThrottingCombobox() { | 391 _populateCPUThrottingCombobox() { |
| 392 var cpuThrottlingCombobox = this._cpuThrottlingCombobox; | 392 var cpuThrottlingCombobox = this._cpuThrottlingCombobox; |
| 393 cpuThrottlingCombobox.removeOptions(); | 393 cpuThrottlingCombobox.removeOptions(); |
| 394 var currentRate = this._cpuThrottlingManager.rate(); | 394 var currentRate = this._cpuThrottlingManager.rate(); |
| 395 var hasSelection = false; | 395 var hasSelection = false; |
| 396 /** | 396 /** |
| 397 * @param {string} name | 397 * @param {string} name |
| 398 * @param {number} value | 398 * @param {number} value |
| 399 */ | 399 */ |
| 400 function addGroupingOption(name, value) { | 400 function addGroupingOption(name, value) { |
| 401 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); | 401 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); |
| 402 cpuThrottlingCombobox.addOption(option); | 402 cpuThrottlingCombobox.addOption(option); |
| 403 if (hasSelection || (value && value !== currentRate)) | 403 if (hasSelection || (value && value !== currentRate)) |
| 404 return; | 404 return; |
| 405 cpuThrottlingCombobox.select(option); | 405 cpuThrottlingCombobox.select(option); |
| 406 hasSelection = true; | 406 hasSelection = true; |
| 407 } | 407 } |
| 408 var predefinedRates = new Map([ | 408 var predefinedRates = new Map([ |
| 409 [1, WebInspector.UIString('No CPU throttling')], [2, WebInspector.UIString
('High end device (2\xD7 slowdown)')], | 409 [1, Common.UIString('No CPU throttling')], [2, Common.UIString('High end d
evice (2\xD7 slowdown)')], |
| 410 [5, WebInspector.UIString('Low end device (5\xD7 slowdown)')] | 410 [5, Common.UIString('Low end device (5\xD7 slowdown)')] |
| 411 ]); | 411 ]); |
| 412 for (var rate of predefinedRates) | 412 for (var rate of predefinedRates) |
| 413 addGroupingOption(rate[1], rate[0]); | 413 addGroupingOption(rate[1], rate[0]); |
| 414 if (this._customCPUThrottlingRate && !predefinedRates.has(this._customCPUThr
ottlingRate)) | 414 if (this._customCPUThrottlingRate && !predefinedRates.has(this._customCPUThr
ottlingRate)) |
| 415 addGroupingOption( | 415 addGroupingOption( |
| 416 WebInspector.UIString('Custom rate (%d\xD7 slowdown)', this._customCPU
ThrottlingRate), | 416 Common.UIString('Custom rate (%d\xD7 slowdown)', this._customCPUThrott
lingRate), |
| 417 this._customCPUThrottlingRate); | 417 this._customCPUThrottlingRate); |
| 418 addGroupingOption(WebInspector.UIString('Set custom rate\u2026'), 0); | 418 addGroupingOption(Common.UIString('Set custom rate\u2026'), 0); |
| 419 } | 419 } |
| 420 | 420 |
| 421 _prepareToLoadTimeline() { | 421 _prepareToLoadTimeline() { |
| 422 console.assert(this._state === WebInspector.TimelinePanel.State.Idle); | 422 console.assert(this._state === Timeline.TimelinePanel.State.Idle); |
| 423 this._setState(WebInspector.TimelinePanel.State.Loading); | 423 this._setState(Timeline.TimelinePanel.State.Loading); |
| 424 } | 424 } |
| 425 | 425 |
| 426 _createFileSelector() { | 426 _createFileSelector() { |
| 427 if (this._fileSelectorElement) | 427 if (this._fileSelectorElement) |
| 428 this._fileSelectorElement.remove(); | 428 this._fileSelectorElement.remove(); |
| 429 this._fileSelectorElement = WebInspector.createFileSelectorElement(this._loa
dFromFile.bind(this)); | 429 this._fileSelectorElement = Bindings.createFileSelectorElement(this._loadFro
mFile.bind(this)); |
| 430 this.element.appendChild(this._fileSelectorElement); | 430 this.element.appendChild(this._fileSelectorElement); |
| 431 } | 431 } |
| 432 | 432 |
| 433 /** | 433 /** |
| 434 * @param {!Event} event | 434 * @param {!Event} event |
| 435 */ | 435 */ |
| 436 _contextMenu(event) { | 436 _contextMenu(event) { |
| 437 var contextMenu = new WebInspector.ContextMenu(event); | 437 var contextMenu = new UI.ContextMenu(event); |
| 438 contextMenu.appendItemsAtLocation('timelineMenu'); | 438 contextMenu.appendItemsAtLocation('timelineMenu'); |
| 439 contextMenu.show(); | 439 contextMenu.show(); |
| 440 } | 440 } |
| 441 | 441 |
| 442 /** | 442 /** |
| 443 * @return {boolean} | 443 * @return {boolean} |
| 444 */ | 444 */ |
| 445 _saveToFile() { | 445 _saveToFile() { |
| 446 if (this._state !== WebInspector.TimelinePanel.State.Idle) | 446 if (this._state !== Timeline.TimelinePanel.State.Idle) |
| 447 return true; | 447 return true; |
| 448 if (this._model.isEmpty()) | 448 if (this._model.isEmpty()) |
| 449 return true; | 449 return true; |
| 450 | 450 |
| 451 var now = new Date(); | 451 var now = new Date(); |
| 452 var fileName = 'TimelineRawData-' + now.toISO8601Compact() + '.json'; | 452 var fileName = 'TimelineRawData-' + now.toISO8601Compact() + '.json'; |
| 453 var stream = new WebInspector.FileOutputStream(); | 453 var stream = new Bindings.FileOutputStream(); |
| 454 | 454 |
| 455 /** | 455 /** |
| 456 * @param {boolean} accepted | 456 * @param {boolean} accepted |
| 457 * @this {WebInspector.TimelinePanel} | 457 * @this {Timeline.TimelinePanel} |
| 458 */ | 458 */ |
| 459 function callback(accepted) { | 459 function callback(accepted) { |
| 460 if (!accepted) | 460 if (!accepted) |
| 461 return; | 461 return; |
| 462 var saver = new WebInspector.TracingTimelineSaver(); | 462 var saver = new Timeline.TracingTimelineSaver(); |
| 463 this._tracingModelBackingStorage.writeToStream(stream, saver); | 463 this._tracingModelBackingStorage.writeToStream(stream, saver); |
| 464 } | 464 } |
| 465 stream.open(fileName, callback.bind(this)); | 465 stream.open(fileName, callback.bind(this)); |
| 466 return true; | 466 return true; |
| 467 } | 467 } |
| 468 | 468 |
| 469 /** | 469 /** |
| 470 * @return {boolean} | 470 * @return {boolean} |
| 471 */ | 471 */ |
| 472 _selectFileToLoad() { | 472 _selectFileToLoad() { |
| 473 this._fileSelectorElement.click(); | 473 this._fileSelectorElement.click(); |
| 474 return true; | 474 return true; |
| 475 } | 475 } |
| 476 | 476 |
| 477 /** | 477 /** |
| 478 * @param {!File} file | 478 * @param {!File} file |
| 479 */ | 479 */ |
| 480 _loadFromFile(file) { | 480 _loadFromFile(file) { |
| 481 if (this._state !== WebInspector.TimelinePanel.State.Idle) | 481 if (this._state !== Timeline.TimelinePanel.State.Idle) |
| 482 return; | 482 return; |
| 483 this._prepareToLoadTimeline(); | 483 this._prepareToLoadTimeline(); |
| 484 this._loader = WebInspector.TimelineLoader.loadFromFile(this._tracingModel,
file, this); | 484 this._loader = Timeline.TimelineLoader.loadFromFile(this._tracingModel, file
, this); |
| 485 this._createFileSelector(); | 485 this._createFileSelector(); |
| 486 } | 486 } |
| 487 | 487 |
| 488 /** | 488 /** |
| 489 * @param {string} url | 489 * @param {string} url |
| 490 */ | 490 */ |
| 491 _loadFromURL(url) { | 491 _loadFromURL(url) { |
| 492 if (this._state !== WebInspector.TimelinePanel.State.Idle) | 492 if (this._state !== Timeline.TimelinePanel.State.Idle) |
| 493 return; | 493 return; |
| 494 this._prepareToLoadTimeline(); | 494 this._prepareToLoadTimeline(); |
| 495 this._loader = WebInspector.TimelineLoader.loadFromURL(this._tracingModel, u
rl, this); | 495 this._loader = Timeline.TimelineLoader.loadFromURL(this._tracingModel, url,
this); |
| 496 } | 496 } |
| 497 | 497 |
| 498 _refreshViews() { | 498 _refreshViews() { |
| 499 for (var i = 0; i < this._currentViews.length; ++i) { | 499 for (var i = 0; i < this._currentViews.length; ++i) { |
| 500 var view = this._currentViews[i]; | 500 var view = this._currentViews[i]; |
| 501 view.refreshRecords(); | 501 view.refreshRecords(); |
| 502 } | 502 } |
| 503 this._updateSelectionDetails(); | 503 this._updateSelectionDetails(); |
| 504 } | 504 } |
| 505 | 505 |
| 506 _onModeChanged() { | 506 _onModeChanged() { |
| 507 // Set up overview controls. | 507 // Set up overview controls. |
| 508 this._overviewControls = []; | 508 this._overviewControls = []; |
| 509 this._overviewControls.push(new WebInspector.TimelineEventOverviewResponsive
ness(this._model, this._frameModel)); | 509 this._overviewControls.push(new Timeline.TimelineEventOverviewResponsiveness
(this._model, this._frameModel)); |
| 510 if (Runtime.experiments.isEnabled('inputEventsOnTimelineOverview')) | 510 if (Runtime.experiments.isEnabled('inputEventsOnTimelineOverview')) |
| 511 this._overviewControls.push(new WebInspector.TimelineEventOverviewInput(th
is._model)); | 511 this._overviewControls.push(new Timeline.TimelineEventOverviewInput(this._
model)); |
| 512 this._overviewControls.push(new WebInspector.TimelineEventOverviewFrames(thi
s._model, this._frameModel)); | 512 this._overviewControls.push(new Timeline.TimelineEventOverviewFrames(this._m
odel, this._frameModel)); |
| 513 this._overviewControls.push(new WebInspector.TimelineEventOverviewCPUActivit
y(this._model)); | 513 this._overviewControls.push(new Timeline.TimelineEventOverviewCPUActivity(th
is._model)); |
| 514 this._overviewControls.push(new WebInspector.TimelineEventOverviewNetwork(th
is._model)); | 514 this._overviewControls.push(new Timeline.TimelineEventOverviewNetwork(this._
model)); |
| 515 if (this._captureFilmStripSetting.get()) | 515 if (this._captureFilmStripSetting.get()) |
| 516 this._overviewControls.push(new WebInspector.TimelineFilmStripOverview(thi
s._model, this._filmStripModel)); | 516 this._overviewControls.push(new Timeline.TimelineFilmStripOverview(this._m
odel, this._filmStripModel)); |
| 517 if (this._captureMemorySetting.get()) | 517 if (this._captureMemorySetting.get()) |
| 518 this._overviewControls.push(new WebInspector.TimelineEventOverviewMemory(t
his._model)); | 518 this._overviewControls.push(new Timeline.TimelineEventOverviewMemory(this.
_model)); |
| 519 this._overviewPane.setOverviewControls(this._overviewControls); | 519 this._overviewPane.setOverviewControls(this._overviewControls); |
| 520 | 520 |
| 521 // Set up the main view. | 521 // Set up the main view. |
| 522 this._removeAllModeViews(); | 522 this._removeAllModeViews(); |
| 523 this._flameChart = | 523 this._flameChart = |
| 524 new WebInspector.TimelineFlameChartView(this, this._model, this._frameMo
del, this._irModel, this._filters); | 524 new Timeline.TimelineFlameChartView(this, this._model, this._frameModel,
this._irModel, this._filters); |
| 525 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get()); | 525 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get()); |
| 526 this._addModeView(this._flameChart); | 526 this._addModeView(this._flameChart); |
| 527 | 527 |
| 528 if (this._captureMemorySetting.get()) | 528 if (this._captureMemorySetting.get()) |
| 529 this._addModeView(new WebInspector.MemoryCountersGraph( | 529 this._addModeView(new Timeline.MemoryCountersGraph( |
| 530 this, this._model, [WebInspector.TimelineUIUtils.visibleEventsFilter()
])); | 530 this, this._model, [Timeline.TimelineUIUtils.visibleEventsFilter()])); |
| 531 | 531 |
| 532 this.doResize(); | 532 this.doResize(); |
| 533 this.select(null); | 533 this.select(null); |
| 534 } | 534 } |
| 535 | 535 |
| 536 _onNetworkChanged() { | 536 _onNetworkChanged() { |
| 537 if (this._flameChart) | 537 if (this._flameChart) |
| 538 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get(), true
); | 538 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get(), true
); |
| 539 } | 539 } |
| 540 | 540 |
| 541 _onCPUThrottlingChanged() { | 541 _onCPUThrottlingChanged() { |
| 542 if (!this._cpuThrottlingManager) | 542 if (!this._cpuThrottlingManager) |
| 543 return; | 543 return; |
| 544 var value = this._cpuThrottlingCombobox.selectedOption().value; | 544 var value = this._cpuThrottlingCombobox.selectedOption().value; |
| 545 var isLastOption = this._cpuThrottlingCombobox.selectedIndex() === this._cpu
ThrottlingCombobox.size() - 1; | 545 var isLastOption = this._cpuThrottlingCombobox.selectedIndex() === this._cpu
ThrottlingCombobox.size() - 1; |
| 546 this._populateCPUThrottingCombobox(); | 546 this._populateCPUThrottingCombobox(); |
| 547 var resultPromise = isLastOption ? | 547 var resultPromise = isLastOption ? |
| 548 WebInspector.TimelinePanel.CustomCPUThrottlingRateDialog.show(this._cpuT
hrottlingCombobox.element) : | 548 Timeline.TimelinePanel.CustomCPUThrottlingRateDialog.show(this._cpuThrot
tlingCombobox.element) : |
| 549 Promise.resolve(value); | 549 Promise.resolve(value); |
| 550 resultPromise.then(text => { | 550 resultPromise.then(text => { |
| 551 var value = Number.parseFloat(text); | 551 var value = Number.parseFloat(text); |
| 552 if (value >= 1) { | 552 if (value >= 1) { |
| 553 if (isLastOption) | 553 if (isLastOption) |
| 554 this._customCPUThrottlingRate = value; | 554 this._customCPUThrottlingRate = value; |
| 555 this._cpuThrottlingManager.setRate(value); | 555 this._cpuThrottlingManager.setRate(value); |
| 556 this._populateCPUThrottingCombobox(); | 556 this._populateCPUThrottingCombobox(); |
| 557 } | 557 } |
| 558 }); | 558 }); |
| 559 } | 559 } |
| 560 | 560 |
| 561 /** | 561 /** |
| 562 * @param {boolean} enabled | 562 * @param {boolean} enabled |
| 563 */ | 563 */ |
| 564 _setUIControlsEnabled(enabled) { | 564 _setUIControlsEnabled(enabled) { |
| 565 /** | 565 /** |
| 566 * @param {!WebInspector.ToolbarButton} toolbarButton | 566 * @param {!UI.ToolbarButton} toolbarButton |
| 567 */ | 567 */ |
| 568 function handler(toolbarButton) { | 568 function handler(toolbarButton) { |
| 569 toolbarButton.setEnabled(enabled); | 569 toolbarButton.setEnabled(enabled); |
| 570 } | 570 } |
| 571 this._recordingOptionUIControls.forEach(handler); | 571 this._recordingOptionUIControls.forEach(handler); |
| 572 } | 572 } |
| 573 | 573 |
| 574 /** | 574 /** |
| 575 * @param {boolean} userInitiated | 575 * @param {boolean} userInitiated |
| 576 */ | 576 */ |
| 577 _startRecording(userInitiated) { | 577 _startRecording(userInitiated) { |
| 578 console.assert(!this._statusPane, 'Status pane is already opened.'); | 578 console.assert(!this._statusPane, 'Status pane is already opened.'); |
| 579 var mainTarget = WebInspector.targetManager.mainTarget(); | 579 var mainTarget = SDK.targetManager.mainTarget(); |
| 580 if (!mainTarget) | 580 if (!mainTarget) |
| 581 return; | 581 return; |
| 582 this._setState(WebInspector.TimelinePanel.State.StartPending); | 582 this._setState(Timeline.TimelinePanel.State.StartPending); |
| 583 this._showRecordingStarted(); | 583 this._showRecordingStarted(); |
| 584 | 584 |
| 585 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar
kUnusedCSS.get()) | 585 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar
kUnusedCSS.get()) |
| 586 WebInspector.CSSModel.fromTarget(mainTarget).startRuleUsageTracking(); | 586 SDK.CSSModel.fromTarget(mainTarget).startRuleUsageTracking(); |
| 587 | 587 |
| 588 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); | 588 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); |
| 589 this._controller = new WebInspector.TimelineController(mainTarget, this, thi
s._tracingModel); | 589 this._controller = new Timeline.TimelineController(mainTarget, this, this._t
racingModel); |
| 590 this._controller.startRecording( | 590 this._controller.startRecording( |
| 591 true, this._captureJSProfileSetting.get(), this._captureMemorySetting.ge
t(), | 591 true, this._captureJSProfileSetting.get(), this._captureMemorySetting.ge
t(), |
| 592 this._captureLayersAndPicturesSetting.get(), | 592 this._captureLayersAndPicturesSetting.get(), |
| 593 this._captureFilmStripSetting && this._captureFilmStripSetting.get()); | 593 this._captureFilmStripSetting && this._captureFilmStripSetting.get()); |
| 594 | 594 |
| 595 for (var i = 0; i < this._overviewControls.length; ++i) | 595 for (var i = 0; i < this._overviewControls.length; ++i) |
| 596 this._overviewControls[i].timelineStarted(); | 596 this._overviewControls[i].timelineStarted(); |
| 597 | 597 |
| 598 if (userInitiated) | 598 if (userInitiated) |
| 599 WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.Timel
ineStarted); | 599 Host.userMetrics.actionTaken(Host.UserMetrics.Action.TimelineStarted); |
| 600 this._setUIControlsEnabled(false); | 600 this._setUIControlsEnabled(false); |
| 601 this._hideRecordingHelpMessage(); | 601 this._hideRecordingHelpMessage(); |
| 602 } | 602 } |
| 603 | 603 |
| 604 _stopRecording() { | 604 _stopRecording() { |
| 605 if (this._statusPane) { | 605 if (this._statusPane) { |
| 606 this._statusPane.finish(); | 606 this._statusPane.finish(); |
| 607 this._statusPane.updateStatus(WebInspector.UIString('Stopping timeline\u20
26')); | 607 this._statusPane.updateStatus(Common.UIString('Stopping timeline\u2026')); |
| 608 this._statusPane.updateProgressBar(WebInspector.UIString('Received'), 0); | 608 this._statusPane.updateProgressBar(Common.UIString('Received'), 0); |
| 609 } | 609 } |
| 610 this._setState(WebInspector.TimelinePanel.State.StopPending); | 610 this._setState(Timeline.TimelinePanel.State.StopPending); |
| 611 this._autoRecordGeneration = null; | 611 this._autoRecordGeneration = null; |
| 612 this._controller.stopRecording(); | 612 this._controller.stopRecording(); |
| 613 this._controller = null; | 613 this._controller = null; |
| 614 this._setUIControlsEnabled(true); | 614 this._setUIControlsEnabled(true); |
| 615 } | 615 } |
| 616 | 616 |
| 617 _onSuspendStateChanged() { | 617 _onSuspendStateChanged() { |
| 618 this._updateTimelineControls(); | 618 this._updateTimelineControls(); |
| 619 } | 619 } |
| 620 | 620 |
| 621 _updateTimelineControls() { | 621 _updateTimelineControls() { |
| 622 var state = WebInspector.TimelinePanel.State; | 622 var state = Timeline.TimelinePanel.State; |
| 623 this._toggleRecordAction.setToggled(this._state === state.Recording); | 623 this._toggleRecordAction.setToggled(this._state === state.Recording); |
| 624 this._toggleRecordAction.setEnabled(this._state === state.Recording || this.
_state === state.Idle); | 624 this._toggleRecordAction.setEnabled(this._state === state.Recording || this.
_state === state.Idle); |
| 625 this._panelToolbar.setEnabled(this._state !== state.Loading); | 625 this._panelToolbar.setEnabled(this._state !== state.Loading); |
| 626 this._dropTarget.setEnabled(this._state === state.Idle); | 626 this._dropTarget.setEnabled(this._state === state.Idle); |
| 627 } | 627 } |
| 628 | 628 |
| 629 _toggleRecording() { | 629 _toggleRecording() { |
| 630 if (this._state === WebInspector.TimelinePanel.State.Idle) | 630 if (this._state === Timeline.TimelinePanel.State.Idle) |
| 631 this._startRecording(true); | 631 this._startRecording(true); |
| 632 else if (this._state === WebInspector.TimelinePanel.State.Recording) | 632 else if (this._state === Timeline.TimelinePanel.State.Recording) |
| 633 this._stopRecording(); | 633 this._stopRecording(); |
| 634 } | 634 } |
| 635 | 635 |
| 636 _garbageCollectButtonClicked() { | 636 _garbageCollectButtonClicked() { |
| 637 var targets = WebInspector.targetManager.targets(); | 637 var targets = SDK.targetManager.targets(); |
| 638 for (var i = 0; i < targets.length; ++i) | 638 for (var i = 0; i < targets.length; ++i) |
| 639 targets[i].heapProfilerAgent().collectGarbage(); | 639 targets[i].heapProfilerAgent().collectGarbage(); |
| 640 } | 640 } |
| 641 | 641 |
| 642 _clear() { | 642 _clear() { |
| 643 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar
kUnusedCSS.get()) | 643 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar
kUnusedCSS.get()) |
| 644 WebInspector.CoverageProfile.instance().reset(); | 644 Components.CoverageProfile.instance().reset(); |
| 645 | 645 |
| 646 WebInspector.LineLevelProfile.instance().reset(); | 646 Components.LineLevelProfile.instance().reset(); |
| 647 this._tracingModel.reset(); | 647 this._tracingModel.reset(); |
| 648 this._model.reset(); | 648 this._model.reset(); |
| 649 this._showRecordingHelpMessage(); | 649 this._showRecordingHelpMessage(); |
| 650 | 650 |
| 651 this.requestWindowTimes(0, Infinity); | 651 this.requestWindowTimes(0, Infinity); |
| 652 delete this._selection; | 652 delete this._selection; |
| 653 this._frameModel.reset(); | 653 this._frameModel.reset(); |
| 654 this._filmStripModel.reset(this._tracingModel); | 654 this._filmStripModel.reset(this._tracingModel); |
| 655 this._overviewPane.reset(); | 655 this._overviewPane.reset(); |
| 656 for (var i = 0; i < this._currentViews.length; ++i) | 656 for (var i = 0; i < this._currentViews.length; ++i) |
| 657 this._currentViews[i].reset(); | 657 this._currentViews[i].reset(); |
| 658 for (var i = 0; i < this._overviewControls.length; ++i) | 658 for (var i = 0; i < this._overviewControls.length; ++i) |
| 659 this._overviewControls[i].reset(); | 659 this._overviewControls[i].reset(); |
| 660 this.select(null); | 660 this.select(null); |
| 661 this._detailsSplitWidget.hideSidebar(); | 661 this._detailsSplitWidget.hideSidebar(); |
| 662 } | 662 } |
| 663 | 663 |
| 664 /** | 664 /** |
| 665 * @override | 665 * @override |
| 666 */ | 666 */ |
| 667 recordingStarted() { | 667 recordingStarted() { |
| 668 this._clear(); | 668 this._clear(); |
| 669 this._setState(WebInspector.TimelinePanel.State.Recording); | 669 this._setState(Timeline.TimelinePanel.State.Recording); |
| 670 this._showRecordingStarted(); | 670 this._showRecordingStarted(); |
| 671 this._statusPane.updateStatus(WebInspector.UIString('Recording\u2026')); | 671 this._statusPane.updateStatus(Common.UIString('Recording\u2026')); |
| 672 this._statusPane.updateProgressBar(WebInspector.UIString('Buffer usage'), 0)
; | 672 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), 0); |
| 673 this._statusPane.startTimer(); | 673 this._statusPane.startTimer(); |
| 674 this._hideRecordingHelpMessage(); | 674 this._hideRecordingHelpMessage(); |
| 675 } | 675 } |
| 676 | 676 |
| 677 /** | 677 /** |
| 678 * @override | 678 * @override |
| 679 * @param {number} usage | 679 * @param {number} usage |
| 680 */ | 680 */ |
| 681 recordingProgress(usage) { | 681 recordingProgress(usage) { |
| 682 this._statusPane.updateProgressBar(WebInspector.UIString('Buffer usage'), us
age * 100); | 682 this._statusPane.updateProgressBar(Common.UIString('Buffer usage'), usage *
100); |
| 683 } | 683 } |
| 684 | 684 |
| 685 _showRecordingHelpMessage() { | 685 _showRecordingHelpMessage() { |
| 686 /** | 686 /** |
| 687 * @param {string} tagName | 687 * @param {string} tagName |
| 688 * @param {string} contents | 688 * @param {string} contents |
| 689 * @return {!Element} | 689 * @return {!Element} |
| 690 */ | 690 */ |
| 691 function encloseWithTag(tagName, contents) { | 691 function encloseWithTag(tagName, contents) { |
| 692 var e = createElement(tagName); | 692 var e = createElement(tagName); |
| 693 e.textContent = contents; | 693 e.textContent = contents; |
| 694 return e; | 694 return e; |
| 695 } | 695 } |
| 696 | 696 |
| 697 var recordNode = encloseWithTag( | 697 var recordNode = encloseWithTag( |
| 698 'b', WebInspector.shortcutRegistry.shortcutDescriptorsForAction('timelin
e.toggle-recording')[0].name); | 698 'b', UI.shortcutRegistry.shortcutDescriptorsForAction('timeline.toggle-r
ecording')[0].name); |
| 699 var reloadNode = | 699 var reloadNode = |
| 700 encloseWithTag('b', WebInspector.shortcutRegistry.shortcutDescriptorsFor
Action('main.reload')[0].name); | 700 encloseWithTag('b', UI.shortcutRegistry.shortcutDescriptorsForAction('ma
in.reload')[0].name); |
| 701 var navigateNode = encloseWithTag('b', WebInspector.UIString('WASD (ZQSD)'))
; | 701 var navigateNode = encloseWithTag('b', Common.UIString('WASD (ZQSD)')); |
| 702 var hintText = createElementWithClass('div'); | 702 var hintText = createElementWithClass('div'); |
| 703 hintText.appendChild(WebInspector.formatLocalized( | 703 hintText.appendChild(UI.formatLocalized( |
| 704 'To capture a new timeline, click the record toolbar button or hit %s.',
[recordNode])); | 704 'To capture a new timeline, click the record toolbar button or hit %s.',
[recordNode])); |
| 705 hintText.createChild('br'); | 705 hintText.createChild('br'); |
| 706 hintText.appendChild( | 706 hintText.appendChild( |
| 707 WebInspector.formatLocalized('To evaluate page load performance, hit %s
to record the reload.', [reloadNode])); | 707 UI.formatLocalized('To evaluate page load performance, hit %s to record
the reload.', [reloadNode])); |
| 708 hintText.createChild('p'); | 708 hintText.createChild('p'); |
| 709 hintText.appendChild( | 709 hintText.appendChild( |
| 710 WebInspector.formatLocalized('After recording, select an area of interes
t in the overview by dragging.', [])); | 710 UI.formatLocalized('After recording, select an area of interest in the o
verview by dragging.', [])); |
| 711 hintText.createChild('br'); | 711 hintText.createChild('br'); |
| 712 hintText.appendChild(WebInspector.formatLocalized( | 712 hintText.appendChild(UI.formatLocalized( |
| 713 'Then, zoom and pan the timeline with the mousewheel and %s keys.', [nav
igateNode])); | 713 'Then, zoom and pan the timeline with the mousewheel and %s keys.', [nav
igateNode])); |
| 714 this._hideRecordingHelpMessage(); | 714 this._hideRecordingHelpMessage(); |
| 715 this._helpMessageElement = | 715 this._helpMessageElement = |
| 716 this._searchableView.element.createChild('div', 'full-widget-dimmed-bann
er timeline-status-pane'); | 716 this._searchableView.element.createChild('div', 'full-widget-dimmed-bann
er timeline-status-pane'); |
| 717 this._helpMessageElement.appendChild(hintText); | 717 this._helpMessageElement.appendChild(hintText); |
| 718 } | 718 } |
| 719 | 719 |
| 720 _hideRecordingHelpMessage() { | 720 _hideRecordingHelpMessage() { |
| 721 if (this._helpMessageElement) | 721 if (this._helpMessageElement) |
| 722 this._helpMessageElement.remove(); | 722 this._helpMessageElement.remove(); |
| 723 delete this._helpMessageElement; | 723 delete this._helpMessageElement; |
| 724 } | 724 } |
| 725 | 725 |
| 726 /** | 726 /** |
| 727 * @override | 727 * @override |
| 728 */ | 728 */ |
| 729 loadingStarted() { | 729 loadingStarted() { |
| 730 this._hideRecordingHelpMessage(); | 730 this._hideRecordingHelpMessage(); |
| 731 | 731 |
| 732 if (this._statusPane) | 732 if (this._statusPane) |
| 733 this._statusPane.hide(); | 733 this._statusPane.hide(); |
| 734 this._statusPane = new WebInspector.TimelinePanel.StatusPane(false, this._ca
ncelLoading.bind(this)); | 734 this._statusPane = new Timeline.TimelinePanel.StatusPane(false, this._cancel
Loading.bind(this)); |
| 735 this._statusPane.showPane(this._statusPaneContainer); | 735 this._statusPane.showPane(this._statusPaneContainer); |
| 736 this._statusPane.updateStatus(WebInspector.UIString('Loading timeline\u2026'
)); | 736 this._statusPane.updateStatus(Common.UIString('Loading timeline\u2026')); |
| 737 // FIXME: make loading from backend cancelable as well. | 737 // FIXME: make loading from backend cancelable as well. |
| 738 if (!this._loader) | 738 if (!this._loader) |
| 739 this._statusPane.finish(); | 739 this._statusPane.finish(); |
| 740 this.loadingProgress(0); | 740 this.loadingProgress(0); |
| 741 } | 741 } |
| 742 | 742 |
| 743 /** | 743 /** |
| 744 * @override | 744 * @override |
| 745 * @param {number=} progress | 745 * @param {number=} progress |
| 746 */ | 746 */ |
| 747 loadingProgress(progress) { | 747 loadingProgress(progress) { |
| 748 if (typeof progress === 'number') | 748 if (typeof progress === 'number') |
| 749 this._statusPane.updateProgressBar(WebInspector.UIString('Received'), prog
ress * 100); | 749 this._statusPane.updateProgressBar(Common.UIString('Received'), progress *
100); |
| 750 } | 750 } |
| 751 | 751 |
| 752 /** | 752 /** |
| 753 * @override | 753 * @override |
| 754 * @param {boolean} success | 754 * @param {boolean} success |
| 755 */ | 755 */ |
| 756 loadingComplete(success) { | 756 loadingComplete(success) { |
| 757 var loadedFromFile = !!this._loader; | 757 var loadedFromFile = !!this._loader; |
| 758 delete this._loader; | 758 delete this._loader; |
| 759 this._setState(WebInspector.TimelinePanel.State.Idle); | 759 this._setState(Timeline.TimelinePanel.State.Idle); |
| 760 | 760 |
| 761 if (!success) { | 761 if (!success) { |
| 762 this._statusPane.hide(); | 762 this._statusPane.hide(); |
| 763 delete this._statusPane; | 763 delete this._statusPane; |
| 764 this._clear(); | 764 this._clear(); |
| 765 return; | 765 return; |
| 766 } | 766 } |
| 767 | 767 |
| 768 if (this._statusPane) | 768 if (this._statusPane) |
| 769 this._statusPane.updateStatus(WebInspector.UIString('Processing timeline\u
2026')); | 769 this._statusPane.updateStatus(Common.UIString('Processing timeline\u2026')
); |
| 770 this._model.setEvents(this._tracingModel, loadedFromFile); | 770 this._model.setEvents(this._tracingModel, loadedFromFile); |
| 771 this._frameModel.reset(); | 771 this._frameModel.reset(); |
| 772 this._frameModel.addTraceEvents( | 772 this._frameModel.addTraceEvents( |
| 773 WebInspector.targetManager.mainTarget(), this._model.inspectedTargetEven
ts(), this._model.sessionId() || ''); | 773 SDK.targetManager.mainTarget(), this._model.inspectedTargetEvents(), thi
s._model.sessionId() || ''); |
| 774 this._filmStripModel.reset(this._tracingModel); | 774 this._filmStripModel.reset(this._tracingModel); |
| 775 var groups = WebInspector.TimelineModel.AsyncEventGroup; | 775 var groups = TimelineModel.TimelineModel.AsyncEventGroup; |
| 776 var asyncEventsByGroup = this._model.mainThreadAsyncEvents(); | 776 var asyncEventsByGroup = this._model.mainThreadAsyncEvents(); |
| 777 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEventsByGr
oup.get(groups.animation)); | 777 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEventsByGr
oup.get(groups.animation)); |
| 778 this._model.cpuProfiles().forEach(profile => WebInspector.LineLevelProfile.i
nstance().appendCPUProfile(profile)); | 778 this._model.cpuProfiles().forEach(profile => Components.LineLevelProfile.ins
tance().appendCPUProfile(profile)); |
| 779 if (this._statusPane) | 779 if (this._statusPane) |
| 780 this._statusPane.hide(); | 780 this._statusPane.hide(); |
| 781 delete this._statusPane; | 781 delete this._statusPane; |
| 782 this._overviewPane.reset(); | 782 this._overviewPane.reset(); |
| 783 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._model.ma
ximumRecordTime()); | 783 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._model.ma
ximumRecordTime()); |
| 784 this._setAutoWindowTimes(); | 784 this._setAutoWindowTimes(); |
| 785 this._refreshViews(); | 785 this._refreshViews(); |
| 786 for (var i = 0; i < this._overviewControls.length; ++i) | 786 for (var i = 0; i < this._overviewControls.length; ++i) |
| 787 this._overviewControls[i].timelineStopped(); | 787 this._overviewControls[i].timelineStopped(); |
| 788 this._setMarkers(); | 788 this._setMarkers(); |
| 789 this._overviewPane.scheduleUpdate(); | 789 this._overviewPane.scheduleUpdate(); |
| 790 this._updateSearchHighlight(false, true); | 790 this._updateSearchHighlight(false, true); |
| 791 this._detailsSplitWidget.showBoth(); | 791 this._detailsSplitWidget.showBoth(); |
| 792 } | 792 } |
| 793 | 793 |
| 794 _showRecordingStarted() { | 794 _showRecordingStarted() { |
| 795 if (this._statusPane) | 795 if (this._statusPane) |
| 796 return; | 796 return; |
| 797 this._statusPane = new WebInspector.TimelinePanel.StatusPane(true, this._sto
pRecording.bind(this)); | 797 this._statusPane = new Timeline.TimelinePanel.StatusPane(true, this._stopRec
ording.bind(this)); |
| 798 this._statusPane.showPane(this._statusPaneContainer); | 798 this._statusPane.showPane(this._statusPaneContainer); |
| 799 this._statusPane.updateStatus(WebInspector.UIString('Initializing recording\
u2026')); | 799 this._statusPane.updateStatus(Common.UIString('Initializing recording\u2026'
)); |
| 800 } | 800 } |
| 801 | 801 |
| 802 _cancelLoading() { | 802 _cancelLoading() { |
| 803 if (this._loader) | 803 if (this._loader) |
| 804 this._loader.cancel(); | 804 this._loader.cancel(); |
| 805 } | 805 } |
| 806 | 806 |
| 807 _setMarkers() { | 807 _setMarkers() { |
| 808 var markers = new Map(); | 808 var markers = new Map(); |
| 809 var recordTypes = WebInspector.TimelineModel.RecordType; | 809 var recordTypes = TimelineModel.TimelineModel.RecordType; |
| 810 var zeroTime = this._model.minimumRecordTime(); | 810 var zeroTime = this._model.minimumRecordTime(); |
| 811 for (var record of this._model.eventDividerRecords()) { | 811 for (var record of this._model.eventDividerRecords()) { |
| 812 if (record.type() === recordTypes.TimeStamp || record.type() === recordTyp
es.ConsoleTime) | 812 if (record.type() === recordTypes.TimeStamp || record.type() === recordTyp
es.ConsoleTime) |
| 813 continue; | 813 continue; |
| 814 markers.set(record.startTime(), WebInspector.TimelineUIUtils.createDivider
ForRecord(record, zeroTime, 0)); | 814 markers.set(record.startTime(), Timeline.TimelineUIUtils.createDividerForR
ecord(record, zeroTime, 0)); |
| 815 } | 815 } |
| 816 this._overviewPane.setMarkers(markers); | 816 this._overviewPane.setMarkers(markers); |
| 817 } | 817 } |
| 818 | 818 |
| 819 /** | 819 /** |
| 820 * @param {!WebInspector.Event} event | 820 * @param {!Common.Event} event |
| 821 */ | 821 */ |
| 822 _pageReloadRequested(event) { | 822 _pageReloadRequested(event) { |
| 823 if (this._state !== WebInspector.TimelinePanel.State.Idle || !this.isShowing
()) | 823 if (this._state !== Timeline.TimelinePanel.State.Idle || !this.isShowing()) |
| 824 return; | 824 return; |
| 825 this._startRecording(false); | 825 this._startRecording(false); |
| 826 } | 826 } |
| 827 | 827 |
| 828 /** | 828 /** |
| 829 * @param {!WebInspector.Event} event | 829 * @param {!Common.Event} event |
| 830 */ | 830 */ |
| 831 _loadEventFired(event) { | 831 _loadEventFired(event) { |
| 832 if (this._state !== WebInspector.TimelinePanel.State.Recording || !this._aut
oRecordGeneration) | 832 if (this._state !== Timeline.TimelinePanel.State.Recording || !this._autoRec
ordGeneration) |
| 833 return; | 833 return; |
| 834 setTimeout(stopRecordingOnReload.bind(this, this._autoRecordGeneration), thi
s._millisecondsToRecordAfterLoadEvent); | 834 setTimeout(stopRecordingOnReload.bind(this, this._autoRecordGeneration), thi
s._millisecondsToRecordAfterLoadEvent); |
| 835 | 835 |
| 836 /** | 836 /** |
| 837 * @this {WebInspector.TimelinePanel} | 837 * @this {Timeline.TimelinePanel} |
| 838 * @param {!Object} recordGeneration | 838 * @param {!Object} recordGeneration |
| 839 */ | 839 */ |
| 840 function stopRecordingOnReload(recordGeneration) { | 840 function stopRecordingOnReload(recordGeneration) { |
| 841 // Check if we're still in the same recording session. | 841 // Check if we're still in the same recording session. |
| 842 if (this._state !== WebInspector.TimelinePanel.State.Recording || this._au
toRecordGeneration !== recordGeneration) | 842 if (this._state !== Timeline.TimelinePanel.State.Recording || this._autoRe
cordGeneration !== recordGeneration) |
| 843 return; | 843 return; |
| 844 this._stopRecording(); | 844 this._stopRecording(); |
| 845 } | 845 } |
| 846 } | 846 } |
| 847 | 847 |
| 848 // WebInspector.Searchable implementation | 848 // UI.Searchable implementation |
| 849 | 849 |
| 850 /** | 850 /** |
| 851 * @override | 851 * @override |
| 852 */ | 852 */ |
| 853 jumpToNextSearchResult() { | 853 jumpToNextSearchResult() { |
| 854 if (!this._searchResults || !this._searchResults.length) | 854 if (!this._searchResults || !this._searchResults.length) |
| 855 return; | 855 return; |
| 856 var index = this._selectedSearchResult ? this._searchResults.indexOf(this._s
electedSearchResult) : -1; | 856 var index = this._selectedSearchResult ? this._searchResults.indexOf(this._s
electedSearchResult) : -1; |
| 857 this._jumpToSearchResult(index + 1); | 857 this._jumpToSearchResult(index + 1); |
| 858 } | 858 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 /** | 922 /** |
| 923 * @param {boolean} shouldJump | 923 * @param {boolean} shouldJump |
| 924 * @param {boolean=} jumpBackwards | 924 * @param {boolean=} jumpBackwards |
| 925 */ | 925 */ |
| 926 _updateSearchResults(shouldJump, jumpBackwards) { | 926 _updateSearchResults(shouldJump, jumpBackwards) { |
| 927 if (!this._searchRegex) | 927 if (!this._searchRegex) |
| 928 return; | 928 return; |
| 929 | 929 |
| 930 // FIXME: search on all threads. | 930 // FIXME: search on all threads. |
| 931 var events = this._model.mainThreadEvents(); | 931 var events = this._model.mainThreadEvents(); |
| 932 var filters = this._filters.concat([new WebInspector.TimelineTextFilter(this
._searchRegex)]); | 932 var filters = this._filters.concat([new Timeline.TimelineTextFilter(this._se
archRegex)]); |
| 933 var matches = []; | 933 var matches = []; |
| 934 for (var index = events.lowerBound(this._windowStartTime, (time, event) => t
ime - event.startTime); | 934 for (var index = events.lowerBound(this._windowStartTime, (time, event) => t
ime - event.startTime); |
| 935 index < events.length; ++index) { | 935 index < events.length; ++index) { |
| 936 var event = events[index]; | 936 var event = events[index]; |
| 937 if (event.startTime > this._windowEndTime) | 937 if (event.startTime > this._windowEndTime) |
| 938 break; | 938 break; |
| 939 if (WebInspector.TimelineModel.isVisible(filters, event)) | 939 if (TimelineModel.TimelineModel.isVisible(filters, event)) |
| 940 matches.push(event); | 940 matches.push(event); |
| 941 } | 941 } |
| 942 | 942 |
| 943 var matchesCount = matches.length; | 943 var matchesCount = matches.length; |
| 944 if (matchesCount) { | 944 if (matchesCount) { |
| 945 this._searchResults = matches; | 945 this._searchResults = matches; |
| 946 this._searchableView.updateSearchMatchesCount(matchesCount); | 946 this._searchableView.updateSearchMatchesCount(matchesCount); |
| 947 | 947 |
| 948 var selectedIndex = matches.indexOf(this._selectedSearchResult); | 948 var selectedIndex = matches.indexOf(this._selectedSearchResult); |
| 949 if (shouldJump && selectedIndex === -1) | 949 if (shouldJump && selectedIndex === -1) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 960 */ | 960 */ |
| 961 searchCanceled() { | 961 searchCanceled() { |
| 962 this._clearHighlight(); | 962 this._clearHighlight(); |
| 963 delete this._searchResults; | 963 delete this._searchResults; |
| 964 delete this._selectedSearchResult; | 964 delete this._selectedSearchResult; |
| 965 delete this._searchRegex; | 965 delete this._searchRegex; |
| 966 } | 966 } |
| 967 | 967 |
| 968 /** | 968 /** |
| 969 * @override | 969 * @override |
| 970 * @param {!WebInspector.SearchableView.SearchConfig} searchConfig | 970 * @param {!UI.SearchableView.SearchConfig} searchConfig |
| 971 * @param {boolean} shouldJump | 971 * @param {boolean} shouldJump |
| 972 * @param {boolean=} jumpBackwards | 972 * @param {boolean=} jumpBackwards |
| 973 */ | 973 */ |
| 974 performSearch(searchConfig, shouldJump, jumpBackwards) { | 974 performSearch(searchConfig, shouldJump, jumpBackwards) { |
| 975 var query = searchConfig.query; | 975 var query = searchConfig.query; |
| 976 this._searchRegex = createPlainTextSearchRegex(query, 'i'); | 976 this._searchRegex = createPlainTextSearchRegex(query, 'i'); |
| 977 delete this._searchResults; | 977 delete this._searchResults; |
| 978 this._updateSearchHighlight(true, shouldJump, jumpBackwards); | 978 this._updateSearchHighlight(true, shouldJump, jumpBackwards); |
| 979 } | 979 } |
| 980 | 980 |
| 981 _updateSelectionDetails() { | 981 _updateSelectionDetails() { |
| 982 switch (this._selection.type()) { | 982 switch (this._selection.type()) { |
| 983 case WebInspector.TimelineSelection.Type.TraceEvent: | 983 case Timeline.TimelineSelection.Type.TraceEvent: |
| 984 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._selec
tion.object()); | 984 var event = /** @type {!SDK.TracingModel.Event} */ (this._selection.obje
ct()); |
| 985 WebInspector.TimelineUIUtils.buildTraceEventDetails( | 985 Timeline.TimelineUIUtils.buildTraceEventDetails( |
| 986 event, this._model, this._detailsLinkifier, true, | 986 event, this._model, this._detailsLinkifier, true, |
| 987 this._appendDetailsTabsForTraceEventAndShowDetails.bind(this, event)
); | 987 this._appendDetailsTabsForTraceEventAndShowDetails.bind(this, event)
); |
| 988 break; | 988 break; |
| 989 case WebInspector.TimelineSelection.Type.Frame: | 989 case Timeline.TimelineSelection.Type.Frame: |
| 990 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._selection.
object()); | 990 var frame = /** @type {!TimelineModel.TimelineFrame} */ (this._selection
.object()); |
| 991 var screenshotTime = frame.idle ? | 991 var screenshotTime = frame.idle ? |
| 992 frame.startTime : | 992 frame.startTime : |
| 993 frame.endTime; // For idle frames, look at the state at the beginni
ng of the frame. | 993 frame.endTime; // For idle frames, look at the state at the beginni
ng of the frame. |
| 994 var filmStripFrame = filmStripFrame = this._filmStripModel.frameByTimest
amp(screenshotTime); | 994 var filmStripFrame = filmStripFrame = this._filmStripModel.frameByTimest
amp(screenshotTime); |
| 995 if (filmStripFrame && filmStripFrame.timestamp - frame.endTime > 10) | 995 if (filmStripFrame && filmStripFrame.timestamp - frame.endTime > 10) |
| 996 filmStripFrame = null; | 996 filmStripFrame = null; |
| 997 this.showInDetails( | 997 this.showInDetails( |
| 998 WebInspector.TimelineUIUtils.generateDetailsContentForFrame(this._fr
ameModel, frame, filmStripFrame)); | 998 Timeline.TimelineUIUtils.generateDetailsContentForFrame(this._frameM
odel, frame, filmStripFrame)); |
| 999 if (frame.layerTree) { | 999 if (frame.layerTree) { |
| 1000 var layersView = this._layersView(); | 1000 var layersView = this._layersView(); |
| 1001 layersView.showLayerTree(frame.layerTree); | 1001 layersView.showLayerTree(frame.layerTree); |
| 1002 if (!this._detailsView.hasTab(WebInspector.TimelinePanel.DetailsTab.La
yerViewer)) | 1002 if (!this._detailsView.hasTab(Timeline.TimelinePanel.DetailsTab.LayerV
iewer)) |
| 1003 this._detailsView.appendTab( | 1003 this._detailsView.appendTab( |
| 1004 WebInspector.TimelinePanel.DetailsTab.LayerViewer, WebInspector.
UIString('Layers'), layersView); | 1004 Timeline.TimelinePanel.DetailsTab.LayerViewer, Common.UIString('
Layers'), layersView); |
| 1005 } | 1005 } |
| 1006 break; | 1006 break; |
| 1007 case WebInspector.TimelineSelection.Type.NetworkRequest: | 1007 case Timeline.TimelineSelection.Type.NetworkRequest: |
| 1008 var request = /** @type {!WebInspector.TimelineModel.NetworkRequest} */
(this._selection.object()); | 1008 var request = /** @type {!TimelineModel.TimelineModel.NetworkRequest} */
(this._selection.object()); |
| 1009 WebInspector.TimelineUIUtils.buildNetworkRequestDetails(request, this._m
odel, this._detailsLinkifier) | 1009 Timeline.TimelineUIUtils.buildNetworkRequestDetails(request, this._model
, this._detailsLinkifier) |
| 1010 .then(this.showInDetails.bind(this)); | 1010 .then(this.showInDetails.bind(this)); |
| 1011 break; | 1011 break; |
| 1012 case WebInspector.TimelineSelection.Type.Range: | 1012 case Timeline.TimelineSelection.Type.Range: |
| 1013 this._updateSelectedRangeStats(this._selection._startTime, this._selecti
on._endTime); | 1013 this._updateSelectedRangeStats(this._selection._startTime, this._selecti
on._endTime); |
| 1014 break; | 1014 break; |
| 1015 } | 1015 } |
| 1016 | 1016 |
| 1017 this._detailsView.updateContents(this._selection); | 1017 this._detailsView.updateContents(this._selection); |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 /** | 1020 /** |
| 1021 * @param {!WebInspector.TimelineSelection} selection | 1021 * @param {!Timeline.TimelineSelection} selection |
| 1022 * @return {?WebInspector.TimelineFrame} | 1022 * @return {?TimelineModel.TimelineFrame} |
| 1023 */ | 1023 */ |
| 1024 _frameForSelection(selection) { | 1024 _frameForSelection(selection) { |
| 1025 switch (selection.type()) { | 1025 switch (selection.type()) { |
| 1026 case WebInspector.TimelineSelection.Type.Frame: | 1026 case Timeline.TimelineSelection.Type.Frame: |
| 1027 return /** @type {!WebInspector.TimelineFrame} */ (selection.object()); | 1027 return /** @type {!TimelineModel.TimelineFrame} */ (selection.object()); |
| 1028 case WebInspector.TimelineSelection.Type.Range: | 1028 case Timeline.TimelineSelection.Type.Range: |
| 1029 return null; | 1029 return null; |
| 1030 case WebInspector.TimelineSelection.Type.TraceEvent: | 1030 case Timeline.TimelineSelection.Type.TraceEvent: |
| 1031 return this._frameModel.filteredFrames(selection._endTime, selection._en
dTime)[0]; | 1031 return this._frameModel.filteredFrames(selection._endTime, selection._en
dTime)[0]; |
| 1032 default: | 1032 default: |
| 1033 console.assert(false, 'Should never be reached'); | 1033 console.assert(false, 'Should never be reached'); |
| 1034 return null; | 1034 return null; |
| 1035 } | 1035 } |
| 1036 } | 1036 } |
| 1037 | 1037 |
| 1038 /** | 1038 /** |
| 1039 * @param {number} offset | 1039 * @param {number} offset |
| 1040 */ | 1040 */ |
| 1041 _jumpToFrame(offset) { | 1041 _jumpToFrame(offset) { |
| 1042 var currentFrame = this._frameForSelection(this._selection); | 1042 var currentFrame = this._frameForSelection(this._selection); |
| 1043 if (!currentFrame) | 1043 if (!currentFrame) |
| 1044 return; | 1044 return; |
| 1045 var frames = this._frameModel.frames(); | 1045 var frames = this._frameModel.frames(); |
| 1046 var index = frames.indexOf(currentFrame); | 1046 var index = frames.indexOf(currentFrame); |
| 1047 console.assert(index >= 0, 'Can\'t find current frame in the frame list'); | 1047 console.assert(index >= 0, 'Can\'t find current frame in the frame list'); |
| 1048 index = Number.constrain(index + offset, 0, frames.length - 1); | 1048 index = Number.constrain(index + offset, 0, frames.length - 1); |
| 1049 var frame = frames[index]; | 1049 var frame = frames[index]; |
| 1050 this._revealTimeRange(frame.startTime, frame.endTime); | 1050 this._revealTimeRange(frame.startTime, frame.endTime); |
| 1051 this.select(WebInspector.TimelineSelection.fromFrame(frame)); | 1051 this.select(Timeline.TimelineSelection.fromFrame(frame)); |
| 1052 return true; | 1052 return true; |
| 1053 } | 1053 } |
| 1054 | 1054 |
| 1055 /** | 1055 /** |
| 1056 * @param {!WebInspector.PaintProfilerSnapshot} snapshot | 1056 * @param {!SDK.PaintProfilerSnapshot} snapshot |
| 1057 */ | 1057 */ |
| 1058 _showSnapshotInPaintProfiler(snapshot) { | 1058 _showSnapshotInPaintProfiler(snapshot) { |
| 1059 var paintProfilerView = this._paintProfilerView(); | 1059 var paintProfilerView = this._paintProfilerView(); |
| 1060 var hasProfileData = paintProfilerView.setSnapshot(snapshot); | 1060 var hasProfileData = paintProfilerView.setSnapshot(snapshot); |
| 1061 if (!this._detailsView.hasTab(WebInspector.TimelinePanel.DetailsTab.PaintPro
filer)) | 1061 if (!this._detailsView.hasTab(Timeline.TimelinePanel.DetailsTab.PaintProfile
r)) |
| 1062 this._detailsView.appendTab( | 1062 this._detailsView.appendTab( |
| 1063 WebInspector.TimelinePanel.DetailsTab.PaintProfiler, WebInspector.UISt
ring('Paint Profiler'), | 1063 Timeline.TimelinePanel.DetailsTab.PaintProfiler, Common.UIString('Pain
t Profiler'), |
| 1064 paintProfilerView, undefined, undefined, true); | 1064 paintProfilerView, undefined, undefined, true); |
| 1065 this._detailsView.selectTab(WebInspector.TimelinePanel.DetailsTab.PaintProfi
ler, true); | 1065 this._detailsView.selectTab(Timeline.TimelinePanel.DetailsTab.PaintProfiler,
true); |
| 1066 } | 1066 } |
| 1067 | 1067 |
| 1068 /** | 1068 /** |
| 1069 * @param {!WebInspector.TracingModel.Event} event | 1069 * @param {!SDK.TracingModel.Event} event |
| 1070 * @param {!Node} content | 1070 * @param {!Node} content |
| 1071 */ | 1071 */ |
| 1072 _appendDetailsTabsForTraceEventAndShowDetails(event, content) { | 1072 _appendDetailsTabsForTraceEventAndShowDetails(event, content) { |
| 1073 this.showInDetails(content); | 1073 this.showInDetails(content); |
| 1074 if (event.name === WebInspector.TimelineModel.RecordType.Paint || | 1074 if (event.name === TimelineModel.TimelineModel.RecordType.Paint || |
| 1075 event.name === WebInspector.TimelineModel.RecordType.RasterTask) | 1075 event.name === TimelineModel.TimelineModel.RecordType.RasterTask) |
| 1076 this._showEventInPaintProfiler(event); | 1076 this._showEventInPaintProfiler(event); |
| 1077 } | 1077 } |
| 1078 | 1078 |
| 1079 /** | 1079 /** |
| 1080 * @param {!WebInspector.TracingModel.Event} event | 1080 * @param {!SDK.TracingModel.Event} event |
| 1081 */ | 1081 */ |
| 1082 _showEventInPaintProfiler(event) { | 1082 _showEventInPaintProfiler(event) { |
| 1083 var target = WebInspector.targetManager.mainTarget(); | 1083 var target = SDK.targetManager.mainTarget(); |
| 1084 if (!target) | 1084 if (!target) |
| 1085 return; | 1085 return; |
| 1086 var paintProfilerView = this._paintProfilerView(); | 1086 var paintProfilerView = this._paintProfilerView(); |
| 1087 var hasProfileData = paintProfilerView.setEvent(target, event); | 1087 var hasProfileData = paintProfilerView.setEvent(target, event); |
| 1088 if (!hasProfileData) | 1088 if (!hasProfileData) |
| 1089 return; | 1089 return; |
| 1090 if (!this._detailsView.hasTab(WebInspector.TimelinePanel.DetailsTab.PaintPro
filer)) | 1090 if (!this._detailsView.hasTab(Timeline.TimelinePanel.DetailsTab.PaintProfile
r)) |
| 1091 this._detailsView.appendTab( | 1091 this._detailsView.appendTab( |
| 1092 WebInspector.TimelinePanel.DetailsTab.PaintProfiler, WebInspector.UISt
ring('Paint Profiler'), | 1092 Timeline.TimelinePanel.DetailsTab.PaintProfiler, Common.UIString('Pain
t Profiler'), |
| 1093 paintProfilerView, undefined, undefined, false); | 1093 paintProfilerView, undefined, undefined, false); |
| 1094 } | 1094 } |
| 1095 | 1095 |
| 1096 /** | 1096 /** |
| 1097 * @param {number} startTime | 1097 * @param {number} startTime |
| 1098 * @param {number} endTime | 1098 * @param {number} endTime |
| 1099 */ | 1099 */ |
| 1100 _updateSelectedRangeStats(startTime, endTime) { | 1100 _updateSelectedRangeStats(startTime, endTime) { |
| 1101 this.showInDetails(WebInspector.TimelineUIUtils.buildRangeStats(this._model,
startTime, endTime)); | 1101 this.showInDetails(Timeline.TimelineUIUtils.buildRangeStats(this._model, sta
rtTime, endTime)); |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 /** | 1104 /** |
| 1105 * @override | 1105 * @override |
| 1106 * @param {?WebInspector.TimelineSelection} selection | 1106 * @param {?Timeline.TimelineSelection} selection |
| 1107 * @param {!WebInspector.TimelinePanel.DetailsTab=} preferredTab | 1107 * @param {!Timeline.TimelinePanel.DetailsTab=} preferredTab |
| 1108 */ | 1108 */ |
| 1109 select(selection, preferredTab) { | 1109 select(selection, preferredTab) { |
| 1110 if (!selection) | 1110 if (!selection) |
| 1111 selection = WebInspector.TimelineSelection.fromRange(this._windowStartTime
, this._windowEndTime); | 1111 selection = Timeline.TimelineSelection.fromRange(this._windowStartTime, th
is._windowEndTime); |
| 1112 this._selection = selection; | 1112 this._selection = selection; |
| 1113 this._detailsLinkifier.reset(); | 1113 this._detailsLinkifier.reset(); |
| 1114 if (preferredTab) | 1114 if (preferredTab) |
| 1115 this._detailsView.setPreferredTab(preferredTab); | 1115 this._detailsView.setPreferredTab(preferredTab); |
| 1116 | 1116 |
| 1117 for (var view of this._currentViews) | 1117 for (var view of this._currentViews) |
| 1118 view.setSelection(selection); | 1118 view.setSelection(selection); |
| 1119 this._updateSelectionDetails(); | 1119 this._updateSelectionDetails(); |
| 1120 } | 1120 } |
| 1121 | 1121 |
| 1122 /** | 1122 /** |
| 1123 * @override | 1123 * @override |
| 1124 * @param {number} time | 1124 * @param {number} time |
| 1125 */ | 1125 */ |
| 1126 selectEntryAtTime(time) { | 1126 selectEntryAtTime(time) { |
| 1127 var events = this._model.mainThreadEvents(); | 1127 var events = this._model.mainThreadEvents(); |
| 1128 // Find best match, then backtrack to the first visible entry. | 1128 // Find best match, then backtrack to the first visible entry. |
| 1129 for (var index = events.upperBound(time, (time, event) => time - event.start
Time) - 1; index >= 0; --index) { | 1129 for (var index = events.upperBound(time, (time, event) => time - event.start
Time) - 1; index >= 0; --index) { |
| 1130 var event = events[index]; | 1130 var event = events[index]; |
| 1131 var endTime = event.endTime || event.startTime; | 1131 var endTime = event.endTime || event.startTime; |
| 1132 if (WebInspector.TracingModel.isTopLevelEvent(event) && endTime < time) | 1132 if (SDK.TracingModel.isTopLevelEvent(event) && endTime < time) |
| 1133 break; | 1133 break; |
| 1134 if (WebInspector.TimelineModel.isVisible(this._filters, event) && endTime
>= time) { | 1134 if (TimelineModel.TimelineModel.isVisible(this._filters, event) && endTime
>= time) { |
| 1135 this.select(WebInspector.TimelineSelection.fromTraceEvent(event)); | 1135 this.select(Timeline.TimelineSelection.fromTraceEvent(event)); |
| 1136 return; | 1136 return; |
| 1137 } | 1137 } |
| 1138 } | 1138 } |
| 1139 this.select(null); | 1139 this.select(null); |
| 1140 } | 1140 } |
| 1141 | 1141 |
| 1142 /** | 1142 /** |
| 1143 * @override | 1143 * @override |
| 1144 * @param {?WebInspector.TracingModel.Event} event | 1144 * @param {?SDK.TracingModel.Event} event |
| 1145 */ | 1145 */ |
| 1146 highlightEvent(event) { | 1146 highlightEvent(event) { |
| 1147 for (var view of this._currentViews) | 1147 for (var view of this._currentViews) |
| 1148 view.highlightEvent(event); | 1148 view.highlightEvent(event); |
| 1149 } | 1149 } |
| 1150 | 1150 |
| 1151 /** | 1151 /** |
| 1152 * @param {number} startTime | 1152 * @param {number} startTime |
| 1153 * @param {number} endTime | 1153 * @param {number} endTime |
| 1154 */ | 1154 */ |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1173 /** | 1173 /** |
| 1174 * @param {!DataTransfer} dataTransfer | 1174 * @param {!DataTransfer} dataTransfer |
| 1175 */ | 1175 */ |
| 1176 _handleDrop(dataTransfer) { | 1176 _handleDrop(dataTransfer) { |
| 1177 var items = dataTransfer.items; | 1177 var items = dataTransfer.items; |
| 1178 if (!items.length) | 1178 if (!items.length) |
| 1179 return; | 1179 return; |
| 1180 var item = items[0]; | 1180 var item = items[0]; |
| 1181 if (item.kind === 'string') { | 1181 if (item.kind === 'string') { |
| 1182 var url = dataTransfer.getData('text/uri-list'); | 1182 var url = dataTransfer.getData('text/uri-list'); |
| 1183 if (new WebInspector.ParsedURL(url).isValid) | 1183 if (new Common.ParsedURL(url).isValid) |
| 1184 this._loadFromURL(url); | 1184 this._loadFromURL(url); |
| 1185 } else if (item.kind === 'file') { | 1185 } else if (item.kind === 'file') { |
| 1186 var entry = items[0].webkitGetAsEntry(); | 1186 var entry = items[0].webkitGetAsEntry(); |
| 1187 if (!entry.isFile) | 1187 if (!entry.isFile) |
| 1188 return; | 1188 return; |
| 1189 entry.file(this._loadFromFile.bind(this)); | 1189 entry.file(this._loadFromFile.bind(this)); |
| 1190 } | 1190 } |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 _setAutoWindowTimes() { | 1193 _setAutoWindowTimes() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 leftTime = Math.max(leftTime - 0.05 * span, this._tracingModel.minimumReco
rdTime()); | 1233 leftTime = Math.max(leftTime - 0.05 * span, this._tracingModel.minimumReco
rdTime()); |
| 1234 rightTime = Math.min(rightTime + 0.05 * span, this._tracingModel.maximumRe
cordTime()); | 1234 rightTime = Math.min(rightTime + 0.05 * span, this._tracingModel.maximumRe
cordTime()); |
| 1235 } | 1235 } |
| 1236 this.requestWindowTimes(leftTime, rightTime); | 1236 this.requestWindowTimes(leftTime, rightTime); |
| 1237 } | 1237 } |
| 1238 }; | 1238 }; |
| 1239 | 1239 |
| 1240 /** | 1240 /** |
| 1241 * @enum {string} | 1241 * @enum {string} |
| 1242 */ | 1242 */ |
| 1243 WebInspector.TimelinePanel.Perspectives = { | 1243 Timeline.TimelinePanel.Perspectives = { |
| 1244 Load: 'Load', | 1244 Load: 'Load', |
| 1245 Responsiveness: 'Responsiveness', | 1245 Responsiveness: 'Responsiveness', |
| 1246 Custom: 'Custom' | 1246 Custom: 'Custom' |
| 1247 }; | 1247 }; |
| 1248 | 1248 |
| 1249 /** | 1249 /** |
| 1250 * @enum {string} | 1250 * @enum {string} |
| 1251 */ | 1251 */ |
| 1252 WebInspector.TimelinePanel.DetailsTab = { | 1252 Timeline.TimelinePanel.DetailsTab = { |
| 1253 Details: 'Details', | 1253 Details: 'Details', |
| 1254 Events: 'Events', | 1254 Events: 'Events', |
| 1255 CallTree: 'CallTree', | 1255 CallTree: 'CallTree', |
| 1256 BottomUp: 'BottomUp', | 1256 BottomUp: 'BottomUp', |
| 1257 PaintProfiler: 'PaintProfiler', | 1257 PaintProfiler: 'PaintProfiler', |
| 1258 LayerViewer: 'LayerViewer' | 1258 LayerViewer: 'LayerViewer' |
| 1259 }; | 1259 }; |
| 1260 | 1260 |
| 1261 /** | 1261 /** |
| 1262 * @enum {symbol} | 1262 * @enum {symbol} |
| 1263 */ | 1263 */ |
| 1264 WebInspector.TimelinePanel.State = { | 1264 Timeline.TimelinePanel.State = { |
| 1265 Idle: Symbol('Idle'), | 1265 Idle: Symbol('Idle'), |
| 1266 StartPending: Symbol('StartPending'), | 1266 StartPending: Symbol('StartPending'), |
| 1267 Recording: Symbol('Recording'), | 1267 Recording: Symbol('Recording'), |
| 1268 StopPending: Symbol('StopPending'), | 1268 StopPending: Symbol('StopPending'), |
| 1269 Loading: Symbol('Loading') | 1269 Loading: Symbol('Loading') |
| 1270 }; | 1270 }; |
| 1271 | 1271 |
| 1272 // Define row and header height, should be in sync with styles for timeline grap
hs. | 1272 // Define row and header height, should be in sync with styles for timeline grap
hs. |
| 1273 WebInspector.TimelinePanel.rowHeight = 18; | 1273 Timeline.TimelinePanel.rowHeight = 18; |
| 1274 WebInspector.TimelinePanel.headerHeight = 20; | 1274 Timeline.TimelinePanel.headerHeight = 20; |
| 1275 | 1275 |
| 1276 /** | 1276 /** |
| 1277 * @interface | 1277 * @interface |
| 1278 */ | 1278 */ |
| 1279 WebInspector.TimelineLifecycleDelegate = function() {}; | 1279 Timeline.TimelineLifecycleDelegate = function() {}; |
| 1280 | 1280 |
| 1281 WebInspector.TimelineLifecycleDelegate.prototype = { | 1281 Timeline.TimelineLifecycleDelegate.prototype = { |
| 1282 recordingStarted: function() {}, | 1282 recordingStarted: function() {}, |
| 1283 | 1283 |
| 1284 /** | 1284 /** |
| 1285 * @param {number} usage | 1285 * @param {number} usage |
| 1286 */ | 1286 */ |
| 1287 recordingProgress: function(usage) {}, | 1287 recordingProgress: function(usage) {}, |
| 1288 | 1288 |
| 1289 loadingStarted: function() {}, | 1289 loadingStarted: function() {}, |
| 1290 | 1290 |
| 1291 /** | 1291 /** |
| 1292 * @param {number=} progress | 1292 * @param {number=} progress |
| 1293 */ | 1293 */ |
| 1294 loadingProgress: function(progress) {}, | 1294 loadingProgress: function(progress) {}, |
| 1295 | 1295 |
| 1296 /** | 1296 /** |
| 1297 * @param {boolean} success | 1297 * @param {boolean} success |
| 1298 */ | 1298 */ |
| 1299 loadingComplete: function(success) {}, | 1299 loadingComplete: function(success) {}, |
| 1300 }; | 1300 }; |
| 1301 | 1301 |
| 1302 /** | 1302 /** |
| 1303 * @unrestricted | 1303 * @unrestricted |
| 1304 */ | 1304 */ |
| 1305 WebInspector.TimelineDetailsView = class extends WebInspector.TabbedPane { | 1305 Timeline.TimelineDetailsView = class extends UI.TabbedPane { |
| 1306 /** | 1306 /** |
| 1307 * @param {!WebInspector.TimelineModel} timelineModel | 1307 * @param {!TimelineModel.TimelineModel} timelineModel |
| 1308 * @param {!Array<!WebInspector.TimelineModel.Filter>} filters | 1308 * @param {!Array<!TimelineModel.TimelineModel.Filter>} filters |
| 1309 * @param {!WebInspector.TimelineModeViewDelegate} delegate | 1309 * @param {!Timeline.TimelineModeViewDelegate} delegate |
| 1310 */ | 1310 */ |
| 1311 constructor(timelineModel, filters, delegate) { | 1311 constructor(timelineModel, filters, delegate) { |
| 1312 super(); | 1312 super(); |
| 1313 this.element.classList.add('timeline-details'); | 1313 this.element.classList.add('timeline-details'); |
| 1314 | 1314 |
| 1315 var tabIds = WebInspector.TimelinePanel.DetailsTab; | 1315 var tabIds = Timeline.TimelinePanel.DetailsTab; |
| 1316 this._defaultDetailsWidget = new WebInspector.VBox(); | 1316 this._defaultDetailsWidget = new UI.VBox(); |
| 1317 this._defaultDetailsWidget.element.classList.add('timeline-details-view'); | 1317 this._defaultDetailsWidget.element.classList.add('timeline-details-view'); |
| 1318 this._defaultDetailsContentElement = | 1318 this._defaultDetailsContentElement = |
| 1319 this._defaultDetailsWidget.element.createChild('div', 'timeline-details-
view-body vbox'); | 1319 this._defaultDetailsWidget.element.createChild('div', 'timeline-details-
view-body vbox'); |
| 1320 this.appendTab(tabIds.Details, WebInspector.UIString('Summary'), this._defau
ltDetailsWidget); | 1320 this.appendTab(tabIds.Details, Common.UIString('Summary'), this._defaultDeta
ilsWidget); |
| 1321 this.setPreferredTab(tabIds.Details); | 1321 this.setPreferredTab(tabIds.Details); |
| 1322 | 1322 |
| 1323 /** @type Map<string, WebInspector.TimelineTreeView> */ | 1323 /** @type Map<string, Timeline.TimelineTreeView> */ |
| 1324 this._rangeDetailViews = new Map(); | 1324 this._rangeDetailViews = new Map(); |
| 1325 | 1325 |
| 1326 var bottomUpView = new WebInspector.BottomUpTimelineTreeView(timelineModel,
filters); | 1326 var bottomUpView = new Timeline.BottomUpTimelineTreeView(timelineModel, filt
ers); |
| 1327 this.appendTab(tabIds.BottomUp, WebInspector.UIString('Bottom-Up'), bottomUp
View); | 1327 this.appendTab(tabIds.BottomUp, Common.UIString('Bottom-Up'), bottomUpView); |
| 1328 this._rangeDetailViews.set(tabIds.BottomUp, bottomUpView); | 1328 this._rangeDetailViews.set(tabIds.BottomUp, bottomUpView); |
| 1329 | 1329 |
| 1330 var callTreeView = new WebInspector.CallTreeTimelineTreeView(timelineModel,
filters); | 1330 var callTreeView = new Timeline.CallTreeTimelineTreeView(timelineModel, filt
ers); |
| 1331 this.appendTab(tabIds.CallTree, WebInspector.UIString('Call Tree'), callTree
View); | 1331 this.appendTab(tabIds.CallTree, Common.UIString('Call Tree'), callTreeView); |
| 1332 this._rangeDetailViews.set(tabIds.CallTree, callTreeView); | 1332 this._rangeDetailViews.set(tabIds.CallTree, callTreeView); |
| 1333 | 1333 |
| 1334 var eventsView = new WebInspector.EventsTimelineTreeView(timelineModel, filt
ers, delegate); | 1334 var eventsView = new Timeline.EventsTimelineTreeView(timelineModel, filters,
delegate); |
| 1335 this.appendTab(tabIds.Events, WebInspector.UIString('Event Log'), eventsView
); | 1335 this.appendTab(tabIds.Events, Common.UIString('Event Log'), eventsView); |
| 1336 this._rangeDetailViews.set(tabIds.Events, eventsView); | 1336 this._rangeDetailViews.set(tabIds.Events, eventsView); |
| 1337 | 1337 |
| 1338 this.addEventListener(WebInspector.TabbedPane.Events.TabSelected, this._tabS
elected, this); | 1338 this.addEventListener(UI.TabbedPane.Events.TabSelected, this._tabSelected, t
his); |
| 1339 } | 1339 } |
| 1340 | 1340 |
| 1341 /** | 1341 /** |
| 1342 * @param {!Node} node | 1342 * @param {!Node} node |
| 1343 */ | 1343 */ |
| 1344 setContent(node) { | 1344 setContent(node) { |
| 1345 var allTabs = this.otherTabs(WebInspector.TimelinePanel.DetailsTab.Details); | 1345 var allTabs = this.otherTabs(Timeline.TimelinePanel.DetailsTab.Details); |
| 1346 for (var i = 0; i < allTabs.length; ++i) { | 1346 for (var i = 0; i < allTabs.length; ++i) { |
| 1347 if (!this._rangeDetailViews.has(allTabs[i])) | 1347 if (!this._rangeDetailViews.has(allTabs[i])) |
| 1348 this.closeTab(allTabs[i]); | 1348 this.closeTab(allTabs[i]); |
| 1349 } | 1349 } |
| 1350 this._defaultDetailsContentElement.removeChildren(); | 1350 this._defaultDetailsContentElement.removeChildren(); |
| 1351 this._defaultDetailsContentElement.appendChild(node); | 1351 this._defaultDetailsContentElement.appendChild(node); |
| 1352 } | 1352 } |
| 1353 | 1353 |
| 1354 /** | 1354 /** |
| 1355 * @param {!WebInspector.TimelineSelection} selection | 1355 * @param {!Timeline.TimelineSelection} selection |
| 1356 */ | 1356 */ |
| 1357 updateContents(selection) { | 1357 updateContents(selection) { |
| 1358 this._selection = selection; | 1358 this._selection = selection; |
| 1359 var view = this.selectedTabId ? this._rangeDetailViews.get(this.selectedTabI
d) : null; | 1359 var view = this.selectedTabId ? this._rangeDetailViews.get(this.selectedTabI
d) : null; |
| 1360 if (view) | 1360 if (view) |
| 1361 view.updateContents(selection); | 1361 view.updateContents(selection); |
| 1362 } | 1362 } |
| 1363 | 1363 |
| 1364 /** | 1364 /** |
| 1365 * @override | 1365 * @override |
| 1366 * @param {string} id | 1366 * @param {string} id |
| 1367 * @param {string} tabTitle | 1367 * @param {string} tabTitle |
| 1368 * @param {!WebInspector.Widget} view | 1368 * @param {!UI.Widget} view |
| 1369 * @param {string=} tabTooltip | 1369 * @param {string=} tabTooltip |
| 1370 * @param {boolean=} userGesture | 1370 * @param {boolean=} userGesture |
| 1371 * @param {boolean=} isCloseable | 1371 * @param {boolean=} isCloseable |
| 1372 */ | 1372 */ |
| 1373 appendTab(id, tabTitle, view, tabTooltip, userGesture, isCloseable) { | 1373 appendTab(id, tabTitle, view, tabTooltip, userGesture, isCloseable) { |
| 1374 super.appendTab(id, tabTitle, view, tabTooltip, userGesture, isCloseable); | 1374 super.appendTab(id, tabTitle, view, tabTooltip, userGesture, isCloseable); |
| 1375 if (this._preferredTabId !== this.selectedTabId) | 1375 if (this._preferredTabId !== this.selectedTabId) |
| 1376 this.selectTab(id); | 1376 this.selectTab(id); |
| 1377 } | 1377 } |
| 1378 | 1378 |
| 1379 /** | 1379 /** |
| 1380 * @param {string} tabId | 1380 * @param {string} tabId |
| 1381 */ | 1381 */ |
| 1382 setPreferredTab(tabId) { | 1382 setPreferredTab(tabId) { |
| 1383 this._preferredTabId = tabId; | 1383 this._preferredTabId = tabId; |
| 1384 } | 1384 } |
| 1385 | 1385 |
| 1386 /** | 1386 /** |
| 1387 * @param {!WebInspector.Event} event | 1387 * @param {!Common.Event} event |
| 1388 */ | 1388 */ |
| 1389 _tabSelected(event) { | 1389 _tabSelected(event) { |
| 1390 if (!event.data.isUserGesture) | 1390 if (!event.data.isUserGesture) |
| 1391 return; | 1391 return; |
| 1392 this.setPreferredTab(event.data.tabId); | 1392 this.setPreferredTab(event.data.tabId); |
| 1393 this.updateContents(this._selection); | 1393 this.updateContents(this._selection); |
| 1394 } | 1394 } |
| 1395 }; | 1395 }; |
| 1396 | 1396 |
| 1397 /** | 1397 /** |
| 1398 * @unrestricted | 1398 * @unrestricted |
| 1399 */ | 1399 */ |
| 1400 WebInspector.TimelineSelection = class { | 1400 Timeline.TimelineSelection = class { |
| 1401 /** | 1401 /** |
| 1402 * @param {!WebInspector.TimelineSelection.Type} type | 1402 * @param {!Timeline.TimelineSelection.Type} type |
| 1403 * @param {number} startTime | 1403 * @param {number} startTime |
| 1404 * @param {number} endTime | 1404 * @param {number} endTime |
| 1405 * @param {!Object=} object | 1405 * @param {!Object=} object |
| 1406 */ | 1406 */ |
| 1407 constructor(type, startTime, endTime, object) { | 1407 constructor(type, startTime, endTime, object) { |
| 1408 this._type = type; | 1408 this._type = type; |
| 1409 this._startTime = startTime; | 1409 this._startTime = startTime; |
| 1410 this._endTime = endTime; | 1410 this._endTime = endTime; |
| 1411 this._object = object || null; | 1411 this._object = object || null; |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 /** | 1414 /** |
| 1415 * @param {!WebInspector.TimelineFrame} frame | 1415 * @param {!TimelineModel.TimelineFrame} frame |
| 1416 * @return {!WebInspector.TimelineSelection} | 1416 * @return {!Timeline.TimelineSelection} |
| 1417 */ | 1417 */ |
| 1418 static fromFrame(frame) { | 1418 static fromFrame(frame) { |
| 1419 return new WebInspector.TimelineSelection( | 1419 return new Timeline.TimelineSelection( |
| 1420 WebInspector.TimelineSelection.Type.Frame, frame.startTime, frame.endTim
e, frame); | 1420 Timeline.TimelineSelection.Type.Frame, frame.startTime, frame.endTime, f
rame); |
| 1421 } | 1421 } |
| 1422 | 1422 |
| 1423 /** | 1423 /** |
| 1424 * @param {!WebInspector.TimelineModel.NetworkRequest} request | 1424 * @param {!TimelineModel.TimelineModel.NetworkRequest} request |
| 1425 * @return {!WebInspector.TimelineSelection} | 1425 * @return {!Timeline.TimelineSelection} |
| 1426 */ | 1426 */ |
| 1427 static fromNetworkRequest(request) { | 1427 static fromNetworkRequest(request) { |
| 1428 return new WebInspector.TimelineSelection( | 1428 return new Timeline.TimelineSelection( |
| 1429 WebInspector.TimelineSelection.Type.NetworkRequest, request.startTime, r
equest.endTime || request.startTime, | 1429 Timeline.TimelineSelection.Type.NetworkRequest, request.startTime, reque
st.endTime || request.startTime, |
| 1430 request); | 1430 request); |
| 1431 } | 1431 } |
| 1432 | 1432 |
| 1433 /** | 1433 /** |
| 1434 * @param {!WebInspector.TracingModel.Event} event | 1434 * @param {!SDK.TracingModel.Event} event |
| 1435 * @return {!WebInspector.TimelineSelection} | 1435 * @return {!Timeline.TimelineSelection} |
| 1436 */ | 1436 */ |
| 1437 static fromTraceEvent(event) { | 1437 static fromTraceEvent(event) { |
| 1438 return new WebInspector.TimelineSelection( | 1438 return new Timeline.TimelineSelection( |
| 1439 WebInspector.TimelineSelection.Type.TraceEvent, event.startTime, event.e
ndTime || (event.startTime + 1), event); | 1439 Timeline.TimelineSelection.Type.TraceEvent, event.startTime, event.endTi
me || (event.startTime + 1), event); |
| 1440 } | 1440 } |
| 1441 | 1441 |
| 1442 /** | 1442 /** |
| 1443 * @param {number} startTime | 1443 * @param {number} startTime |
| 1444 * @param {number} endTime | 1444 * @param {number} endTime |
| 1445 * @return {!WebInspector.TimelineSelection} | 1445 * @return {!Timeline.TimelineSelection} |
| 1446 */ | 1446 */ |
| 1447 static fromRange(startTime, endTime) { | 1447 static fromRange(startTime, endTime) { |
| 1448 return new WebInspector.TimelineSelection(WebInspector.TimelineSelection.Typ
e.Range, startTime, endTime); | 1448 return new Timeline.TimelineSelection(Timeline.TimelineSelection.Type.Range,
startTime, endTime); |
| 1449 } | 1449 } |
| 1450 | 1450 |
| 1451 /** | 1451 /** |
| 1452 * @return {!WebInspector.TimelineSelection.Type} | 1452 * @return {!Timeline.TimelineSelection.Type} |
| 1453 */ | 1453 */ |
| 1454 type() { | 1454 type() { |
| 1455 return this._type; | 1455 return this._type; |
| 1456 } | 1456 } |
| 1457 | 1457 |
| 1458 /** | 1458 /** |
| 1459 * @return {?Object} | 1459 * @return {?Object} |
| 1460 */ | 1460 */ |
| 1461 object() { | 1461 object() { |
| 1462 return this._object; | 1462 return this._object; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1473 * @return {number} | 1473 * @return {number} |
| 1474 */ | 1474 */ |
| 1475 endTime() { | 1475 endTime() { |
| 1476 return this._endTime; | 1476 return this._endTime; |
| 1477 } | 1477 } |
| 1478 }; | 1478 }; |
| 1479 | 1479 |
| 1480 /** | 1480 /** |
| 1481 * @enum {string} | 1481 * @enum {string} |
| 1482 */ | 1482 */ |
| 1483 WebInspector.TimelineSelection.Type = { | 1483 Timeline.TimelineSelection.Type = { |
| 1484 Frame: 'Frame', | 1484 Frame: 'Frame', |
| 1485 NetworkRequest: 'NetworkRequest', | 1485 NetworkRequest: 'NetworkRequest', |
| 1486 TraceEvent: 'TraceEvent', | 1486 TraceEvent: 'TraceEvent', |
| 1487 Range: 'Range' | 1487 Range: 'Range' |
| 1488 }; | 1488 }; |
| 1489 | 1489 |
| 1490 | 1490 |
| 1491 /** | 1491 /** |
| 1492 * @interface | 1492 * @interface |
| 1493 * @extends {WebInspector.EventTarget} | 1493 * @extends {Common.EventTarget} |
| 1494 */ | 1494 */ |
| 1495 WebInspector.TimelineModeView = function() {}; | 1495 Timeline.TimelineModeView = function() {}; |
| 1496 | 1496 |
| 1497 WebInspector.TimelineModeView.prototype = { | 1497 Timeline.TimelineModeView.prototype = { |
| 1498 /** | 1498 /** |
| 1499 * @return {!WebInspector.Widget} | 1499 * @return {!UI.Widget} |
| 1500 */ | 1500 */ |
| 1501 view: function() {}, | 1501 view: function() {}, |
| 1502 | 1502 |
| 1503 dispose: function() {}, | 1503 dispose: function() {}, |
| 1504 | 1504 |
| 1505 /** | 1505 /** |
| 1506 * @return {?Element} | 1506 * @return {?Element} |
| 1507 */ | 1507 */ |
| 1508 resizerElement: function() {}, | 1508 resizerElement: function() {}, |
| 1509 | 1509 |
| 1510 reset: function() {}, | 1510 reset: function() {}, |
| 1511 | 1511 |
| 1512 refreshRecords: function() {}, | 1512 refreshRecords: function() {}, |
| 1513 | 1513 |
| 1514 /** | 1514 /** |
| 1515 * @param {?WebInspector.TracingModel.Event} event | 1515 * @param {?SDK.TracingModel.Event} event |
| 1516 * @param {string=} regex | 1516 * @param {string=} regex |
| 1517 * @param {boolean=} select | 1517 * @param {boolean=} select |
| 1518 */ | 1518 */ |
| 1519 highlightSearchResult: function(event, regex, select) {}, | 1519 highlightSearchResult: function(event, regex, select) {}, |
| 1520 | 1520 |
| 1521 /** | 1521 /** |
| 1522 * @param {number} startTime | 1522 * @param {number} startTime |
| 1523 * @param {number} endTime | 1523 * @param {number} endTime |
| 1524 */ | 1524 */ |
| 1525 setWindowTimes: function(startTime, endTime) {}, | 1525 setWindowTimes: function(startTime, endTime) {}, |
| 1526 | 1526 |
| 1527 /** | 1527 /** |
| 1528 * @param {?WebInspector.TimelineSelection} selection | 1528 * @param {?Timeline.TimelineSelection} selection |
| 1529 */ | 1529 */ |
| 1530 setSelection: function(selection) {}, | 1530 setSelection: function(selection) {}, |
| 1531 | 1531 |
| 1532 /** | 1532 /** |
| 1533 * @param {?WebInspector.TracingModel.Event} event | 1533 * @param {?SDK.TracingModel.Event} event |
| 1534 */ | 1534 */ |
| 1535 highlightEvent: function(event) {} | 1535 highlightEvent: function(event) {} |
| 1536 }; | 1536 }; |
| 1537 | 1537 |
| 1538 /** | 1538 /** |
| 1539 * @interface | 1539 * @interface |
| 1540 */ | 1540 */ |
| 1541 WebInspector.TimelineModeViewDelegate = function() {}; | 1541 Timeline.TimelineModeViewDelegate = function() {}; |
| 1542 | 1542 |
| 1543 WebInspector.TimelineModeViewDelegate.prototype = { | 1543 Timeline.TimelineModeViewDelegate.prototype = { |
| 1544 /** | 1544 /** |
| 1545 * @param {number} startTime | 1545 * @param {number} startTime |
| 1546 * @param {number} endTime | 1546 * @param {number} endTime |
| 1547 */ | 1547 */ |
| 1548 requestWindowTimes: function(startTime, endTime) {}, | 1548 requestWindowTimes: function(startTime, endTime) {}, |
| 1549 | 1549 |
| 1550 /** | 1550 /** |
| 1551 * @param {?WebInspector.TimelineSelection} selection | 1551 * @param {?Timeline.TimelineSelection} selection |
| 1552 * @param {!WebInspector.TimelinePanel.DetailsTab=} preferredTab | 1552 * @param {!Timeline.TimelinePanel.DetailsTab=} preferredTab |
| 1553 */ | 1553 */ |
| 1554 select: function(selection, preferredTab) {}, | 1554 select: function(selection, preferredTab) {}, |
| 1555 | 1555 |
| 1556 /** | 1556 /** |
| 1557 * @param {number} time | 1557 * @param {number} time |
| 1558 */ | 1558 */ |
| 1559 selectEntryAtTime: function(time) {}, | 1559 selectEntryAtTime: function(time) {}, |
| 1560 | 1560 |
| 1561 /** | 1561 /** |
| 1562 * @param {!Node} node | 1562 * @param {!Node} node |
| 1563 */ | 1563 */ |
| 1564 showInDetails: function(node) {}, | 1564 showInDetails: function(node) {}, |
| 1565 | 1565 |
| 1566 /** | 1566 /** |
| 1567 * @param {?WebInspector.TracingModel.Event} event | 1567 * @param {?SDK.TracingModel.Event} event |
| 1568 */ | 1568 */ |
| 1569 highlightEvent: function(event) {} | 1569 highlightEvent: function(event) {} |
| 1570 }; | 1570 }; |
| 1571 | 1571 |
| 1572 /** | 1572 /** |
| 1573 * @unrestricted | 1573 * @unrestricted |
| 1574 */ | 1574 */ |
| 1575 WebInspector.TimelineCategoryFilter = class extends WebInspector.TimelineModel.F
ilter { | 1575 Timeline.TimelineCategoryFilter = class extends TimelineModel.TimelineModel.Filt
er { |
| 1576 constructor() { | 1576 constructor() { |
| 1577 super(); | 1577 super(); |
| 1578 } | 1578 } |
| 1579 | 1579 |
| 1580 /** | 1580 /** |
| 1581 * @override | 1581 * @override |
| 1582 * @param {!WebInspector.TracingModel.Event} event | 1582 * @param {!SDK.TracingModel.Event} event |
| 1583 * @return {boolean} | 1583 * @return {boolean} |
| 1584 */ | 1584 */ |
| 1585 accept(event) { | 1585 accept(event) { |
| 1586 return !WebInspector.TimelineUIUtils.eventStyle(event).category.hidden; | 1586 return !Timeline.TimelineUIUtils.eventStyle(event).category.hidden; |
| 1587 } | 1587 } |
| 1588 }; | 1588 }; |
| 1589 | 1589 |
| 1590 /** | 1590 /** |
| 1591 * @unrestricted | 1591 * @unrestricted |
| 1592 */ | 1592 */ |
| 1593 WebInspector.TimelineIsLongFilter = class extends WebInspector.TimelineModel.Fil
ter { | 1593 Timeline.TimelineIsLongFilter = class extends TimelineModel.TimelineModel.Filter
{ |
| 1594 constructor() { | 1594 constructor() { |
| 1595 super(); | 1595 super(); |
| 1596 this._minimumRecordDuration = 0; | 1596 this._minimumRecordDuration = 0; |
| 1597 } | 1597 } |
| 1598 | 1598 |
| 1599 /** | 1599 /** |
| 1600 * @param {number} value | 1600 * @param {number} value |
| 1601 */ | 1601 */ |
| 1602 setMinimumRecordDuration(value) { | 1602 setMinimumRecordDuration(value) { |
| 1603 this._minimumRecordDuration = value; | 1603 this._minimumRecordDuration = value; |
| 1604 } | 1604 } |
| 1605 | 1605 |
| 1606 /** | 1606 /** |
| 1607 * @override | 1607 * @override |
| 1608 * @param {!WebInspector.TracingModel.Event} event | 1608 * @param {!SDK.TracingModel.Event} event |
| 1609 * @return {boolean} | 1609 * @return {boolean} |
| 1610 */ | 1610 */ |
| 1611 accept(event) { | 1611 accept(event) { |
| 1612 var duration = event.endTime ? event.endTime - event.startTime : 0; | 1612 var duration = event.endTime ? event.endTime - event.startTime : 0; |
| 1613 return duration >= this._minimumRecordDuration; | 1613 return duration >= this._minimumRecordDuration; |
| 1614 } | 1614 } |
| 1615 }; | 1615 }; |
| 1616 | 1616 |
| 1617 WebInspector.TimelineTextFilter = class extends WebInspector.TimelineModel.Filte
r { | 1617 Timeline.TimelineTextFilter = class extends TimelineModel.TimelineModel.Filter { |
| 1618 /** | 1618 /** |
| 1619 * @param {!RegExp=} regExp | 1619 * @param {!RegExp=} regExp |
| 1620 */ | 1620 */ |
| 1621 constructor(regExp) { | 1621 constructor(regExp) { |
| 1622 super(); | 1622 super(); |
| 1623 /** @type {?RegExp} */ | 1623 /** @type {?RegExp} */ |
| 1624 this._regExp; | 1624 this._regExp; |
| 1625 this._setRegExp(regExp || null); | 1625 this._setRegExp(regExp || null); |
| 1626 } | 1626 } |
| 1627 | 1627 |
| 1628 /** | 1628 /** |
| 1629 * @param {?RegExp} regExp | 1629 * @param {?RegExp} regExp |
| 1630 */ | 1630 */ |
| 1631 _setRegExp(regExp) { | 1631 _setRegExp(regExp) { |
| 1632 this._regExp = regExp; | 1632 this._regExp = regExp; |
| 1633 } | 1633 } |
| 1634 | 1634 |
| 1635 /** | 1635 /** |
| 1636 * @override | 1636 * @override |
| 1637 * @param {!WebInspector.TracingModel.Event} event | 1637 * @param {!SDK.TracingModel.Event} event |
| 1638 * @return {boolean} | 1638 * @return {boolean} |
| 1639 */ | 1639 */ |
| 1640 accept(event) { | 1640 accept(event) { |
| 1641 return !this._regExp || WebInspector.TimelineUIUtils.testContentMatching(eve
nt, this._regExp); | 1641 return !this._regExp || Timeline.TimelineUIUtils.testContentMatching(event,
this._regExp); |
| 1642 } | 1642 } |
| 1643 }; | 1643 }; |
| 1644 | 1644 |
| 1645 /** | 1645 /** |
| 1646 * @unrestricted | 1646 * @unrestricted |
| 1647 */ | 1647 */ |
| 1648 WebInspector.TimelinePanel.StatusPane = class extends WebInspector.VBox { | 1648 Timeline.TimelinePanel.StatusPane = class extends UI.VBox { |
| 1649 /** | 1649 /** |
| 1650 * @param {boolean} showTimer | 1650 * @param {boolean} showTimer |
| 1651 * @param {function()} stopCallback | 1651 * @param {function()} stopCallback |
| 1652 */ | 1652 */ |
| 1653 constructor(showTimer, stopCallback) { | 1653 constructor(showTimer, stopCallback) { |
| 1654 super(true); | 1654 super(true); |
| 1655 this.registerRequiredCSS('timeline/timelineStatusDialog.css'); | 1655 this.registerRequiredCSS('timeline/timelineStatusDialog.css'); |
| 1656 this.contentElement.classList.add('timeline-status-dialog'); | 1656 this.contentElement.classList.add('timeline-status-dialog'); |
| 1657 | 1657 |
| 1658 var statusLine = this.contentElement.createChild('div', 'status-dialog-line
status'); | 1658 var statusLine = this.contentElement.createChild('div', 'status-dialog-line
status'); |
| 1659 statusLine.createChild('div', 'label').textContent = WebInspector.UIString('
Status'); | 1659 statusLine.createChild('div', 'label').textContent = Common.UIString('Status
'); |
| 1660 this._status = statusLine.createChild('div', 'content'); | 1660 this._status = statusLine.createChild('div', 'content'); |
| 1661 | 1661 |
| 1662 if (showTimer) { | 1662 if (showTimer) { |
| 1663 var timeLine = this.contentElement.createChild('div', 'status-dialog-line
time'); | 1663 var timeLine = this.contentElement.createChild('div', 'status-dialog-line
time'); |
| 1664 timeLine.createChild('div', 'label').textContent = WebInspector.UIString('
Time'); | 1664 timeLine.createChild('div', 'label').textContent = Common.UIString('Time')
; |
| 1665 this._time = timeLine.createChild('div', 'content'); | 1665 this._time = timeLine.createChild('div', 'content'); |
| 1666 } | 1666 } |
| 1667 var progressLine = this.contentElement.createChild('div', 'status-dialog-lin
e progress'); | 1667 var progressLine = this.contentElement.createChild('div', 'status-dialog-lin
e progress'); |
| 1668 this._progressLabel = progressLine.createChild('div', 'label'); | 1668 this._progressLabel = progressLine.createChild('div', 'label'); |
| 1669 this._progressBar = progressLine.createChild('div', 'indicator-container').c
reateChild('div', 'indicator'); | 1669 this._progressBar = progressLine.createChild('div', 'indicator-container').c
reateChild('div', 'indicator'); |
| 1670 | 1670 |
| 1671 this._stopButton = createTextButton(WebInspector.UIString('Stop'), stopCallb
ack); | 1671 this._stopButton = createTextButton(Common.UIString('Stop'), stopCallback); |
| 1672 this.contentElement.createChild('div', 'stop-button').appendChild(this._stop
Button); | 1672 this.contentElement.createChild('div', 'stop-button').appendChild(this._stop
Button); |
| 1673 } | 1673 } |
| 1674 | 1674 |
| 1675 finish() { | 1675 finish() { |
| 1676 this._stopTimer(); | 1676 this._stopTimer(); |
| 1677 this._stopButton.disabled = true; | 1677 this._stopButton.disabled = true; |
| 1678 } | 1678 } |
| 1679 | 1679 |
| 1680 hide() { | 1680 hide() { |
| 1681 this.element.parentNode.classList.remove('tinted'); | 1681 this.element.parentNode.classList.remove('tinted'); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1721 delete this._timeUpdateTimer; | 1721 delete this._timeUpdateTimer; |
| 1722 } | 1722 } |
| 1723 | 1723 |
| 1724 /** | 1724 /** |
| 1725 * @param {boolean=} precise | 1725 * @param {boolean=} precise |
| 1726 */ | 1726 */ |
| 1727 _updateTimer(precise) { | 1727 _updateTimer(precise) { |
| 1728 if (!this._timeUpdateTimer) | 1728 if (!this._timeUpdateTimer) |
| 1729 return; | 1729 return; |
| 1730 var elapsed = (Date.now() - this._startTime) / 1000; | 1730 var elapsed = (Date.now() - this._startTime) / 1000; |
| 1731 this._time.textContent = WebInspector.UIString('%s\u2009sec', elapsed.toFixe
d(precise ? 1 : 0)); | 1731 this._time.textContent = Common.UIString('%s\u2009sec', elapsed.toFixed(prec
ise ? 1 : 0)); |
| 1732 } | 1732 } |
| 1733 }; | 1733 }; |
| 1734 | 1734 |
| 1735 | 1735 |
| 1736 /** | 1736 /** |
| 1737 * @implements {WebInspector.QueryParamHandler} | 1737 * @implements {Common.QueryParamHandler} |
| 1738 * @unrestricted | 1738 * @unrestricted |
| 1739 */ | 1739 */ |
| 1740 WebInspector.LoadTimelineHandler = class { | 1740 Timeline.LoadTimelineHandler = class { |
| 1741 /** | 1741 /** |
| 1742 * @override | 1742 * @override |
| 1743 * @param {string} value | 1743 * @param {string} value |
| 1744 */ | 1744 */ |
| 1745 handleQueryParam(value) { | 1745 handleQueryParam(value) { |
| 1746 WebInspector.viewManager.showView('timeline').then(() => { | 1746 UI.viewManager.showView('timeline').then(() => { |
| 1747 WebInspector.TimelinePanel.instance()._loadFromURL(window.decodeURICompone
nt(value)); | 1747 Timeline.TimelinePanel.instance()._loadFromURL(window.decodeURIComponent(v
alue)); |
| 1748 }); | 1748 }); |
| 1749 } | 1749 } |
| 1750 }; | 1750 }; |
| 1751 | 1751 |
| 1752 /** | 1752 /** |
| 1753 * @implements {WebInspector.ActionDelegate} | 1753 * @implements {UI.ActionDelegate} |
| 1754 * @unrestricted | 1754 * @unrestricted |
| 1755 */ | 1755 */ |
| 1756 WebInspector.TimelinePanel.ActionDelegate = class { | 1756 Timeline.TimelinePanel.ActionDelegate = class { |
| 1757 /** | 1757 /** |
| 1758 * @override | 1758 * @override |
| 1759 * @param {!WebInspector.Context} context | 1759 * @param {!UI.Context} context |
| 1760 * @param {string} actionId | 1760 * @param {string} actionId |
| 1761 * @return {boolean} | 1761 * @return {boolean} |
| 1762 */ | 1762 */ |
| 1763 handleAction(context, actionId) { | 1763 handleAction(context, actionId) { |
| 1764 var panel = WebInspector.context.flavor(WebInspector.TimelinePanel); | 1764 var panel = UI.context.flavor(Timeline.TimelinePanel); |
| 1765 console.assert(panel && panel instanceof WebInspector.TimelinePanel); | 1765 console.assert(panel && panel instanceof Timeline.TimelinePanel); |
| 1766 switch (actionId) { | 1766 switch (actionId) { |
| 1767 case 'timeline.toggle-recording': | 1767 case 'timeline.toggle-recording': |
| 1768 panel._toggleRecording(); | 1768 panel._toggleRecording(); |
| 1769 return true; | 1769 return true; |
| 1770 case 'timeline.save-to-file': | 1770 case 'timeline.save-to-file': |
| 1771 panel._saveToFile(); | 1771 panel._saveToFile(); |
| 1772 return true; | 1772 return true; |
| 1773 case 'timeline.load-from-file': | 1773 case 'timeline.load-from-file': |
| 1774 panel._selectFileToLoad(); | 1774 panel._selectFileToLoad(); |
| 1775 return true; | 1775 return true; |
| 1776 case 'timeline.jump-to-previous-frame': | 1776 case 'timeline.jump-to-previous-frame': |
| 1777 panel._jumpToFrame(-1); | 1777 panel._jumpToFrame(-1); |
| 1778 return true; | 1778 return true; |
| 1779 case 'timeline.jump-to-next-frame': | 1779 case 'timeline.jump-to-next-frame': |
| 1780 panel._jumpToFrame(1); | 1780 panel._jumpToFrame(1); |
| 1781 return true; | 1781 return true; |
| 1782 } | 1782 } |
| 1783 return false; | 1783 return false; |
| 1784 } | 1784 } |
| 1785 }; | 1785 }; |
| 1786 | 1786 |
| 1787 /** | 1787 /** |
| 1788 * @unrestricted | 1788 * @unrestricted |
| 1789 */ | 1789 */ |
| 1790 WebInspector.TimelineFilters = class extends WebInspector.Object { | 1790 Timeline.TimelineFilters = class extends Common.Object { |
| 1791 constructor() { | 1791 constructor() { |
| 1792 super(); | 1792 super(); |
| 1793 | 1793 |
| 1794 this._categoryFilter = new WebInspector.TimelineCategoryFilter(); | 1794 this._categoryFilter = new Timeline.TimelineCategoryFilter(); |
| 1795 this._durationFilter = new WebInspector.TimelineIsLongFilter(); | 1795 this._durationFilter = new Timeline.TimelineIsLongFilter(); |
| 1796 this._textFilter = new WebInspector.TimelineTextFilter(); | 1796 this._textFilter = new Timeline.TimelineTextFilter(); |
| 1797 this._filters = [this._categoryFilter, this._durationFilter, this._textFilte
r]; | 1797 this._filters = [this._categoryFilter, this._durationFilter, this._textFilte
r]; |
| 1798 | 1798 |
| 1799 this._createFilterBar(); | 1799 this._createFilterBar(); |
| 1800 } | 1800 } |
| 1801 | 1801 |
| 1802 /** | 1802 /** |
| 1803 * @return {!Array<!WebInspector.TimelineModel.Filter>} | 1803 * @return {!Array<!TimelineModel.TimelineModel.Filter>} |
| 1804 */ | 1804 */ |
| 1805 filters() { | 1805 filters() { |
| 1806 return this._filters; | 1806 return this._filters; |
| 1807 } | 1807 } |
| 1808 | 1808 |
| 1809 /** | 1809 /** |
| 1810 * @return {?RegExp} | 1810 * @return {?RegExp} |
| 1811 */ | 1811 */ |
| 1812 searchRegExp() { | 1812 searchRegExp() { |
| 1813 return this._textFilter._regExp; | 1813 return this._textFilter._regExp; |
| 1814 } | 1814 } |
| 1815 | 1815 |
| 1816 /** | 1816 /** |
| 1817 * @return {!WebInspector.ToolbarItem} | 1817 * @return {!UI.ToolbarItem} |
| 1818 */ | 1818 */ |
| 1819 filterButton() { | 1819 filterButton() { |
| 1820 return this._filterBar.filterButton(); | 1820 return this._filterBar.filterButton(); |
| 1821 } | 1821 } |
| 1822 | 1822 |
| 1823 /** | 1823 /** |
| 1824 * @return {!WebInspector.Widget} | 1824 * @return {!UI.Widget} |
| 1825 */ | 1825 */ |
| 1826 filtersWidget() { | 1826 filtersWidget() { |
| 1827 return this._filterBar; | 1827 return this._filterBar; |
| 1828 } | 1828 } |
| 1829 | 1829 |
| 1830 _createFilterBar() { | 1830 _createFilterBar() { |
| 1831 this._filterBar = new WebInspector.FilterBar('timelinePanel'); | 1831 this._filterBar = new UI.FilterBar('timelinePanel'); |
| 1832 | 1832 |
| 1833 this._textFilterUI = new WebInspector.TextFilterUI(); | 1833 this._textFilterUI = new UI.TextFilterUI(); |
| 1834 this._textFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterChang
ed, textFilterChanged, this); | 1834 this._textFilterUI.addEventListener(UI.FilterUI.Events.FilterChanged, textFi
lterChanged, this); |
| 1835 this._filterBar.addFilter(this._textFilterUI); | 1835 this._filterBar.addFilter(this._textFilterUI); |
| 1836 | 1836 |
| 1837 var durationOptions = []; | 1837 var durationOptions = []; |
| 1838 for (var durationMs of WebInspector.TimelineFilters._durationFilterPresetsMs
) { | 1838 for (var durationMs of Timeline.TimelineFilters._durationFilterPresetsMs) { |
| 1839 var durationOption = {}; | 1839 var durationOption = {}; |
| 1840 if (!durationMs) { | 1840 if (!durationMs) { |
| 1841 durationOption.label = WebInspector.UIString('All'); | 1841 durationOption.label = Common.UIString('All'); |
| 1842 durationOption.title = WebInspector.UIString('Show all records'); | 1842 durationOption.title = Common.UIString('Show all records'); |
| 1843 } else { | 1843 } else { |
| 1844 durationOption.label = WebInspector.UIString('\u2265 %dms', durationMs); | 1844 durationOption.label = Common.UIString('\u2265 %dms', durationMs); |
| 1845 durationOption.title = WebInspector.UIString('Hide records shorter than
%dms', durationMs); | 1845 durationOption.title = Common.UIString('Hide records shorter than %dms',
durationMs); |
| 1846 } | 1846 } |
| 1847 durationOption.value = durationMs; | 1847 durationOption.value = durationMs; |
| 1848 durationOptions.push(durationOption); | 1848 durationOptions.push(durationOption); |
| 1849 } | 1849 } |
| 1850 var durationFilterUI = new WebInspector.ComboBoxFilterUI(durationOptions); | 1850 var durationFilterUI = new UI.ComboBoxFilterUI(durationOptions); |
| 1851 durationFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterChanged
, durationFilterChanged, this); | 1851 durationFilterUI.addEventListener(UI.FilterUI.Events.FilterChanged, duration
FilterChanged, this); |
| 1852 this._filterBar.addFilter(durationFilterUI); | 1852 this._filterBar.addFilter(durationFilterUI); |
| 1853 | 1853 |
| 1854 var categoryFiltersUI = {}; | 1854 var categoryFiltersUI = {}; |
| 1855 var categories = WebInspector.TimelineUIUtils.categories(); | 1855 var categories = Timeline.TimelineUIUtils.categories(); |
| 1856 for (var categoryName in categories) { | 1856 for (var categoryName in categories) { |
| 1857 var category = categories[categoryName]; | 1857 var category = categories[categoryName]; |
| 1858 if (!category.visible) | 1858 if (!category.visible) |
| 1859 continue; | 1859 continue; |
| 1860 var filter = new WebInspector.CheckboxFilterUI(category.name, category.tit
le); | 1860 var filter = new UI.CheckboxFilterUI(category.name, category.title); |
| 1861 filter.setColor(category.color, 'rgba(0, 0, 0, 0.2)'); | 1861 filter.setColor(category.color, 'rgba(0, 0, 0, 0.2)'); |
| 1862 categoryFiltersUI[category.name] = filter; | 1862 categoryFiltersUI[category.name] = filter; |
| 1863 filter.addEventListener( | 1863 filter.addEventListener( |
| 1864 WebInspector.FilterUI.Events.FilterChanged, categoriesFilterChanged.bi
nd(this, categoryName)); | 1864 UI.FilterUI.Events.FilterChanged, categoriesFilterChanged.bind(this, c
ategoryName)); |
| 1865 this._filterBar.addFilter(filter); | 1865 this._filterBar.addFilter(filter); |
| 1866 } | 1866 } |
| 1867 return this._filterBar; | 1867 return this._filterBar; |
| 1868 | 1868 |
| 1869 /** | 1869 /** |
| 1870 * @this {WebInspector.TimelineFilters} | 1870 * @this {Timeline.TimelineFilters} |
| 1871 */ | 1871 */ |
| 1872 function textFilterChanged() { | 1872 function textFilterChanged() { |
| 1873 var searchQuery = this._textFilterUI.value(); | 1873 var searchQuery = this._textFilterUI.value(); |
| 1874 this._textFilter._setRegExp(searchQuery ? createPlainTextSearchRegex(searc
hQuery, 'i') : null); | 1874 this._textFilter._setRegExp(searchQuery ? createPlainTextSearchRegex(searc
hQuery, 'i') : null); |
| 1875 this._notifyFiltersChanged(); | 1875 this._notifyFiltersChanged(); |
| 1876 } | 1876 } |
| 1877 | 1877 |
| 1878 /** | 1878 /** |
| 1879 * @this {WebInspector.TimelineFilters} | 1879 * @this {Timeline.TimelineFilters} |
| 1880 */ | 1880 */ |
| 1881 function durationFilterChanged() { | 1881 function durationFilterChanged() { |
| 1882 var duration = durationFilterUI.value(); | 1882 var duration = durationFilterUI.value(); |
| 1883 var minimumRecordDuration = parseInt(duration, 10); | 1883 var minimumRecordDuration = parseInt(duration, 10); |
| 1884 this._durationFilter.setMinimumRecordDuration(minimumRecordDuration); | 1884 this._durationFilter.setMinimumRecordDuration(minimumRecordDuration); |
| 1885 this._notifyFiltersChanged(); | 1885 this._notifyFiltersChanged(); |
| 1886 } | 1886 } |
| 1887 | 1887 |
| 1888 /** | 1888 /** |
| 1889 * @param {string} name | 1889 * @param {string} name |
| 1890 * @this {WebInspector.TimelineFilters} | 1890 * @this {Timeline.TimelineFilters} |
| 1891 */ | 1891 */ |
| 1892 function categoriesFilterChanged(name) { | 1892 function categoriesFilterChanged(name) { |
| 1893 var categories = WebInspector.TimelineUIUtils.categories(); | 1893 var categories = Timeline.TimelineUIUtils.categories(); |
| 1894 categories[name].hidden = !categoryFiltersUI[name].checked(); | 1894 categories[name].hidden = !categoryFiltersUI[name].checked(); |
| 1895 this._notifyFiltersChanged(); | 1895 this._notifyFiltersChanged(); |
| 1896 } | 1896 } |
| 1897 } | 1897 } |
| 1898 | 1898 |
| 1899 _notifyFiltersChanged() { | 1899 _notifyFiltersChanged() { |
| 1900 this.dispatchEventToListeners(WebInspector.TimelineFilters.Events.FilterChan
ged); | 1900 this.dispatchEventToListeners(Timeline.TimelineFilters.Events.FilterChanged)
; |
| 1901 } | 1901 } |
| 1902 }; | 1902 }; |
| 1903 | 1903 |
| 1904 /** @enum {symbol} */ | 1904 /** @enum {symbol} */ |
| 1905 WebInspector.TimelineFilters.Events = { | 1905 Timeline.TimelineFilters.Events = { |
| 1906 FilterChanged: Symbol('FilterChanged') | 1906 FilterChanged: Symbol('FilterChanged') |
| 1907 }; | 1907 }; |
| 1908 | 1908 |
| 1909 WebInspector.TimelineFilters._durationFilterPresetsMs = [0, 1, 15]; | 1909 Timeline.TimelineFilters._durationFilterPresetsMs = [0, 1, 15]; |
| 1910 | 1910 |
| 1911 /** | 1911 /** |
| 1912 * @implements {WebInspector.TargetManager.Observer} | 1912 * @implements {SDK.TargetManager.Observer} |
| 1913 * @unrestricted | 1913 * @unrestricted |
| 1914 */ | 1914 */ |
| 1915 WebInspector.CPUThrottlingManager = class extends WebInspector.Object { | 1915 Timeline.CPUThrottlingManager = class extends Common.Object { |
| 1916 constructor() { | 1916 constructor() { |
| 1917 super(); | 1917 super(); |
| 1918 this._targets = []; | 1918 this._targets = []; |
| 1919 this._throttlingRate = 1.; // No throttling | 1919 this._throttlingRate = 1.; // No throttling |
| 1920 WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capabili
ty.Browser); | 1920 SDK.targetManager.observeTargets(this, SDK.Target.Capability.Browser); |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 /** | 1923 /** |
| 1924 * @param {number} value | 1924 * @param {number} value |
| 1925 */ | 1925 */ |
| 1926 setRate(value) { | 1926 setRate(value) { |
| 1927 this._throttlingRate = value; | 1927 this._throttlingRate = value; |
| 1928 this._targets.forEach(target => target.emulationAgent().setCPUThrottlingRate
(value)); | 1928 this._targets.forEach(target => target.emulationAgent().setCPUThrottlingRate
(value)); |
| 1929 if (value !== 1) | 1929 if (value !== 1) |
| 1930 WebInspector.inspectorView.setPanelIcon( | 1930 UI.inspectorView.setPanelIcon( |
| 1931 'timeline', 'smallicon-warning', WebInspector.UIString('CPU throttling
is enabled')); | 1931 'timeline', 'smallicon-warning', Common.UIString('CPU throttling is en
abled')); |
| 1932 else | 1932 else |
| 1933 WebInspector.inspectorView.setPanelIcon('timeline', '', ''); | 1933 UI.inspectorView.setPanelIcon('timeline', '', ''); |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 /** | 1936 /** |
| 1937 * @return {number} | 1937 * @return {number} |
| 1938 */ | 1938 */ |
| 1939 rate() { | 1939 rate() { |
| 1940 return this._throttlingRate; | 1940 return this._throttlingRate; |
| 1941 } | 1941 } |
| 1942 | 1942 |
| 1943 /** | 1943 /** |
| 1944 * @override | 1944 * @override |
| 1945 * @param {!WebInspector.Target} target | 1945 * @param {!SDK.Target} target |
| 1946 */ | 1946 */ |
| 1947 targetAdded(target) { | 1947 targetAdded(target) { |
| 1948 this._targets.push(target); | 1948 this._targets.push(target); |
| 1949 target.emulationAgent().setCPUThrottlingRate(this._throttlingRate); | 1949 target.emulationAgent().setCPUThrottlingRate(this._throttlingRate); |
| 1950 } | 1950 } |
| 1951 | 1951 |
| 1952 /** | 1952 /** |
| 1953 * @override | 1953 * @override |
| 1954 * @param {!WebInspector.Target} target | 1954 * @param {!SDK.Target} target |
| 1955 */ | 1955 */ |
| 1956 targetRemoved(target) { | 1956 targetRemoved(target) { |
| 1957 this._targets.remove(target, true); | 1957 this._targets.remove(target, true); |
| 1958 } | 1958 } |
| 1959 }; | 1959 }; |
| 1960 | 1960 |
| 1961 /** | 1961 /** |
| 1962 * @unrestricted | 1962 * @unrestricted |
| 1963 */ | 1963 */ |
| 1964 WebInspector.TimelinePanel.CustomCPUThrottlingRateDialog = class extends WebInsp
ector.HBox { | 1964 Timeline.TimelinePanel.CustomCPUThrottlingRateDialog = class extends UI.HBox { |
| 1965 constructor() { | 1965 constructor() { |
| 1966 super(true); | 1966 super(true); |
| 1967 this.registerRequiredCSS('ui_lazy/dialog.css'); | 1967 this.registerRequiredCSS('ui_lazy/dialog.css'); |
| 1968 this.contentElement.createChild('label').textContent = WebInspector.UIString
('CPU Slowdown Rate: '); | 1968 this.contentElement.createChild('label').textContent = Common.UIString('CPU
Slowdown Rate: '); |
| 1969 | 1969 |
| 1970 this._input = this.contentElement.createChild('input'); | 1970 this._input = this.contentElement.createChild('input'); |
| 1971 this._input.setAttribute('type', 'text'); | 1971 this._input.setAttribute('type', 'text'); |
| 1972 this._input.style.width = '64px'; | 1972 this._input.style.width = '64px'; |
| 1973 this._input.addEventListener('keydown', this._onKeyDown.bind(this), false); | 1973 this._input.addEventListener('keydown', this._onKeyDown.bind(this), false); |
| 1974 | 1974 |
| 1975 var addButton = this.contentElement.createChild('button'); | 1975 var addButton = this.contentElement.createChild('button'); |
| 1976 addButton.textContent = WebInspector.UIString('Set'); | 1976 addButton.textContent = Common.UIString('Set'); |
| 1977 addButton.addEventListener('click', this._apply.bind(this), false); | 1977 addButton.addEventListener('click', this._apply.bind(this), false); |
| 1978 | 1978 |
| 1979 this.setDefaultFocusedElement(this._input); | 1979 this.setDefaultFocusedElement(this._input); |
| 1980 this.contentElement.tabIndex = 0; | 1980 this.contentElement.tabIndex = 0; |
| 1981 this._resultPromise = new Promise(fulfill => this._callback = fulfill); | 1981 this._resultPromise = new Promise(fulfill => this._callback = fulfill); |
| 1982 } | 1982 } |
| 1983 | 1983 |
| 1984 /** | 1984 /** |
| 1985 * @param {!Element=} anchor | 1985 * @param {!Element=} anchor |
| 1986 * @return {!Promise<string>} | 1986 * @return {!Promise<string>} |
| 1987 */ | 1987 */ |
| 1988 static show(anchor) { | 1988 static show(anchor) { |
| 1989 var dialog = new WebInspector.Dialog(); | 1989 var dialog = new UI.Dialog(); |
| 1990 var dialogContent = new WebInspector.TimelinePanel.CustomCPUThrottlingRateDi
alog(); | 1990 var dialogContent = new Timeline.TimelinePanel.CustomCPUThrottlingRateDialog
(); |
| 1991 dialogContent.show(dialog.element); | 1991 dialogContent.show(dialog.element); |
| 1992 dialog.setWrapsContent(true); | 1992 dialog.setWrapsContent(true); |
| 1993 if (anchor) | 1993 if (anchor) |
| 1994 dialog.setPosition(anchor.totalOffsetLeft() - 32, anchor.totalOffsetTop()
+ anchor.offsetHeight); | 1994 dialog.setPosition(anchor.totalOffsetLeft() - 32, anchor.totalOffsetTop()
+ anchor.offsetHeight); |
| 1995 dialog.show(); | 1995 dialog.show(); |
| 1996 return dialogContent.result().then(value => (dialog.detach(), value)); | 1996 return dialogContent.result().then(value => (dialog.detach(), value)); |
| 1997 } | 1997 } |
| 1998 | 1998 |
| 1999 /** | 1999 /** |
| 2000 * @return {!Promise<string>} | 2000 * @return {!Promise<string>} |
| 2001 */ | 2001 */ |
| 2002 result() { | 2002 result() { |
| 2003 return this._resultPromise; | 2003 return this._resultPromise; |
| 2004 } | 2004 } |
| 2005 | 2005 |
| 2006 _apply() { | 2006 _apply() { |
| 2007 this._callback(this._input.value); | 2007 this._callback(this._input.value); |
| 2008 } | 2008 } |
| 2009 | 2009 |
| 2010 /** | 2010 /** |
| 2011 * @param {!Event} event | 2011 * @param {!Event} event |
| 2012 */ | 2012 */ |
| 2013 _onKeyDown(event) { | 2013 _onKeyDown(event) { |
| 2014 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code) { | 2014 if (event.keyCode === UI.KeyboardShortcut.Keys.Enter.code) { |
| 2015 event.preventDefault(); | 2015 event.preventDefault(); |
| 2016 this._apply(); | 2016 this._apply(); |
| 2017 } | 2017 } |
| 2018 } | 2018 } |
| 2019 }; | 2019 }; |
| OLD | NEW |