Chromium Code Reviews| 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 _removeAllModeViews: function() | 318 _removeAllModeViews: function() |
| 319 { | 319 { |
| 320 for (var i = 0; i < this._currentViews.length; ++i) { | 320 for (var i = 0; i < this._currentViews.length; ++i) { |
| 321 this._currentViews[i].removeEventListener(WebInspector.SplitView.Eve nts.SidebarSizeChanged, this._sidebarResized, this); | 321 this._currentViews[i].removeEventListener(WebInspector.SplitView.Eve nts.SidebarSizeChanged, this._sidebarResized, this); |
| 322 this._currentViews[i].dispose(); | 322 this._currentViews[i].dispose(); |
| 323 } | 323 } |
| 324 this._currentViews = []; | 324 this._currentViews = []; |
| 325 this._stackView.detachChildViews(); | 325 this._stackView.detachChildViews(); |
| 326 }, | 326 }, |
| 327 | 327 |
| 328 /** | |
| 329 * @param {string} name | |
| 330 * @param {!WebInspector.Setting} setting | |
| 331 * @param {string} tooltip | |
| 332 * @return {!Element} | |
| 333 */ | |
| 334 _createSettingCheckbox: function(name, setting, tooltip) | |
| 335 { | |
| 336 if (!this._recordingOptionUIControls) | |
| 337 this._recordingOptionUIControls = []; | |
| 338 | |
| 339 var checkboxElement = document.createElement("input"); | |
| 340 var labelElement = WebInspector.SettingsUI.createSettingCheckbox(name, s etting, true, checkboxElement, tooltip); | |
| 341 this._recordingOptionUIControls.push({ "label": labelElement, "checkbox" : checkboxElement }); | |
| 342 return labelElement; | |
| 343 }, | |
| 344 | |
| 328 _createRecordingOptions: function() | 345 _createRecordingOptions: function() |
| 329 { | 346 { |
| 330 var topPaneSidebarElement = this._topPane.sidebarElement(); | 347 var topPaneSidebarElement = this._topPane.sidebarElement(); |
| 331 | 348 |
| 332 this._captureStacksSetting = WebInspector.settings.createSetting("timeli neCaptureStacks", true); | 349 this._captureStacksSetting = WebInspector.settings.createSetting("timeli neCaptureStacks", true); |
| 333 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingC heckbox(WebInspector.UIString("Capture stacks"), | 350 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebInspect or.UIString("Capture stacks"), |
| 334 this._captureStacksSetting, true, unde fined, | 351 this._capt ureStacksSetting, |
| 335 WebInspector.UIString("Capture JavaScr ipt stack on every timeline event"))); | 352 WebInspect or.UIString("Capture JavaScript stack on every timeline event"))); |
| 336 | 353 |
| 337 this._captureMemorySetting = WebInspector.settings.createSetting("timeli neCaptureMemory", false); | 354 this._captureMemorySetting = WebInspector.settings.createSetting("timeli neCaptureMemory", false); |
| 338 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingC heckbox(WebInspector.UIString("Capture memory"), | 355 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebInspect or.UIString("Capture memory"), |
| 339 this._captureMemorySetting, true, unde fined, | 356 this._capt ureMemorySetting, |
| 340 WebInspector.UIString("Capture memory information on every timeline event"))); | 357 WebInspect or.UIString("Capture memory information on every timeline event"))); |
| 341 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); | 358 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); |
| 342 | 359 |
| 343 if (Capabilities.canProfilePower) { | 360 if (Capabilities.canProfilePower) { |
| 344 this._capturePowerSetting = WebInspector.settings.createSetting("tim elineCapturePower", false); | 361 this._capturePowerSetting = WebInspector.settings.createSetting("tim elineCapturePower", false); |
| 345 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett ingCheckbox(WebInspector.UIString("Capture power"), | 362 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebIns pector.UIString("Capture power"), |
| 346 this._capturePowerSetting, true, u ndefined, | 363 this._ capturePowerSetting, |
| 347 WebInspector.UIString("Capture pow er information"))); | 364 WebIns pector.UIString("Capture power information"))); |
| 348 this._capturePowerSetting.addChangeListener(this._onModeChanged, thi s); | 365 this._capturePowerSetting.addChangeListener(this._onModeChanged, thi s); |
| 349 } | 366 } |
| 350 | 367 |
| 351 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) { | 368 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) { |
| 352 this._captureTracingSetting = WebInspector.settings.createSetting("t imelineCaptureTracing", false); | 369 this._captureTracingSetting = WebInspector.settings.createSetting("t imelineCaptureTracing", false); |
| 353 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett ingCheckbox(WebInspector.UIString("Capture tracing"), | 370 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebIns pector.UIString("Capture tracing"), |
| 354 this._captureTracingSetting, true, undefined, | 371 this._ captureTracingSetting, |
| 355 WebInspector.UIString("Capture tra cing information"))); | 372 WebIns pector.UIString("Capture tracing information"))); |
| 356 this._captureTracingSetting.addChangeListener(this._onModeChanged, t his); | 373 this._captureTracingSetting.addChangeListener(this._onModeChanged, t his); |
| 357 } else if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnab led()) { | 374 } else if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnab led()) { |
| 358 this._captureLayersAndPicturesSetting = WebInspector.settings.create Setting("timelineCaptureLayersAndPictures", false); | 375 this._captureLayersAndPicturesSetting = WebInspector.settings.create Setting("timelineCaptureLayersAndPictures", false); |
| 359 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett ingCheckbox(WebInspector.UIString("Capture pictures"), | 376 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebIns pector.UIString("Capture pictures"), |
| 360 this._captureLayersAndPicturesSett ing, true, undefined, | 377 this._ captureLayersAndPicturesSetting, |
| 361 WebInspector.UIString("Capture gra phics layer positions and painted pictures"))); | 378 WebIns pector.UIString("Capture graphics layer positions and painted pictures"))); |
| 362 } | 379 } |
| 363 }, | 380 }, |
| 364 | 381 |
| 365 _createStatusBarItems: function() | 382 _createStatusBarItems: function() |
| 366 { | 383 { |
| 367 var panelStatusBarElement = this.element.createChild("div", "panel-statu s-bar"); | 384 var panelStatusBarElement = this.element.createChild("div", "panel-statu s-bar"); |
| 368 this._statusBarButtons = /** @type {!Array.<!WebInspector.StatusBarItem> } */ ([]); | 385 this._statusBarButtons = /** @type {!Array.<!WebInspector.StatusBarItem> } */ ([]); |
| 369 | 386 |
| 370 this.toggleTimelineButton = new WebInspector.StatusBarButton("", "record -profile-status-bar-item"); | 387 this.toggleTimelineButton = new WebInspector.StatusBarButton("", "record -profile-status-bar-item"); |
| 371 this.toggleTimelineButton.addEventListener("click", this._toggleTimeline ButtonClicked, this); | 388 this.toggleTimelineButton.addEventListener("click", this._toggleTimeline ButtonClicked, this); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 | 675 |
| 659 this._timelineView().setFrameModel(isFrameMode ? this._frameModel() : nu ll); | 676 this._timelineView().setFrameModel(isFrameMode ? this._frameModel() : nu ll); |
| 660 this._overviewPane.setOverviewControls(this._overviewControls); | 677 this._overviewPane.setOverviewControls(this._overviewControls); |
| 661 this.doResize(); | 678 this.doResize(); |
| 662 this._updateSelectedRangeStats(); | 679 this._updateSelectedRangeStats(); |
| 663 | 680 |
| 664 this._stackView.show(this._searchableView.element); | 681 this._stackView.show(this._searchableView.element); |
| 665 }, | 682 }, |
| 666 | 683 |
| 667 /** | 684 /** |
| 685 * @param {boolean} disabled | |
| 686 */ | |
| 687 _disableUIControls: function(disabled) { | |
| 688 function handler(uiControl) | |
| 689 { | |
| 690 uiControl.checkbox.disabled = disabled; | |
| 691 uiControl.label.classList.toggle("dimmed", disabled); | |
| 692 } | |
| 693 this._recordingOptionUIControls.forEach(handler); | |
| 694 WebInspector.inspectorView.setCurrentPanelLocked(disabled); | |
| 695 }, | |
| 696 | |
| 697 /** | |
| 668 * @param {boolean} userInitiated | 698 * @param {boolean} userInitiated |
| 669 */ | 699 */ |
| 670 _startRecording: function(userInitiated) | 700 _startRecording: function(userInitiated) |
| 671 { | 701 { |
| 672 this._userInitiatedRecording = userInitiated; | 702 this._userInitiatedRecording = userInitiated; |
| 673 this._model.startRecording(this._captureStacksSetting.get(), this._captu reMemorySetting.get(), this._captureLayersAndPicturesSetting && this._captureLay ersAndPicturesSetting.get()); | 703 this._model.startRecording(this._captureStacksSetting.get(), this._captu reMemorySetting.get(), this._captureLayersAndPicturesSetting && this._captureLay ersAndPicturesSetting.get()); |
| 674 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel) | 704 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel) |
| 675 this._lazyFrameModel.setMergeRecords(false); | 705 this._lazyFrameModel.setMergeRecords(false); |
| 676 | 706 |
| 677 for (var i = 0; i < this._overviewControls.length; ++i) | 707 for (var i = 0; i < this._overviewControls.length; ++i) |
| 678 this._overviewControls[i].timelineStarted(); | 708 this._overviewControls[i].timelineStarted(); |
| 679 | 709 |
| 680 if (userInitiated) | 710 if (userInitiated) |
| 681 WebInspector.userMetrics.TimelineStarted.record(); | 711 WebInspector.userMetrics.TimelineStarted.record(); |
| 682 WebInspector.inspectorView.setCurrentPanelLocked(true); | 712 this._disableUIControls(true); |
|
loislo
2014/07/03 13:00:48
Please change the name to positive logic: this._se
| |
| 683 }, | 713 }, |
| 684 | 714 |
| 685 _stopRecording: function() | 715 _stopRecording: function() |
| 686 { | 716 { |
| 687 this._stopPending = true; | 717 this._stopPending = true; |
| 688 this._updateToggleTimelineButton(false); | 718 this._updateToggleTimelineButton(false); |
| 689 this._userInitiatedRecording = false; | 719 this._userInitiatedRecording = false; |
| 690 this._model.stopRecording(); | 720 this._model.stopRecording(); |
| 691 if (this._progressElement) | 721 if (this._progressElement) |
| 692 this._updateProgress(WebInspector.UIString("Retrieving events\u2026" )); | 722 this._updateProgress(WebInspector.UIString("Retrieving events\u2026" )); |
| 693 | 723 |
| 694 for (var i = 0; i < this._overviewControls.length; ++i) | 724 for (var i = 0; i < this._overviewControls.length; ++i) |
| 695 this._overviewControls[i].timelineStopped(); | 725 this._overviewControls[i].timelineStopped(); |
| 696 WebInspector.inspectorView.setCurrentPanelLocked(false); | 726 this._disableUIControls(false); |
| 697 }, | 727 }, |
| 698 | 728 |
| 699 _onProfilingStateChanged: function() | 729 _onProfilingStateChanged: function() |
| 700 { | 730 { |
| 701 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); | 731 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); |
| 702 }, | 732 }, |
| 703 | 733 |
| 704 /** | 734 /** |
| 705 * @param {boolean} toggled | 735 * @param {boolean} toggled |
| 706 */ | 736 */ |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1445 * @param {!WebInspector.TimelineModel.Record} record | 1475 * @param {!WebInspector.TimelineModel.Record} record |
| 1446 * @return {boolean} | 1476 * @return {boolean} |
| 1447 */ | 1477 */ |
| 1448 accept: function(record) | 1478 accept: function(record) |
| 1449 { | 1479 { |
| 1450 return !this._regex || this._uiUtils.testContentMatching(record, this._r egex); | 1480 return !this._regex || this._uiUtils.testContentMatching(record, this._r egex); |
| 1451 }, | 1481 }, |
| 1452 | 1482 |
| 1453 __proto__: WebInspector.TimelineModel.Filter.prototype | 1483 __proto__: WebInspector.TimelineModel.Filter.prototype |
| 1454 } | 1484 } |
| OLD | NEW |