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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 323 } | 323 } |
| 324 this._currentViews = []; | 324 this._currentViews = []; |
| 325 this._stackView.detachChildViews(); | 325 this._stackView.detachChildViews(); |
| 326 }, | 326 }, |
| 327 | 327 |
| 328 _createRecordingOptions: function() | 328 _createRecordingOptions: function() |
| 329 { | 329 { |
| 330 var topPaneSidebarElement = this._topPane.sidebarElement(); | 330 var topPaneSidebarElement = this._topPane.sidebarElement(); |
| 331 | 331 |
| 332 this._captureStacksSetting = WebInspector.settings.createSetting("timeli neCaptureStacks", true); | 332 this._captureStacksSetting = WebInspector.settings.createSetting("timeli neCaptureStacks", true); |
| 333 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingC heckbox(WebInspector.UIString("Capture stacks"), | 333 |
| 334 this._captureStacksSetting, true, unde fined, | 334 this._recordingOptionUIControls = []; |
| 335 WebInspector.UIString("Capture JavaScr ipt stack on every timeline event"))); | 335 captureStacksCheckbox = document.createElement("input"); |
| 336 captureStacksLabel = WebInspector.SettingsUI.createSettingCheckbox(WebIn spector.UIString("Capture stacks"), | |
| 337 this. _captureStacksSetting, true, captureStacksCheckbox, | |
| 338 WebIn spector.UIString("Capture JavaScript stack on every timeline event")) | |
| 339 this._recordingOptionUIControls.push({ "label": captureStacksLabel, "che ckbox": captureStacksCheckbox }); | |
| 340 topPaneSidebarElement.appendChild(captureStacksLabel); | |
| 336 | 341 |
| 337 this._captureMemorySetting = WebInspector.settings.createSetting("timeli neCaptureMemory", false); | 342 this._captureMemorySetting = WebInspector.settings.createSetting("timeli neCaptureMemory", false); |
| 338 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingC heckbox(WebInspector.UIString("Capture memory"), | 343 captureMemoryCheckbox = document.createElement("input"); |
| 339 this._captureMemorySetting, true, unde fined, | 344 captureMemoryLabel = WebInspector.SettingsUI.createSettingCheckbox(WebIn spector.UIString("Capture memory"), |
| 340 WebInspector.UIString("Capture memory information on every timeline event"))); | 345 this. _captureMemorySetting, true, captureMemoryCheckbox, |
| 346 WebIn spector.UIString("Capture memory information on every timeline event")); | |
| 347 this._recordingOptionUIControls.push({ "label": captureMemoryLabel, "che ckbox": captureMemoryCheckbox }); | |
| 348 topPaneSidebarElement.appendChild(captureMemoryLabel); | |
| 341 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); | 349 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); |
| 342 | 350 |
| 343 if (Capabilities.canProfilePower) { | 351 if (Capabilities.canProfilePower) { |
| 344 this._capturePowerSetting = WebInspector.settings.createSetting("tim elineCapturePower", false); | 352 this._capturePowerSetting = WebInspector.settings.createSetting("tim elineCapturePower", false); |
| 345 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett ingCheckbox(WebInspector.UIString("Capture power"), | 353 capturePowerCheckbox = document.createElement("input"); |
| 346 this._capturePowerSetting, true, u ndefined, | 354 capturePowerLabel = WebInspector.SettingsUI.createSettingCheckbox(We bInspector.UIString("Capture power"), |
| 347 WebInspector.UIString("Capture pow er information"))); | 355 th is._capturePowerSetting, true, capturePowerCheckbox, |
| 356 We bInspector.UIString("Capture power information")); | |
| 357 this._recordingOptionUIControls.push({ "label": capturePowerLabel, " checkbox": capturePowerCheckbox }); | |
| 358 topPaneSidebarElement.appendChild(capturePowerLabel); | |
| 348 this._capturePowerSetting.addChangeListener(this._onModeChanged, thi s); | 359 this._capturePowerSetting.addChangeListener(this._onModeChanged, thi s); |
| 349 } | 360 } |
| 350 | 361 |
| 351 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) { | 362 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) { |
| 352 this._captureTracingSetting = WebInspector.settings.createSetting("t imelineCaptureTracing", false); | 363 this._captureTracingSetting = WebInspector.settings.createSetting("t imelineCaptureTracing", false); |
| 353 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett ingCheckbox(WebInspector.UIString("Capture tracing"), | 364 captureTracingCheckbox = document.createElement("input"); |
| 354 this._captureTracingSetting, true, undefined, | 365 captureTracingLabel = WebInspector.SettingsUI.createSettingCheckbox( WebInspector.UIString("Capture... tracing"), |
| 355 WebInspector.UIString("Capture tra cing information"))); | 366 this._captureTracingSetting, true, captureTracingCheckbox, |
| 367 WebInspector.UIString("Capture tracing information")); | |
| 368 this._recordingOptionUIControls.push({ "label": captureTracingLabel, "checkbox": captureTracingCheckbox }); | |
| 369 topPaneSidebarElement.appendChild(captureTracingLabel); | |
| 356 this._captureTracingSetting.addChangeListener(this._onModeChanged, t his); | 370 this._captureTracingSetting.addChangeListener(this._onModeChanged, t his); |
| 357 } else if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnab led()) { | 371 } else if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnab led()) { |
| 358 this._captureLayersAndPicturesSetting = WebInspector.settings.create Setting("timelineCaptureLayersAndPictures", false); | 372 this._captureLayersAndPicturesSetting = WebInspector.settings.create Setting("timelineCaptureLayersAndPictures", false); |
| 359 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett ingCheckbox(WebInspector.UIString("Capture pictures"), | 373 captureLayersAndPicturesCheckbox = document.createElement("input"); |
| 360 this._captureLayersAndPicturesSett ing, true, undefined, | 374 captureLayersAndPicturesLabel = WebInspector.SettingsUI.createSettin gCheckbox(WebInspector.UIString("Capture pictures"), |
| 361 WebInspector.UIString("Capture gra phics layer positions and painted pictures"))); | 375 this._captureLayersAndPicturesSetting, true, captureLayersAndPicturesC heckbox, |
| 376 WebInspector.UIString("Capture graphics layer positions and painted pi ctures")); | |
| 377 this._recordingOptionUIControls.push({ "label": captureLayersAndPict uresLabel, "checkbox": captureLayersAndPicturesCheckbox }); | |
| 378 topPaneSidebarElement.appendChild(captureLayersAndPicturesLabel); | |
|
aandrey
2014/07/03 08:25:37
now let's extract common code to a method, like: t
vivekg
2014/07/03 10:36:22
Done.
| |
| 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 this._recordingOptionUIControls.forEach(function(uiControl) { | |
| 689 uiControl.checkbox.disabled = disabled; | |
| 690 if (disabled) | |
| 691 uiControl.label.classList.add("disabled-label"); | |
| 692 else | |
| 693 uiControl.label.classList.remove("disabled-label"); | |
| 694 }); | |
| 695 WebInspector.inspectorView.setCurrentPanelLocked(disabled); | |
| 696 }, | |
| 697 | |
| 698 /** | |
| 668 * @param {boolean} userInitiated | 699 * @param {boolean} userInitiated |
| 669 */ | 700 */ |
| 670 _startRecording: function(userInitiated) | 701 _startRecording: function(userInitiated) |
| 671 { | 702 { |
| 672 this._userInitiatedRecording = userInitiated; | 703 this._userInitiatedRecording = userInitiated; |
| 673 this._model.startRecording(this._captureStacksSetting.get(), this._captu reMemorySetting.get(), this._captureLayersAndPicturesSetting && this._captureLay ersAndPicturesSetting.get()); | 704 this._model.startRecording(this._captureStacksSetting.get(), this._captu reMemorySetting.get(), this._captureLayersAndPicturesSetting && this._captureLay ersAndPicturesSetting.get()); |
| 674 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel) | 705 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel) |
| 675 this._lazyFrameModel.setMergeRecords(false); | 706 this._lazyFrameModel.setMergeRecords(false); |
| 676 | 707 |
| 677 for (var i = 0; i < this._overviewControls.length; ++i) | 708 for (var i = 0; i < this._overviewControls.length; ++i) |
| 678 this._overviewControls[i].timelineStarted(); | 709 this._overviewControls[i].timelineStarted(); |
| 679 | 710 |
| 680 if (userInitiated) | 711 if (userInitiated) |
| 681 WebInspector.userMetrics.TimelineStarted.record(); | 712 WebInspector.userMetrics.TimelineStarted.record(); |
| 682 WebInspector.inspectorView.setCurrentPanelLocked(true); | 713 this._disableUIControls(true); |
| 683 }, | 714 }, |
| 684 | 715 |
| 685 _stopRecording: function() | 716 _stopRecording: function() |
| 686 { | 717 { |
| 687 this._stopPending = true; | 718 this._stopPending = true; |
| 688 this._updateToggleTimelineButton(false); | 719 this._updateToggleTimelineButton(false); |
| 689 this._userInitiatedRecording = false; | 720 this._userInitiatedRecording = false; |
| 690 this._model.stopRecording(); | 721 this._model.stopRecording(); |
| 691 if (this._progressElement) | 722 if (this._progressElement) |
| 692 this._updateProgress(WebInspector.UIString("Retrieving events\u2026" )); | 723 this._updateProgress(WebInspector.UIString("Retrieving events\u2026" )); |
| 693 | 724 |
| 694 for (var i = 0; i < this._overviewControls.length; ++i) | 725 for (var i = 0; i < this._overviewControls.length; ++i) |
| 695 this._overviewControls[i].timelineStopped(); | 726 this._overviewControls[i].timelineStopped(); |
| 696 WebInspector.inspectorView.setCurrentPanelLocked(false); | 727 this._disableUIControls(false); |
| 697 }, | 728 }, |
| 698 | 729 |
| 699 _onProfilingStateChanged: function() | 730 _onProfilingStateChanged: function() |
| 700 { | 731 { |
| 701 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); | 732 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); |
| 702 }, | 733 }, |
| 703 | 734 |
| 704 /** | 735 /** |
| 705 * @param {boolean} toggled | 736 * @param {boolean} toggled |
| 706 */ | 737 */ |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1445 * @param {!WebInspector.TimelineModel.Record} record | 1476 * @param {!WebInspector.TimelineModel.Record} record |
| 1446 * @return {boolean} | 1477 * @return {boolean} |
| 1447 */ | 1478 */ |
| 1448 accept: function(record) | 1479 accept: function(record) |
| 1449 { | 1480 { |
| 1450 return !this._regex || this._uiUtils.testContentMatching(record, this._r egex); | 1481 return !this._regex || this._uiUtils.testContentMatching(record, this._r egex); |
| 1451 }, | 1482 }, |
| 1452 | 1483 |
| 1453 __proto__: WebInspector.TimelineModel.Filter.prototype | 1484 __proto__: WebInspector.TimelineModel.Filter.prototype |
| 1454 } | 1485 } |
| OLD | NEW |