| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 this._currentViews[i].dispose(); | 279 this._currentViews[i].dispose(); |
| 280 } | 280 } |
| 281 this._currentViews = []; | 281 this._currentViews = []; |
| 282 this._stackView.detachChildViews(); | 282 this._stackView.detachChildViews(); |
| 283 }, | 283 }, |
| 284 | 284 |
| 285 /** | 285 /** |
| 286 * @param {string} name | 286 * @param {string} name |
| 287 * @param {!WebInspector.Setting} setting | 287 * @param {!WebInspector.Setting} setting |
| 288 * @param {string} tooltip | 288 * @param {string} tooltip |
| 289 * @return {!Element} | 289 * @return {!WebInspector.StatusBarItem} |
| 290 */ | 290 */ |
| 291 _createSettingCheckbox: function(name, setting, tooltip) | 291 _createSettingCheckbox: function(name, setting, tooltip) |
| 292 { | 292 { |
| 293 if (!this._recordingOptionUIControls) | 293 if (!this._recordingOptionUIControls) |
| 294 this._recordingOptionUIControls = []; | 294 this._recordingOptionUIControls = []; |
| 295 | 295 var checkboxItem = new WebInspector.StatusBarCheckbox(name, tooltip, set
ting); |
| 296 var checkboxElement = createElement("input"); | 296 this._recordingOptionUIControls.push(checkboxItem); |
| 297 var labelElement = WebInspector.SettingsUI.createSettingCheckbox(name, s
etting, true, checkboxElement, tooltip); | 297 return checkboxItem; |
| 298 this._recordingOptionUIControls.push({ "label": labelElement, "checkbox"
: checkboxElement }); | |
| 299 return labelElement; | |
| 300 }, | 298 }, |
| 301 | 299 |
| 302 _createStatusBarItems: function() | 300 _createStatusBarItems: function() |
| 303 { | 301 { |
| 304 var panelStatusBarElement = this.element.createChild("div", "panel-statu
s-bar"); | 302 this._panelToolbar = new WebInspector.StatusBar(this.element); |
| 305 this._statusBarButtons = /** @type {!Array.<!WebInspector.StatusBarItem>
} */ ([]); | |
| 306 | 303 |
| 307 this.toggleTimelineButton = new WebInspector.StatusBarButton("Record tim
eline", "record-profile-status-bar-item"); | 304 this.toggleTimelineButton = new WebInspector.StatusBarButton("Record tim
eline", "record-profile-status-bar-item"); |
| 308 this.toggleTimelineButton.addEventListener("click", this._toggleTimeline
ButtonClicked, this); | 305 this.toggleTimelineButton.addEventListener("click", this._toggleTimeline
ButtonClicked, this); |
| 309 this._statusBarButtons.push(this.toggleTimelineButton); | 306 this._panelToolbar.appendStatusBarItem(this.toggleTimelineButton); |
| 310 panelStatusBarElement.appendChild(this.toggleTimelineButton.element); | |
| 311 this._updateToggleTimelineButton(false); | 307 this._updateToggleTimelineButton(false); |
| 312 | 308 |
| 313 var clearButton = new WebInspector.StatusBarButton(WebInspector.UIString
("Clear recording"), "clear-status-bar-item"); | 309 var clearButton = new WebInspector.StatusBarButton(WebInspector.UIString
("Clear recording"), "clear-status-bar-item"); |
| 314 clearButton.addEventListener("click", this._onClearButtonClick, this); | 310 clearButton.addEventListener("click", this._onClearButtonClick, this); |
| 315 this._statusBarButtons.push(clearButton); | 311 this._panelToolbar.appendStatusBarItem(clearButton); |
| 316 panelStatusBarElement.appendChild(clearButton.element); | |
| 317 | 312 |
| 318 this._filterBar = this._createFilterBar(); | 313 this._filterBar = this._createFilterBar(); |
| 319 panelStatusBarElement.appendChild(this._filterBar.filterButton().element
); | 314 this._panelToolbar.appendStatusBarItem(this._filterBar.filterButton()); |
| 320 | 315 |
| 321 var garbageCollectButton = new WebInspector.StatusBarButton(WebInspector
.UIString("Collect garbage"), "timeline-garbage-collect-status-bar-item"); | 316 var garbageCollectButton = new WebInspector.StatusBarButton(WebInspector
.UIString("Collect garbage"), "timeline-garbage-collect-status-bar-item"); |
| 322 garbageCollectButton.addEventListener("click", this._garbageCollectButto
nClicked, this); | 317 garbageCollectButton.addEventListener("click", this._garbageCollectButto
nClicked, this); |
| 323 this._statusBarButtons.push(garbageCollectButton); | 318 this._panelToolbar.appendStatusBarItem(garbageCollectButton); |
| 324 panelStatusBarElement.appendChild(garbageCollectButton.element); | |
| 325 | 319 |
| 326 var framesToggleButton = new WebInspector.StatusBarButton(WebInspector.U
IString("Frames view. (Activity split into frames)"), "timeline-frames-status-ba
r-item"); | 320 var framesToggleButton = new WebInspector.StatusBarButton(WebInspector.U
IString("Frames view. (Activity split into frames)"), "timeline-frames-status-ba
r-item"); |
| 327 framesToggleButton.setToggled(this._overviewModeSetting.get() === WebIns
pector.TimelinePanel.OverviewMode.Frames); | 321 framesToggleButton.setToggled(this._overviewModeSetting.get() === WebIns
pector.TimelinePanel.OverviewMode.Frames); |
| 328 framesToggleButton.addEventListener("click", this._overviewModeChanged.b
ind(this, framesToggleButton)); | 322 framesToggleButton.addEventListener("click", this._overviewModeChanged.b
ind(this, framesToggleButton)); |
| 329 this._statusBarButtons.push(framesToggleButton); | 323 this._panelToolbar.appendStatusBarItem(framesToggleButton); |
| 330 panelStatusBarElement.appendChild(framesToggleButton.element); | |
| 331 | 324 |
| 332 this._flameChartToggleButton = new WebInspector.StatusBarButton(WebInspe
ctor.UIString("Flame chart view. (Use WASD or time selection to navigate)"), "ti
meline-flame-chart-status-bar-item"); | 325 this._flameChartToggleButton = new WebInspector.StatusBarButton(WebInspe
ctor.UIString("Flame chart view. (Use WASD or time selection to navigate)"), "ti
meline-flame-chart-status-bar-item"); |
| 333 this._flameChartToggleButton.setToggled(this._flameChartEnabledSetting.g
et()); | 326 this._flameChartToggleButton.setToggled(this._flameChartEnabledSetting.g
et()); |
| 334 this._flameChartToggleButton.addEventListener("click", this._flameChartE
nabledChanged.bind(this)); | 327 this._flameChartToggleButton.addEventListener("click", this._flameChartE
nabledChanged.bind(this)); |
| 335 this._statusBarButtons.push(this._flameChartToggleButton); | 328 this._panelToolbar.appendStatusBarItem(this._flameChartToggleButton); |
| 336 panelStatusBarElement.appendChild(this._flameChartToggleButton.element); | |
| 337 | 329 |
| 338 this._captureCausesSetting = WebInspector.settings.createSetting("timeli
neCaptureCauses", true); | 330 this._captureCausesSetting = WebInspector.settings.createSetting("timeli
neCaptureCauses", true); |
| 339 this._captureCausesSetting.addChangeListener(this._refreshViews, this); | 331 this._captureCausesSetting.addChangeListener(this._refreshViews, this); |
| 340 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspect
or.UIString("Causes"), | 332 this._panelToolbar.appendStatusBarItem(this._createSettingCheckbox(WebIn
spector.UIString("Causes"), |
| 341 this._capt
ureCausesSetting, | 333 this._capt
ureCausesSetting, |
| 342 WebInspect
or.UIString("Capture causes (e.g., stack traces) for timeline events. (Has perfo
rmance overhead)"))); | 334 WebInspect
or.UIString("Capture causes (e.g., stack traces) for timeline events. (Has perfo
rmance overhead)"))); |
| 343 if (Runtime.experiments.isEnabled("timelineJSCPUProfile")) { | 335 if (Runtime.experiments.isEnabled("timelineJSCPUProfile")) { |
| 344 this._enableJSSamplingSettingSetting = WebInspector.settings.createS
etting("timelineEnableJSSampling", false); | 336 this._enableJSSamplingSettingSetting = WebInspector.settings.createS
etting("timelineEnableJSSampling", false); |
| 345 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebIns
pector.UIString("JS Profiler"), | 337 this._panelToolbar.appendStatusBarItem(this._createSettingCheckbox(W
ebInspector.UIString("JS Profiler"), |
| 346 this._
enableJSSamplingSettingSetting, | 338 this._
enableJSSamplingSettingSetting, |
| 347 WebIns
pector.UIString("Enable JavaScript sampling profiler. (Has performance overhead)
"))); | 339 WebIns
pector.UIString("Enable JavaScript sampling profiler. (Has performance overhead)
"))); |
| 348 } | 340 } |
| 349 this._captureMemorySetting = WebInspector.settings.createSetting("timeli
neCaptureMemory", false); | 341 this._captureMemorySetting = WebInspector.settings.createSetting("timeli
neCaptureMemory", false); |
| 350 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspect
or.UIString("Memory"), | 342 this._panelToolbar.appendStatusBarItem(this._createSettingCheckbox(WebIn
spector.UIString("Memory"), |
| 351 this._capt
ureMemorySetting, | 343 this._capt
ureMemorySetting, |
| 352 WebInspect
or.UIString("Capture memory information on every timeline event"))); | 344 WebInspect
or.UIString("Capture memory information on every timeline event"))); |
| 353 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); | 345 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); |
| 354 if (Runtime.experiments.isEnabled("timelinePowerProfiler") && | 346 if (Runtime.experiments.isEnabled("timelinePowerProfiler") && |
| 355 WebInspector.targetManager.mainTarget().hasCapability(WebInspector.T
arget.Capabilities.CanProfilePower)) { | 347 WebInspector.targetManager.mainTarget().hasCapability(WebInspector.T
arget.Capabilities.CanProfilePower)) { |
| 356 this._capturePowerSetting = WebInspector.settings.createSetting("tim
elineCapturePower", false); | 348 this._capturePowerSetting = WebInspector.settings.createSetting("tim
elineCapturePower", false); |
| 357 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebIns
pector.UIString("Power"), | 349 this._panelToolbar.appendStatusBarItem(this._createSettingCheckbox(W
ebInspector.UIString("Power"), |
| 358 this._
capturePowerSetting, | 350 this._
capturePowerSetting, |
| 359 WebIns
pector.UIString("Capture power information"))); | 351 WebIns
pector.UIString("Capture power information"))); |
| 360 this._capturePowerSetting.addChangeListener(this._onModeChanged, thi
s); | 352 this._capturePowerSetting.addChangeListener(this._onModeChanged, thi
s); |
| 361 } | 353 } |
| 362 this._captureLayersAndPicturesSetting = WebInspector.settings.createSett
ing("timelineCaptureLayersAndPictures", false); | 354 this._captureLayersAndPicturesSetting = WebInspector.settings.createSett
ing("timelineCaptureLayersAndPictures", false); |
| 363 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspect
or.UIString("Paint"), | 355 this._panelToolbar.appendStatusBarItem(this._createSettingCheckbox(WebIn
spector.UIString("Paint"), |
| 364 this._capt
ureLayersAndPicturesSetting, | 356 this._capt
ureLayersAndPicturesSetting, |
| 365 WebInspect
or.UIString("Capture graphics layer positions and painted pictures. (Has perfor
mance overhead)"))); | 357 WebInspect
or.UIString("Capture graphics layer positions and painted pictures. (Has perfor
mance overhead)"))); |
| 366 | 358 |
| 367 this._miscStatusBarItems = panelStatusBarElement.createChild("div", "sta
tus-bar-item"); | 359 this._progressStatusBarItem = new WebInspector.StatusBarItem(createEleme
nt("div")); |
| 360 this._progressStatusBarItem.setVisible(false); |
| 361 this._panelToolbar.appendStatusBarItem(this._progressStatusBarItem); |
| 368 | 362 |
| 369 this._filtersContainer = this.element.createChild("div", "timeline-filte
rs-header hidden"); | 363 this._filtersContainer = this.element.createChild("div", "timeline-filte
rs-header hidden"); |
| 370 this._filtersContainer.appendChild(this._filterBar.filtersElement()); | 364 this._filtersContainer.appendChild(this._filterBar.filtersElement()); |
| 371 this._filterBar.addEventListener(WebInspector.FilterBar.Events.FiltersTo
ggled, this._onFiltersToggled, this); | 365 this._filterBar.addEventListener(WebInspector.FilterBar.Events.FiltersTo
ggled, this._onFiltersToggled, this); |
| 372 this._filterBar.setName("timelinePanel"); | 366 this._filterBar.setName("timelinePanel"); |
| 373 }, | 367 }, |
| 374 | 368 |
| 375 /** | 369 /** |
| 376 * @return {!WebInspector.FilterBar} | 370 * @return {!WebInspector.FilterBar} |
| 377 */ | 371 */ |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 this._setOperationInProgress(progressIndicator); | 464 this._setOperationInProgress(progressIndicator); |
| 471 return progressIndicator; | 465 return progressIndicator; |
| 472 }, | 466 }, |
| 473 | 467 |
| 474 /** | 468 /** |
| 475 * @param {?WebInspector.ProgressIndicator} indicator | 469 * @param {?WebInspector.ProgressIndicator} indicator |
| 476 */ | 470 */ |
| 477 _setOperationInProgress: function(indicator) | 471 _setOperationInProgress: function(indicator) |
| 478 { | 472 { |
| 479 this._operationInProgress = !!indicator; | 473 this._operationInProgress = !!indicator; |
| 480 for (var i = 0; i < this._statusBarButtons.length; ++i) | 474 this._panelToolbar.setEnabled(!this._operationInProgress); |
| 481 this._statusBarButtons[i].setEnabled(!this._operationInProgress); | 475 |
| 482 this._miscStatusBarItems.removeChildren(); | 476 this._progressStatusBarItem.setVisible(this._operationInProgress); |
| 477 this._progressStatusBarItem.element.removeChildren(); |
| 483 if (indicator) | 478 if (indicator) |
| 484 this._miscStatusBarItems.appendChild(indicator.element); | 479 this._progressStatusBarItem.element.appendChild(indicator.element); |
| 485 }, | 480 }, |
| 486 | 481 |
| 487 _registerShortcuts: function() | 482 _registerShortcuts: function() |
| 488 { | 483 { |
| 489 this.registerShortcuts(WebInspector.ShortcutsScreen.TimelinePanelShortcu
ts.StartStopRecording, this._toggleTimelineButtonClicked.bind(this)); | 484 this.registerShortcuts(WebInspector.ShortcutsScreen.TimelinePanelShortcu
ts.StartStopRecording, this._toggleTimelineButtonClicked.bind(this)); |
| 490 this.registerShortcuts(WebInspector.ShortcutsScreen.TimelinePanelShortcu
ts.SaveToFile, this._saveToFile.bind(this)); | 485 this.registerShortcuts(WebInspector.ShortcutsScreen.TimelinePanelShortcu
ts.SaveToFile, this._saveToFile.bind(this)); |
| 491 this.registerShortcuts(WebInspector.ShortcutsScreen.TimelinePanelShortcu
ts.LoadFromFile, this._selectFileToLoad.bind(this)); | 486 this.registerShortcuts(WebInspector.ShortcutsScreen.TimelinePanelShortcu
ts.LoadFromFile, this._selectFileToLoad.bind(this)); |
| 492 }, | 487 }, |
| 493 | 488 |
| 494 _createFileSelector: function() | 489 _createFileSelector: function() |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 this._selection = null; | 612 this._selection = null; |
| 618 this._updateSelectionDetails(); | 613 this._updateSelectionDetails(); |
| 619 | 614 |
| 620 this._stackView.show(this._searchableView.element); | 615 this._stackView.show(this._searchableView.element); |
| 621 }, | 616 }, |
| 622 | 617 |
| 623 /** | 618 /** |
| 624 * @param {boolean} enabled | 619 * @param {boolean} enabled |
| 625 */ | 620 */ |
| 626 _setUIControlsEnabled: function(enabled) { | 621 _setUIControlsEnabled: function(enabled) { |
| 627 function handler(uiControl) | 622 /** |
| 623 * @param {!WebInspector.StatusBarButton} statusBarItem |
| 624 */ |
| 625 function handler(statusBarItem) |
| 628 { | 626 { |
| 629 uiControl.checkbox.disabled = !enabled; | 627 statusBarItem.setEnabled(enabled); |
| 630 uiControl.label.classList.toggle("dimmed", !enabled); | |
| 631 } | 628 } |
| 632 this._recordingOptionUIControls.forEach(handler); | 629 this._recordingOptionUIControls.forEach(handler); |
| 633 }, | 630 }, |
| 634 | 631 |
| 635 /** | 632 /** |
| 636 * @param {boolean} userInitiated | 633 * @param {boolean} userInitiated |
| 637 */ | 634 */ |
| 638 _startRecording: function(userInitiated) | 635 _startRecording: function(userInitiated) |
| 639 { | 636 { |
| 640 this._userInitiatedRecording = userInitiated; | 637 this._userInitiatedRecording = userInitiated; |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 | 1466 |
| 1470 WebInspector.TimelinePanelFactory.prototype = { | 1467 WebInspector.TimelinePanelFactory.prototype = { |
| 1471 /** | 1468 /** |
| 1472 * @return {!WebInspector.Panel} | 1469 * @return {!WebInspector.Panel} |
| 1473 */ | 1470 */ |
| 1474 createPanel: function() | 1471 createPanel: function() |
| 1475 { | 1472 { |
| 1476 return WebInspector.TimelinePanel._instance(); | 1473 return WebInspector.TimelinePanel._instance(); |
| 1477 } | 1474 } |
| 1478 } | 1475 } |
| OLD | NEW |