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 | 317 |
318 this._filterBar = this._createFilterBar(); | 318 this._filterBar = this._createFilterBar(); |
319 panelStatusBarElement.appendChild(this._filterBar.filterButton().element
); | 319 panelStatusBarElement.appendChild(this._filterBar.filterButton().element
); |
320 | 320 |
321 var garbageCollectButton = new WebInspector.StatusBarButton(WebInspector
.UIString("Collect garbage"), "timeline-garbage-collect-status-bar-item"); | 321 var garbageCollectButton = new WebInspector.StatusBarButton(WebInspector
.UIString("Collect garbage"), "timeline-garbage-collect-status-bar-item"); |
322 garbageCollectButton.addEventListener("click", this._garbageCollectButto
nClicked, this); | 322 garbageCollectButton.addEventListener("click", this._garbageCollectButto
nClicked, this); |
323 this._statusBarButtons.push(garbageCollectButton); | 323 this._statusBarButtons.push(garbageCollectButton); |
324 panelStatusBarElement.appendChild(garbageCollectButton.element); | 324 panelStatusBarElement.appendChild(garbageCollectButton.element); |
325 | 325 |
326 var framesToggleButton = new WebInspector.StatusBarButton(WebInspector.U
IString("Frames view. (Activity split into frames)"), "timeline-frames-status-ba
r-item"); | 326 var framesToggleButton = new WebInspector.StatusBarButton(WebInspector.U
IString("Frames view. (Activity split into frames)"), "timeline-frames-status-ba
r-item"); |
327 framesToggleButton.toggled = this._overviewModeSetting.get() === WebInsp
ector.TimelinePanel.OverviewMode.Frames; | 327 framesToggleButton.setToggled(this._overviewModeSetting.get() === WebIns
pector.TimelinePanel.OverviewMode.Frames); |
328 framesToggleButton.addEventListener("click", this._overviewModeChanged.b
ind(this, framesToggleButton)); | 328 framesToggleButton.addEventListener("click", this._overviewModeChanged.b
ind(this, framesToggleButton)); |
329 this._statusBarButtons.push(framesToggleButton); | 329 this._statusBarButtons.push(framesToggleButton); |
330 panelStatusBarElement.appendChild(framesToggleButton.element); | 330 panelStatusBarElement.appendChild(framesToggleButton.element); |
331 | 331 |
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"); | 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"); |
333 this._flameChartToggleButton.toggled = this._flameChartEnabledSetting.ge
t(); | 333 this._flameChartToggleButton.setToggled(this._flameChartEnabledSetting.g
et()); |
334 this._flameChartToggleButton.addEventListener("click", this._flameChartE
nabledChanged.bind(this)); | 334 this._flameChartToggleButton.addEventListener("click", this._flameChartE
nabledChanged.bind(this)); |
335 this._statusBarButtons.push(this._flameChartToggleButton); | 335 this._statusBarButtons.push(this._flameChartToggleButton); |
336 panelStatusBarElement.appendChild(this._flameChartToggleButton.element); | 336 panelStatusBarElement.appendChild(this._flameChartToggleButton.element); |
337 | 337 |
338 this._captureCausesSetting = WebInspector.settings.createSetting("timeli
neCaptureCauses", true); | 338 this._captureCausesSetting = WebInspector.settings.createSetting("timeli
neCaptureCauses", true); |
339 this._captureCausesSetting.addChangeListener(this._refreshViews, this); | 339 this._captureCausesSetting.addChangeListener(this._refreshViews, this); |
340 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspect
or.UIString("Causes"), | 340 panelStatusBarElement.appendChild(this._createSettingCheckbox(WebInspect
or.UIString("Causes"), |
341 this._capt
ureCausesSetting, | 341 this._capt
ureCausesSetting, |
342 WebInspect
or.UIString("Capture causes (e.g., stack traces) for timeline events. (Has perfo
rmance overhead)"))); | 342 WebInspect
or.UIString("Capture causes (e.g., stack traces) for timeline events. (Has perfo
rmance overhead)"))); |
343 if (Runtime.experiments.isEnabled("timelineJSCPUProfile")) { | 343 if (Runtime.experiments.isEnabled("timelineJSCPUProfile")) { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 }, | 549 }, |
550 | 550 |
551 /** | 551 /** |
552 * @param {!WebInspector.StatusBarButton} button | 552 * @param {!WebInspector.StatusBarButton} button |
553 */ | 553 */ |
554 _overviewModeChanged: function(button) | 554 _overviewModeChanged: function(button) |
555 { | 555 { |
556 var oldMode = this._overviewModeSetting.get(); | 556 var oldMode = this._overviewModeSetting.get(); |
557 if (oldMode === WebInspector.TimelinePanel.OverviewMode.Events) { | 557 if (oldMode === WebInspector.TimelinePanel.OverviewMode.Events) { |
558 this._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMod
e.Frames); | 558 this._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMod
e.Frames); |
559 button.toggled = true; | 559 button.setToggled(true); |
560 } else { | 560 } else { |
561 this._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMod
e.Events); | 561 this._overviewModeSetting.set(WebInspector.TimelinePanel.OverviewMod
e.Events); |
562 button.toggled = false; | 562 button.setToggled(false); |
563 } | 563 } |
564 this._onModeChanged(); | 564 this._onModeChanged(); |
565 }, | 565 }, |
566 | 566 |
567 _flameChartEnabledChanged: function() | 567 _flameChartEnabledChanged: function() |
568 { | 568 { |
569 var oldValue = this._flameChartEnabledSetting.get(); | 569 var oldValue = this._flameChartEnabledSetting.get(); |
570 var newValue = !oldValue; | 570 var newValue = !oldValue; |
571 this._flameChartEnabledSetting.set(newValue); | 571 this._flameChartEnabledSetting.set(newValue); |
572 this._flameChartToggleButton.toggled = newValue; | 572 this._flameChartToggleButton.setToggled(newValue); |
573 this._onModeChanged(); | 573 this._onModeChanged(); |
574 }, | 574 }, |
575 | 575 |
576 _onModeChanged: function() | 576 _onModeChanged: function() |
577 { | 577 { |
578 this._stackView.detach(); | 578 this._stackView.detach(); |
579 | 579 |
580 var isFrameMode = this._overviewModeSetting.get() === WebInspector.Timel
inePanel.OverviewMode.Frames; | 580 var isFrameMode = this._overviewModeSetting.get() === WebInspector.Timel
inePanel.OverviewMode.Frames; |
581 this._removeAllModeViews(); | 581 this._removeAllModeViews(); |
582 this._overviewControls = []; | 582 this._overviewControls = []; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 if (this._progressElement) | 660 if (this._progressElement) |
661 this._updateProgress(WebInspector.UIString("Retrieving events\u2026"
)); | 661 this._updateProgress(WebInspector.UIString("Retrieving events\u2026"
)); |
662 | 662 |
663 for (var i = 0; i < this._overviewControls.length; ++i) | 663 for (var i = 0; i < this._overviewControls.length; ++i) |
664 this._overviewControls[i].timelineStopped(); | 664 this._overviewControls[i].timelineStopped(); |
665 this._setUIControlsEnabled(true); | 665 this._setUIControlsEnabled(true); |
666 }, | 666 }, |
667 | 667 |
668 _onSuspendStateChanged: function() | 668 _onSuspendStateChanged: function() |
669 { | 669 { |
670 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); | 670 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled()); |
671 }, | 671 }, |
672 | 672 |
673 /** | 673 /** |
674 * @param {boolean} toggled | 674 * @param {boolean} toggled |
675 */ | 675 */ |
676 _updateToggleTimelineButton: function(toggled) | 676 _updateToggleTimelineButton: function(toggled) |
677 { | 677 { |
678 this.toggleTimelineButton.toggled = toggled; | 678 this.toggleTimelineButton.setToggled(toggled); |
679 if (toggled) { | 679 if (toggled) { |
680 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); | 680 this.toggleTimelineButton.setTitle(WebInspector.UIString("Stop")); |
681 this.toggleTimelineButton.setEnabled(true); | 681 this.toggleTimelineButton.setEnabled(true); |
682 } else if (this._stopPending) { | 682 } else if (this._stopPending) { |
683 this.toggleTimelineButton.title = WebInspector.UIString("Stop pendin
g"); | 683 this.toggleTimelineButton.setTitle(WebInspector.UIString("Stop pendi
ng")); |
684 this.toggleTimelineButton.setEnabled(false); | 684 this.toggleTimelineButton.setEnabled(false); |
685 } else if (WebInspector.targetManager.allTargetsSuspended()) { | 685 } else if (WebInspector.targetManager.allTargetsSuspended()) { |
686 this.toggleTimelineButton.title = WebInspector.anotherProfilerActive
Label(); | 686 this.toggleTimelineButton.setTitle(WebInspector.anotherProfilerActiv
eLabel()); |
687 this.toggleTimelineButton.setEnabled(false); | 687 this.toggleTimelineButton.setEnabled(false); |
688 } else { | 688 } else { |
689 this.toggleTimelineButton.title = WebInspector.UIString("Record"); | 689 this.toggleTimelineButton.setTitle(WebInspector.UIString("Record")); |
690 this.toggleTimelineButton.setEnabled(true); | 690 this.toggleTimelineButton.setEnabled(true); |
691 } | 691 } |
692 }, | 692 }, |
693 | 693 |
694 /** | 694 /** |
695 * @return {boolean} | 695 * @return {boolean} |
696 */ | 696 */ |
697 _toggleTimelineButtonClicked: function() | 697 _toggleTimelineButtonClicked: function() |
698 { | 698 { |
699 if (!this.toggleTimelineButton.enabled()) | 699 if (!this.toggleTimelineButton.enabled()) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 { | 741 { |
742 this._updateToggleTimelineButton(true); | 742 this._updateToggleTimelineButton(true); |
743 if (event.data && event.data.fromFile) | 743 if (event.data && event.data.fromFile) |
744 this._updateProgress(WebInspector.UIString("Loading from file...")); | 744 this._updateProgress(WebInspector.UIString("Loading from file...")); |
745 else | 745 else |
746 this._updateProgress(WebInspector.UIString("%d events collected", 0)
); | 746 this._updateProgress(WebInspector.UIString("%d events collected", 0)
); |
747 }, | 747 }, |
748 | 748 |
749 _recordingInProgress: function() | 749 _recordingInProgress: function() |
750 { | 750 { |
751 return this.toggleTimelineButton.toggled; | 751 return this.toggleTimelineButton.toggled(); |
752 }, | 752 }, |
753 | 753 |
754 /** | 754 /** |
755 * @param {!WebInspector.Event} event | 755 * @param {!WebInspector.Event} event |
756 */ | 756 */ |
757 _onTracingBufferUsage: function(event) | 757 _onTracingBufferUsage: function(event) |
758 { | 758 { |
759 var usage = /** @type {number} */ (event.data); | 759 var usage = /** @type {number} */ (event.data); |
760 this._updateProgress(WebInspector.UIString("Buffer usage %d%", Math.roun
d(usage * 100))); | 760 this._updateProgress(WebInspector.UIString("Buffer usage %d%", Math.roun
d(usage * 100))); |
761 }, | 761 }, |
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 | 1468 |
1469 WebInspector.TimelinePanelFactory.prototype = { | 1469 WebInspector.TimelinePanelFactory.prototype = { |
1470 /** | 1470 /** |
1471 * @return {!WebInspector.Panel} | 1471 * @return {!WebInspector.Panel} |
1472 */ | 1472 */ |
1473 createPanel: function() | 1473 createPanel: function() |
1474 { | 1474 { |
1475 return WebInspector.TimelinePanel._instance(); | 1475 return WebInspector.TimelinePanel._instance(); |
1476 } | 1476 } |
1477 } | 1477 } |
OLD | NEW |