| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 } | 284 } |
| 285 | 285 |
| 286 _recreateToolbarItems() { | 286 _recreateToolbarItems() { |
| 287 this._panelToolbar.removeToolbarItems(); | 287 this._panelToolbar.removeToolbarItems(); |
| 288 | 288 |
| 289 const perspectiveSetting = | 289 const perspectiveSetting = |
| 290 Common.settings.createSetting('timelinePerspective', Timeline.TimelinePa
nel.Perspectives.Load); | 290 Common.settings.createSetting('timelinePerspective', Timeline.TimelinePa
nel.Perspectives.Load); |
| 291 | 291 |
| 292 // Record | 292 // Record |
| 293 if (Runtime.experiments.isEnabled('timelineLandingPage')) { | 293 if (Runtime.experiments.isEnabled('timelineLandingPage')) { |
| 294 const newButton = new UI.ToolbarButton( | 294 const newButton = new UI.ToolbarButton(Common.UIString('New recording'), '
largeicon-add', Common.UIString('New')); |
| 295 Common.UIString('New recording'), 'largeicon-add', Common.UIString('Ne
w')); | |
| 296 newButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, thi
s); | 295 newButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, thi
s); |
| 297 this._panelToolbar.appendToolbarItem(newButton); | 296 this._panelToolbar.appendToolbarItem(newButton); |
| 298 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('m
ain.reload')); | 297 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('m
ain.reload')); |
| 299 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t
oggleRecordAction)); | 298 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t
oggleRecordAction)); |
| 300 } else if (Runtime.experiments.isEnabled('timelineRecordingPerspectives') && | 299 } else if ( |
| 300 Runtime.experiments.isEnabled('timelineRecordingPerspectives') && |
| 301 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Load) { | 301 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Load) { |
| 302 const reloadButton = new UI.ToolbarButton(Common.UIString('Record & Reload
'), 'largeicon-refresh'); | 302 const reloadButton = new UI.ToolbarButton(Common.UIString('Record & Reload
'), 'largeicon-refresh'); |
| 303 reloadButton.addEventListener(UI.ToolbarButton.Events.Click, () => SDK.tar
getManager.reloadPage()); | 303 reloadButton.addEventListener(UI.ToolbarButton.Events.Click, () => SDK.tar
getManager.reloadPage()); |
| 304 this._panelToolbar.appendToolbarItem(reloadButton); | 304 this._panelToolbar.appendToolbarItem(reloadButton); |
| 305 } else { | 305 } else { |
| 306 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t
oggleRecordAction)); | 306 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t
oggleRecordAction)); |
| 307 } | 307 } |
| 308 | 308 |
| 309 // Clear | 309 // Clear |
| 310 if (!Runtime.experiments.isEnabled('timelineLandingPage')) { | 310 if (!Runtime.experiments.isEnabled('timelineLandingPage')) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 break; | 371 break; |
| 372 } | 372 } |
| 373 | 373 |
| 374 this._bulkUpdate = false; | 374 this._bulkUpdate = false; |
| 375 this._onModeChanged(); | 375 this._onModeChanged(); |
| 376 } | 376 } |
| 377 | 377 |
| 378 // Checkboxes | 378 // Checkboxes |
| 379 if (Runtime.experiments.isEnabled('timelineLandingPage')) { | 379 if (Runtime.experiments.isEnabled('timelineLandingPage')) { |
| 380 if (!this._model.isEmpty()) { | 380 if (!this._model.isEmpty()) { |
| 381 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(Common.
UIString('Memory'), | 381 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 382 this._showMemorySetting, Common.UIString('Show memory timeline.'))); | 382 Common.UIString('Memory'), this._showMemorySetting, Common.UIString(
'Show memory timeline.'))); |
| 383 if (this._filmStripModel.frames().length) { | 383 if (this._filmStripModel.frames().length) { |
| 384 this._showScreenshotsSetting.set(true); | 384 this._showScreenshotsSetting.set(true); |
| 385 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(Commo
n.UIString('Screenshots'), | 385 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| 386 this._showScreenshotsSetting, Common.UIString('Show captured scree
nshots.'))); | 386 Common.UIString('Screenshots'), this._showScreenshotsSetting, |
| 387 Common.UIString('Show captured screenshots.'))); |
| 387 } | 388 } |
| 388 } | 389 } |
| 389 } else { | 390 } else { |
| 390 const screenshotCheckbox = this._createSettingCheckbox( | 391 const screenshotCheckbox = this._createSettingCheckbox( |
| 391 Common.UIString('Screenshots'), this._captureFilmStripSetting, | 392 Common.UIString('Screenshots'), this._captureFilmStripSetting, |
| 392 Common.UIString('Capture screenshots while recording. (Has small perfo
rmance overhead)')); | 393 Common.UIString('Capture screenshots while recording. (Has small perfo
rmance overhead)')); |
| 393 | 394 |
| 394 if (!Runtime.experiments.isEnabled('timelineRecordingPerspectives') || | 395 if (!Runtime.experiments.isEnabled('timelineRecordingPerspectives') || |
| 395 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Custo
m) { | 396 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Custo
m) { |
| 396 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( | 397 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 } | 559 } |
| 559 | 560 |
| 560 _refreshViews() { | 561 _refreshViews() { |
| 561 this._currentViews.forEach(view => view.refreshRecords()); | 562 this._currentViews.forEach(view => view.refreshRecords()); |
| 562 this._updateSelectionDetails(); | 563 this._updateSelectionDetails(); |
| 563 } | 564 } |
| 564 | 565 |
| 565 _onModeChanged() { | 566 _onModeChanged() { |
| 566 if (this._bulkUpdate) | 567 if (this._bulkUpdate) |
| 567 return; | 568 return; |
| 568 const showMemory = Runtime.experiments.isEnabled('timelineLandingPage') | 569 const showMemory = Runtime.experiments.isEnabled('timelineLandingPage') ? th
is._showMemorySetting.get() : |
| 569 ? this._showMemorySetting.get() : this._captureMemorySetting.get(); | 570 th
is._captureMemorySetting.get(); |
| 570 const showScreenshots = Runtime.experiments.isEnabled('timelineLandingPage') | 571 const showScreenshots = Runtime.experiments.isEnabled('timelineLandingPage')
? |
| 571 ? this._showScreenshotsSetting.get() && this._filmStripModel.frames().le
ngth | 572 this._showScreenshotsSetting.get() && this._filmStripModel.frames().leng
th : |
| 572 : this._captureFilmStripSetting.get(); | 573 this._captureFilmStripSetting.get(); |
| 573 // Set up overview controls. | 574 // Set up overview controls. |
| 574 this._overviewControls = []; | 575 this._overviewControls = []; |
| 575 this._overviewControls.push(new Timeline.TimelineEventOverviewResponsiveness
(this._model, this._frameModel)); | 576 this._overviewControls.push(new Timeline.TimelineEventOverviewResponsiveness
(this._model, this._frameModel)); |
| 576 if (Runtime.experiments.isEnabled('inputEventsOnTimelineOverview')) | 577 if (Runtime.experiments.isEnabled('inputEventsOnTimelineOverview')) |
| 577 this._overviewControls.push(new Timeline.TimelineEventOverviewInput(this._
model)); | 578 this._overviewControls.push(new Timeline.TimelineEventOverviewInput(this._
model)); |
| 578 this._overviewControls.push(new Timeline.TimelineEventOverviewFrames(this._m
odel, this._frameModel)); | 579 this._overviewControls.push(new Timeline.TimelineEventOverviewFrames(this._m
odel, this._frameModel)); |
| 579 this._overviewControls.push(new Timeline.TimelineEventOverviewCPUActivity(th
is._model)); | 580 this._overviewControls.push(new Timeline.TimelineEventOverviewCPUActivity(th
is._model)); |
| 580 this._overviewControls.push(new Timeline.TimelineEventOverviewNetwork(this._
model)); | 581 this._overviewControls.push(new Timeline.TimelineEventOverviewNetwork(this._
model)); |
| 581 if (showScreenshots) | 582 if (showScreenshots) |
| 582 this._overviewControls.push(new Timeline.TimelineFilmStripOverview(this._m
odel, this._filmStripModel)); | 583 this._overviewControls.push(new Timeline.TimelineFilmStripOverview(this._m
odel, this._filmStripModel)); |
| 583 if (showMemory) | 584 if (showMemory) |
| 584 this._overviewControls.push(new Timeline.TimelineEventOverviewMemory(this.
_model)); | 585 this._overviewControls.push(new Timeline.TimelineEventOverviewMemory(this.
_model)); |
| 585 this._overviewPane.setOverviewControls(this._overviewControls); | 586 this._overviewPane.setOverviewControls(this._overviewControls); |
| 586 | 587 |
| 587 // Set up the main view. | 588 // Set up the main view. |
| 588 this._removeAllModeViews(); | 589 this._removeAllModeViews(); |
| 589 this._flameChart = new Timeline.TimelineFlameChartView( | 590 this._flameChart = new Timeline.TimelineFlameChartView( |
| 590 this, this._model, this._frameModel, this._irModel, this._extensionTraci
ngModels, this._filters); | 591 this, this._model, this._frameModel, this._irModel, this._extensionTraci
ngModels, this._filters); |
| 591 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get()); | 592 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get()); |
| 592 this._addModeView(this._flameChart); | 593 this._addModeView(this._flameChart); |
| 593 | 594 |
| 594 if (showMemory) { | 595 if (showMemory) { |
| 595 this._addModeView(new Timeline.MemoryCountersGraph( | 596 this._addModeView( |
| 596 this, this._model, [Timeline.TimelineUIUtils.visibleEventsFilter()])); | 597 new Timeline.MemoryCountersGraph(this, this._model, [Timeline.Timeline
UIUtils.visibleEventsFilter()])); |
| 597 } | 598 } |
| 598 if (Runtime.experiments.isEnabled('timelineLandingPage')) | 599 if (Runtime.experiments.isEnabled('timelineLandingPage')) |
| 599 this._flameChart.enableNetworkPane(true); | 600 this._flameChart.enableNetworkPane(true); |
| 600 | 601 |
| 601 this.doResize(); | 602 this.doResize(); |
| 602 this.select(null); | 603 this.select(null); |
| 603 } | 604 } |
| 604 | 605 |
| 605 _onNetworkChanged() { | 606 _onNetworkChanged() { |
| 606 if (this._flameChart) | 607 if (this._flameChart) |
| (...skipping 1445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 this._throttlingRate = 1.; // No throttling | 2053 this._throttlingRate = 1.; // No throttling |
| 2053 SDK.targetManager.observeTargets(this, SDK.Target.Capability.Browser); | 2054 SDK.targetManager.observeTargets(this, SDK.Target.Capability.Browser); |
| 2054 } | 2055 } |
| 2055 | 2056 |
| 2056 /** | 2057 /** |
| 2057 * @param {number} value | 2058 * @param {number} value |
| 2058 */ | 2059 */ |
| 2059 setRate(value) { | 2060 setRate(value) { |
| 2060 this._throttlingRate = value; | 2061 this._throttlingRate = value; |
| 2061 this._targets.forEach(target => target.emulationAgent().setCPUThrottlingRate
(value)); | 2062 this._targets.forEach(target => target.emulationAgent().setCPUThrottlingRate
(value)); |
| 2062 if (value !== 1) | 2063 var icon = null; |
| 2063 UI.inspectorView.setPanelIcon('timeline', 'smallicon-warning', Common.UISt
ring('CPU throttling is enabled')); | 2064 if (value !== 1) { |
| 2064 else | 2065 icon = UI.Icon.create('smallicon-warning'); |
| 2065 UI.inspectorView.setPanelIcon('timeline', '', ''); | 2066 icon.title = Common.UIString('CPU throttling is enabled'); |
| 2067 } |
| 2068 UI.inspectorView.setPanelIcon('timeline', icon); |
| 2066 } | 2069 } |
| 2067 | 2070 |
| 2068 /** | 2071 /** |
| 2069 * @return {number} | 2072 * @return {number} |
| 2070 */ | 2073 */ |
| 2071 rate() { | 2074 rate() { |
| 2072 return this._throttlingRate; | 2075 return this._throttlingRate; |
| 2073 } | 2076 } |
| 2074 | 2077 |
| 2075 /** | 2078 /** |
| 2076 * @override | 2079 * @override |
| 2077 * @param {!SDK.Target} target | 2080 * @param {!SDK.Target} target |
| 2078 */ | 2081 */ |
| 2079 targetAdded(target) { | 2082 targetAdded(target) { |
| 2080 this._targets.push(target); | 2083 this._targets.push(target); |
| 2081 target.emulationAgent().setCPUThrottlingRate(this._throttlingRate); | 2084 target.emulationAgent().setCPUThrottlingRate(this._throttlingRate); |
| 2082 } | 2085 } |
| 2083 | 2086 |
| 2084 /** | 2087 /** |
| 2085 * @override | 2088 * @override |
| 2086 * @param {!SDK.Target} target | 2089 * @param {!SDK.Target} target |
| 2087 */ | 2090 */ |
| 2088 targetRemoved(target) { | 2091 targetRemoved(target) { |
| 2089 this._targets.remove(target, true); | 2092 this._targets.remove(target, true); |
| 2090 } | 2093 } |
| 2091 }; | 2094 }; |
| OLD | NEW |