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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 | 85 |
86 this._categoryFilter = new WebInspector.TimelineCategoryFilter(); | 86 this._categoryFilter = new WebInspector.TimelineCategoryFilter(); |
87 this._durationFilter = new WebInspector.TimelineIsLongFilter(); | 87 this._durationFilter = new WebInspector.TimelineIsLongFilter(); |
88 this._textFilter = new WebInspector.TimelineTextFilter(); | 88 this._textFilter = new WebInspector.TimelineTextFilter(); |
89 | 89 |
90 this._model.addFilter(new WebInspector.TimelineHiddenFilter()); | 90 this._model.addFilter(new WebInspector.TimelineHiddenFilter()); |
91 this._model.addFilter(this._categoryFilter); | 91 this._model.addFilter(this._categoryFilter); |
92 this._model.addFilter(this._durationFilter); | 92 this._model.addFilter(this._durationFilter); |
93 this._model.addFilter(this._textFilter); | 93 this._model.addFilter(this._textFilter); |
94 | 94 |
95 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled() || | |
96 WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) { | |
97 this._tracingModel = new WebInspector.TracingModel(WebInspector.targetMa nager.activeTarget()); | |
98 this._tracingModel.addEventListener(WebInspector.TracingModel.Events.Buf ferUsage, this._onTracingBufferUsage, this); | |
99 | |
100 this._tracingTimelineModel = new WebInspector.TracingTimelineModel(this. _tracingModel); | |
101 this._tracingTimelineModel.addEventListener(WebInspector.TracingTimeline Model.Events.TracingComplete, this._onTracingComplete, this); | |
102 } | |
103 | |
95 /** @type {!Array.<!WebInspector.TimelineModeView>} */ | 104 /** @type {!Array.<!WebInspector.TimelineModeView>} */ |
96 this._currentViews = []; | 105 this._currentViews = []; |
97 | 106 |
98 this._overviewModeSetting = WebInspector.settings.createSetting("timelineOve rviewMode", WebInspector.TimelinePanel.OverviewMode.Events); | 107 this._overviewModeSetting = WebInspector.settings.createSetting("timelineOve rviewMode", WebInspector.TimelinePanel.OverviewMode.Events); |
99 this._flameChartEnabledSetting = WebInspector.settings.createSetting("timeli neFlameChartEnabled", false); | 108 this._flameChartEnabledSetting = WebInspector.settings.createSetting("timeli neFlameChartEnabled", false); |
100 this._createStatusBarItems(); | 109 this._createStatusBarItems(); |
101 | 110 |
102 this._topPane = new WebInspector.SplitView(true, false); | 111 this._topPane = new WebInspector.SplitView(true, false); |
103 this._topPane.element.id = "timeline-overview-panel"; | 112 this._topPane.element.id = "timeline-overview-panel"; |
104 this._topPane.show(this.element); | 113 this._topPane.show(this.element); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
146 Events: "Events", | 155 Events: "Events", |
147 Frames: "Frames" | 156 Frames: "Frames" |
148 }; | 157 }; |
149 | 158 |
150 // Define row and header height, should be in sync with styles for timeline grap hs. | 159 // Define row and header height, should be in sync with styles for timeline grap hs. |
151 WebInspector.TimelinePanel.rowHeight = 18; | 160 WebInspector.TimelinePanel.rowHeight = 18; |
152 WebInspector.TimelinePanel.headerHeight = 20; | 161 WebInspector.TimelinePanel.headerHeight = 20; |
153 | 162 |
154 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; | 163 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; |
155 | 164 |
156 WebInspector.TimelinePanel.defaultTracingCategoryFilter = "*,disabled-by-default -cc.debug,disabled-by-default-devtools.timeline"; | |
157 | |
158 WebInspector.TimelinePanel.prototype = { | 165 WebInspector.TimelinePanel.prototype = { |
159 /** | 166 /** |
160 * @return {?WebInspector.SearchableView} | 167 * @return {?WebInspector.SearchableView} |
161 */ | 168 */ |
162 searchableView: function() | 169 searchableView: function() |
163 { | 170 { |
164 return this._searchableView; | 171 return this._searchableView; |
165 }, | 172 }, |
166 | 173 |
167 wasShown: function() | 174 wasShown: function() |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
246 | 253 |
247 /** | 254 /** |
248 * @return {!WebInspector.TimelineFrameModel} | 255 * @return {!WebInspector.TimelineFrameModel} |
249 */ | 256 */ |
250 _frameModel: function() | 257 _frameModel: function() |
251 { | 258 { |
252 if (!this._lazyFrameModel) { | 259 if (!this._lazyFrameModel) { |
253 this._lazyFrameModel = new WebInspector.TimelineFrameModel(this._mod el.target()); | 260 this._lazyFrameModel = new WebInspector.TimelineFrameModel(this._mod el.target()); |
254 this._lazyFrameModel.setMergeRecords(!WebInspector.experimentsSettin gs.timelineNoLiveUpdate.isEnabled() || !this._recordingInProgress); | 261 this._lazyFrameModel.setMergeRecords(!WebInspector.experimentsSettin gs.timelineNoLiveUpdate.isEnabled() || !this._recordingInProgress); |
255 this._lazyFrameModel.addRecords(this._model.records()); | 262 this._lazyFrameModel.addRecords(this._model.records()); |
256 if (this._lazyTracingModel) | 263 if (this._tracingModel) |
257 this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.i nspectedTargetEvents(), this._lazyTracingModel.sessionId()); | 264 this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.i nspectedTargetEvents(), this._tracingModel.sessionId() || ""); |
caseq
2014/06/06 09:03:18
nit: this could as well be
if (this._tracingModel
yurys
2014/06/06 09:13:56
Done.
yurys
2014/06/06 09:16:51
In fact compiler will keep complaining in that cas
| |
258 } | 265 } |
259 return this._lazyFrameModel; | 266 return this._lazyFrameModel; |
260 }, | 267 }, |
261 | 268 |
262 /** | 269 /** |
263 * @return {!WebInspector.TracingModel} | |
264 */ | |
265 _tracingModel: function() | |
266 { | |
267 if (!this._lazyTracingModel) { | |
268 this._lazyTracingModel = new WebInspector.TracingModel(WebInspector. targetManager.activeTarget()); | |
269 this._lazyTracingModel.addEventListener(WebInspector.TracingModel.Ev ents.BufferUsage, this._onTracingBufferUsage, this); | |
270 this._tracingTimelineModel = new WebInspector.TracingTimelineModel(t his._lazyTracingModel); | |
271 } | |
272 return this._lazyTracingModel; | |
273 }, | |
274 | |
275 /** | |
276 * @return {!WebInspector.TimelineView} | 270 * @return {!WebInspector.TimelineView} |
277 */ | 271 */ |
278 _timelineView: function() | 272 _timelineView: function() |
279 { | 273 { |
280 if (!this._lazyTimelineView) | 274 if (!this._lazyTimelineView) |
281 this._lazyTimelineView = new WebInspector.TimelineView(this, this._m odel); | 275 this._lazyTimelineView = new WebInspector.TimelineView(this, this._m odel); |
282 return this._lazyTimelineView; | 276 return this._lazyTimelineView; |
283 }, | 277 }, |
284 | 278 |
285 /** | 279 /** |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
613 | 607 |
614 var isFrameMode = this._overviewModeSetting.get() === WebInspector.Timel inePanel.OverviewMode.Frames; | 608 var isFrameMode = this._overviewModeSetting.get() === WebInspector.Timel inePanel.OverviewMode.Frames; |
615 this._removeAllModeViews(); | 609 this._removeAllModeViews(); |
616 this._overviewControls = []; | 610 this._overviewControls = []; |
617 | 611 |
618 if (isFrameMode) | 612 if (isFrameMode) |
619 this._overviewControls.push(new WebInspector.TimelineFrameOverview(t his._model, this._frameModel())); | 613 this._overviewControls.push(new WebInspector.TimelineFrameOverview(t his._model, this._frameModel())); |
620 else | 614 else |
621 this._overviewControls.push(new WebInspector.TimelineEventOverview(t his._model)); | 615 this._overviewControls.push(new WebInspector.TimelineEventOverview(t his._model)); |
622 | 616 |
623 var tracingTimelineModel = null; | 617 var tracingTimelineModel = WebInspector.experimentsSettings.timelineOnTr aceEvents.isEnabled() ? this._tracingTimelineModel : null; |
caseq
2014/06/06 09:03:18
nit: put it under the next if, closer to the only
yurys
2014/06/06 09:13:57
Done.
| |
624 if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) { | |
625 this._tracingModel(); | |
626 tracingTimelineModel = this._tracingTimelineModel; | |
627 } | |
628 if (WebInspector.experimentsSettings.timelineFlameChart.isEnabled() && t his._flameChartEnabledSetting.get()) | 618 if (WebInspector.experimentsSettings.timelineFlameChart.isEnabled() && t his._flameChartEnabledSetting.get()) |
629 this._addModeView(new WebInspector.TimelineFlameChart(this, this._mo del, tracingTimelineModel, this._frameModel())); | 619 this._addModeView(new WebInspector.TimelineFlameChart(this, this._mo del, tracingTimelineModel, this._frameModel())); |
630 else | 620 else |
631 this._addModeView(this._timelineView()); | 621 this._addModeView(this._timelineView()); |
632 | 622 |
633 if (this._captureMemorySetting.get()) { | 623 if (this._captureMemorySetting.get()) { |
634 if (!isFrameMode) // Frame mode skews time, don't render aux overvi ews. | 624 if (!isFrameMode) // Frame mode skews time, don't render aux overvi ews. |
635 this._overviewControls.push(new WebInspector.TimelineMemoryOverv iew(this._model)); | 625 this._overviewControls.push(new WebInspector.TimelineMemoryOverv iew(this._model)); |
636 this._addModeView(new WebInspector.MemoryCountersGraph(this, this._m odel)); | 626 this._addModeView(new WebInspector.MemoryCountersGraph(this, this._m odel)); |
637 } | 627 } |
638 | 628 |
639 if (this._capturePowerSetting && this._capturePowerSetting.get()) { | 629 if (this._capturePowerSetting && this._capturePowerSetting.get()) { |
640 if (!isFrameMode) // Frame mode skews time, don't render aux overvi ews. | 630 if (!isFrameMode) // Frame mode skews time, don't render aux overvi ews. |
641 this._overviewControls.push(new WebInspector.TimelinePowerOvervi ew(this._model)); | 631 this._overviewControls.push(new WebInspector.TimelinePowerOvervi ew(this._model)); |
642 this._addModeView(new WebInspector.TimelinePowerGraph(this, this._mo del)); | 632 this._addModeView(new WebInspector.TimelinePowerGraph(this, this._mo del)); |
643 } | 633 } |
644 | 634 |
645 if (this._captureTracingSetting && this._captureTracingSetting.get()) | 635 if (this._captureTracingSetting && this._captureTracingSetting.get()) |
646 this._addModeView(new WebInspector.TimelineTracingView(this, this._t racingModel(), this._model)); | 636 this._addModeView(new WebInspector.TimelineTracingView(this, this._t racingModel, this._model)); |
647 | 637 |
648 this._timelineView().setFrameModel(isFrameMode ? this._frameModel() : nu ll); | 638 this._timelineView().setFrameModel(isFrameMode ? this._frameModel() : nu ll); |
649 this._overviewPane.setOverviewControls(this._overviewControls); | 639 this._overviewPane.setOverviewControls(this._overviewControls); |
650 this.doResize(); | 640 this.doResize(); |
651 this._updateSelectedRangeStats(); | 641 this._updateSelectedRangeStats(); |
652 | 642 |
653 this._stackView.show(this._searchableView.element); | 643 this._stackView.show(this._searchableView.element); |
654 }, | 644 }, |
655 | 645 |
656 /** | 646 /** |
657 * @param {boolean} userInitiated | 647 * @param {boolean} userInitiated |
658 */ | 648 */ |
659 _startRecording: function(userInitiated) | 649 _startRecording: function(userInitiated) |
660 { | 650 { |
661 this._userInitiatedRecording = userInitiated; | 651 this._userInitiatedRecording = userInitiated; |
662 if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) { | 652 if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) { |
663 var categories = ["disabled-by-default-devtools.timeline", "devtools "]; | |
664 if (this._captureStacksSetting.get()) | |
665 categories.push("disabled-by-default-devtools.timeline.stack"); | |
666 this._model.willStartRecordingTraceEvents(); | 653 this._model.willStartRecordingTraceEvents(); |
667 this._tracingModel().start(categories.join(","), ""); | 654 this._tracingTimelineModel.startRecording(this._captureStacksSetting .get(), this._captureMemorySetting.get()); |
668 this._tracingTimelineModel.willStartRecordingTraceEvents(); | |
669 } else { | 655 } else { |
670 this._model.startRecording(this._captureStacksSetting.get(), this._c aptureMemorySetting.get()); | 656 this._model.startRecording(this._captureStacksSetting.get(), this._c aptureMemorySetting.get()); |
671 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled() ) { | 657 if (this._captureTracingSetting && this._captureTracingSetting.get() ) |
672 this._tracingModel().start(WebInspector.TimelinePanel.defaultTra cingCategoryFilter, ""); | 658 this._tracingTimelineModel.startRecording(this._captureStacksSet ting.get(), this._captureMemorySetting.get()); |
673 this._tracingTimelineModel.willStartRecordingTraceEvents(); | |
674 } | |
675 } | 659 } |
676 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel) | 660 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel) |
677 this._lazyFrameModel.setMergeRecords(false); | 661 this._lazyFrameModel.setMergeRecords(false); |
678 | 662 |
679 for (var i = 0; i < this._overviewControls.length; ++i) | 663 for (var i = 0; i < this._overviewControls.length; ++i) |
680 this._overviewControls[i].timelineStarted(); | 664 this._overviewControls[i].timelineStarted(); |
681 | 665 |
682 if (userInitiated) | 666 if (userInitiated) |
683 WebInspector.userMetrics.TimelineStarted.record(); | 667 WebInspector.userMetrics.TimelineStarted.record(); |
684 }, | 668 }, |
685 | 669 |
686 _stopRecording: function() | 670 _stopRecording: function() |
687 { | 671 { |
688 this._userInitiatedRecording = false; | 672 this._userInitiatedRecording = false; |
689 this._model.stopRecording(); | 673 this._model.stopRecording(); |
690 if (this._lazyTracingModel) | 674 if (this._tracingTimelineModel) |
691 this._lazyTracingModel.stop(this._onTracingComplete.bind(this)); | 675 this._tracingTimelineModel.stopRecording() |
692 | 676 |
693 for (var i = 0; i < this._overviewControls.length; ++i) | 677 for (var i = 0; i < this._overviewControls.length; ++i) |
694 this._overviewControls[i].timelineStopped(); | 678 this._overviewControls[i].timelineStopped(); |
695 }, | 679 }, |
696 | 680 |
697 _onTracingComplete: function() | 681 _onTracingComplete: function() |
698 { | 682 { |
699 this._tracingTimelineModel.didStopRecordingTraceEvents(); | |
700 if (this._lazyFrameModel) { | 683 if (this._lazyFrameModel) { |
701 this._lazyFrameModel.reset(); | 684 this._lazyFrameModel.reset(); |
702 this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.inspe ctedTargetEvents(), this._lazyTracingModel.sessionId()); | 685 this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.inspe ctedTargetEvents(), this._tracingModel.sessionId()); |
703 this._overviewPane.update(); | 686 this._overviewPane.update(); |
704 } | 687 } |
705 if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) | 688 if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) |
706 this._model.didStopRecordingTraceEvents(this._tracingTimelineModel.m ainThreadEvents()); | 689 this._model.didStopRecordingTraceEvents(this._tracingTimelineModel.m ainThreadEvents()); |
707 this._refreshViews(); | 690 this._refreshViews(); |
708 }, | 691 }, |
709 | 692 |
710 _onProfilingStateChanged: function() | 693 _onProfilingStateChanged: function() |
711 { | 694 { |
712 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); | 695 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1448 * @param {!WebInspector.TimelineModel.Record} record | 1431 * @param {!WebInspector.TimelineModel.Record} record |
1449 * @return {boolean} | 1432 * @return {boolean} |
1450 */ | 1433 */ |
1451 accept: function(record) | 1434 accept: function(record) |
1452 { | 1435 { |
1453 return !this._hiddenRecords[record.type()]; | 1436 return !this._hiddenRecords[record.type()]; |
1454 }, | 1437 }, |
1455 | 1438 |
1456 __proto__: WebInspector.TimelineModel.Filter.prototype | 1439 __proto__: WebInspector.TimelineModel.Filter.prototype |
1457 } | 1440 } |
OLD | NEW |