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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 _removeAllModeViews: function() | 317 _removeAllModeViews: function() |
318 { | 318 { |
319 for (var i = 0; i < this._currentViews.length; ++i) { | 319 for (var i = 0; i < this._currentViews.length; ++i) { |
320 this._currentViews[i].removeEventListener(WebInspector.SplitView.Eve
nts.SidebarSizeChanged, this._sidebarResized, this); | 320 this._currentViews[i].removeEventListener(WebInspector.SplitView.Eve
nts.SidebarSizeChanged, this._sidebarResized, this); |
321 this._currentViews[i].dispose(); | 321 this._currentViews[i].dispose(); |
322 } | 322 } |
323 this._currentViews = []; | 323 this._currentViews = []; |
324 this._stackView.detachChildViews(); | 324 this._stackView.detachChildViews(); |
325 }, | 325 }, |
326 | 326 |
| 327 /** |
| 328 * @param {string} name |
| 329 * @param {!WebInspector.Setting} setting |
| 330 * @param {string} tooltip |
| 331 * @return {!Element} |
| 332 */ |
| 333 _createSettingCheckbox: function(name, setting, tooltip) |
| 334 { |
| 335 if (!this._recordingOptionUIControls) |
| 336 this._recordingOptionUIControls = []; |
| 337 |
| 338 var checkboxElement = document.createElement("input"); |
| 339 var labelElement = WebInspector.SettingsUI.createSettingCheckbox(name, s
etting, true, checkboxElement, tooltip); |
| 340 this._recordingOptionUIControls.push({ "label": labelElement, "checkbox"
: checkboxElement }); |
| 341 return labelElement; |
| 342 }, |
| 343 |
327 _createRecordingOptions: function() | 344 _createRecordingOptions: function() |
328 { | 345 { |
329 var topPaneSidebarElement = this._topPane.sidebarElement(); | 346 var topPaneSidebarElement = this._topPane.sidebarElement(); |
330 this._captureStacksSetting = WebInspector.settings.createSetting("timeli
neCaptureStacks", true); | 347 this._captureStacksSetting = WebInspector.settings.createSetting("timeli
neCaptureStacks", true); |
331 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingC
heckbox(WebInspector.UIString("Capture stacks"), | 348 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebInspect
or.UIString("Capture stacks"), |
332 this._captureStacksSetting, true, unde
fined, | 349 this._capt
ureStacksSetting, |
333 WebInspector.UIString("Capture JavaScr
ipt stack on every timeline event"))); | 350 WebInspect
or.UIString("Capture JavaScript stack on every timeline event"))); |
334 | 351 |
335 this._captureMemorySetting = WebInspector.settings.createSetting("timeli
neCaptureMemory", false); | 352 this._captureMemorySetting = WebInspector.settings.createSetting("timeli
neCaptureMemory", false); |
336 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingC
heckbox(WebInspector.UIString("Capture memory"), | 353 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebInspect
or.UIString("Capture memory"), |
337 this._captureMemorySetting, true, unde
fined, | 354 this._capt
ureMemorySetting, |
338 WebInspector.UIString("Capture memory
information on every timeline event"))); | 355 WebInspect
or.UIString("Capture memory information on every timeline event"))); |
339 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); | 356 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); |
340 | 357 |
341 if (Capabilities.canProfilePower) { | 358 if (Capabilities.canProfilePower) { |
342 this._capturePowerSetting = WebInspector.settings.createSetting("tim
elineCapturePower", false); | 359 this._capturePowerSetting = WebInspector.settings.createSetting("tim
elineCapturePower", false); |
343 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett
ingCheckbox(WebInspector.UIString("Capture power"), | 360 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebIns
pector.UIString("Capture power"), |
344 this._capturePowerSetting, true, u
ndefined, | 361 this._
capturePowerSetting, |
345 WebInspector.UIString("Capture pow
er information"))); | 362 WebIns
pector.UIString("Capture power information"))); |
346 this._capturePowerSetting.addChangeListener(this._onModeChanged, thi
s); | 363 this._capturePowerSetting.addChangeListener(this._onModeChanged, thi
s); |
347 } | 364 } |
348 | 365 |
349 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) { | 366 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) { |
350 this._captureTracingSetting = WebInspector.settings.createSetting("t
imelineCaptureTracing", false); | 367 this._captureTracingSetting = WebInspector.settings.createSetting("t
imelineCaptureTracing", false); |
351 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett
ingCheckbox(WebInspector.UIString("Capture tracing"), | 368 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebIns
pector.UIString("Capture tracing"), |
352 this._captureTracingSetting, true,
undefined, | 369 this._
captureTracingSetting, |
353 WebInspector.UIString("Capture tra
cing information"))); | 370 WebIns
pector.UIString("Capture tracing information"))); |
354 this._captureTracingSetting.addChangeListener(this._onModeChanged, t
his); | 371 this._captureTracingSetting.addChangeListener(this._onModeChanged, t
his); |
355 } else if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnab
led()) { | 372 } else if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnab
led()) { |
356 this._captureLayersAndPicturesSetting = WebInspector.settings.create
Setting("timelineCaptureLayersAndPictures", false); | 373 this._captureLayersAndPicturesSetting = WebInspector.settings.create
Setting("timelineCaptureLayersAndPictures", false); |
357 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett
ingCheckbox(WebInspector.UIString("Capture pictures"), | 374 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebIns
pector.UIString("Capture pictures"), |
358 this._captureLayersAndPicturesSett
ing, true, undefined, | 375 this._
captureLayersAndPicturesSetting, |
359 WebInspector.UIString("Capture gra
phics layer positions and painted pictures"))); | 376 WebIns
pector.UIString("Capture graphics layer positions and painted pictures"))); |
360 } | 377 } |
361 }, | 378 }, |
362 | 379 |
363 _createStatusBarItems: function() | 380 _createStatusBarItems: function() |
364 { | 381 { |
365 var panelStatusBarElement = this.element.createChild("div", "panel-statu
s-bar"); | 382 var panelStatusBarElement = this.element.createChild("div", "panel-statu
s-bar"); |
366 this._statusBarButtons = /** @type {!Array.<!WebInspector.StatusBarItem>
} */ ([]); | 383 this._statusBarButtons = /** @type {!Array.<!WebInspector.StatusBarItem>
} */ ([]); |
367 | 384 |
368 this.toggleTimelineButton = new WebInspector.StatusBarButton("", "record
-profile-status-bar-item"); | 385 this.toggleTimelineButton = new WebInspector.StatusBarButton("", "record
-profile-status-bar-item"); |
369 this.toggleTimelineButton.addEventListener("click", this._toggleTimeline
ButtonClicked, this); | 386 this.toggleTimelineButton.addEventListener("click", this._toggleTimeline
ButtonClicked, this); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 this._lazyTimelineView.setFrameModel(isFrameMode ? this._frameModel(
) : null); | 675 this._lazyTimelineView.setFrameModel(isFrameMode ? this._frameModel(
) : null); |
659 | 676 |
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} enabled |
| 686 */ |
| 687 _setUIControlsEnabled: function(enabled) { |
| 688 function handler(uiControl) |
| 689 { |
| 690 uiControl.checkbox.disabled = !enabled; |
| 691 uiControl.label.classList.toggle("dimmed", !enabled); |
| 692 } |
| 693 this._recordingOptionUIControls.forEach(handler); |
| 694 WebInspector.inspectorView.setCurrentPanelLocked(!enabled); |
| 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._setUIControlsEnabled(false); |
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._setUIControlsEnabled(true); |
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 |