Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: Source/devtools/front_end/timeline/TimelinePanel.js

Issue 317273004: Create Tracing{Timeline}Model in TimelinePanel constructor (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
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() || "");
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
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 if (WebInspector.experimentsSettings.timelineFlameChart.isEnabled() && t his._flameChartEnabledSetting.get()) {
624 if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) { 618 var tracingTimelineModel = WebInspector.experimentsSettings.timeline OnTraceEvents.isEnabled() ? this._tracingTimelineModel : null;
625 this._tracingModel(); 619 this._addModeView(new WebInspector.TimelineFlameChart(this, this._mo del, tracingTimelineModel, this._frameModel()));
626 tracingTimelineModel = this._tracingTimelineModel; 620 } else {
621 this._addModeView(this._timelineView());
627 } 622 }
628 if (WebInspector.experimentsSettings.timelineFlameChart.isEnabled() && t his._flameChartEnabledSetting.get())
629 this._addModeView(new WebInspector.TimelineFlameChart(this, this._mo del, tracingTimelineModel, this._frameModel()));
630 else
631 this._addModeView(this._timelineView());
632 623
633 if (this._captureMemorySetting.get()) { 624 if (this._captureMemorySetting.get()) {
634 if (!isFrameMode) // Frame mode skews time, don't render aux overvi ews. 625 if (!isFrameMode) // Frame mode skews time, don't render aux overvi ews.
635 this._overviewControls.push(new WebInspector.TimelineMemoryOverv iew(this._model)); 626 this._overviewControls.push(new WebInspector.TimelineMemoryOverv iew(this._model));
636 this._addModeView(new WebInspector.MemoryCountersGraph(this, this._m odel)); 627 this._addModeView(new WebInspector.MemoryCountersGraph(this, this._m odel));
637 } 628 }
638 629
639 if (this._capturePowerSetting && this._capturePowerSetting.get()) { 630 if (this._capturePowerSetting && this._capturePowerSetting.get()) {
640 if (!isFrameMode) // Frame mode skews time, don't render aux overvi ews. 631 if (!isFrameMode) // Frame mode skews time, don't render aux overvi ews.
641 this._overviewControls.push(new WebInspector.TimelinePowerOvervi ew(this._model)); 632 this._overviewControls.push(new WebInspector.TimelinePowerOvervi ew(this._model));
642 this._addModeView(new WebInspector.TimelinePowerGraph(this, this._mo del)); 633 this._addModeView(new WebInspector.TimelinePowerGraph(this, this._mo del));
643 } 634 }
644 635
645 if (this._captureTracingSetting && this._captureTracingSetting.get()) 636 if (this._captureTracingSetting && this._captureTracingSetting.get())
646 this._addModeView(new WebInspector.TimelineTracingView(this, this._t racingModel(), this._model)); 637 this._addModeView(new WebInspector.TimelineTracingView(this, this._t racingModel, this._model));
647 638
648 this._timelineView().setFrameModel(isFrameMode ? this._frameModel() : nu ll); 639 this._timelineView().setFrameModel(isFrameMode ? this._frameModel() : nu ll);
649 this._overviewPane.setOverviewControls(this._overviewControls); 640 this._overviewPane.setOverviewControls(this._overviewControls);
650 this.doResize(); 641 this.doResize();
651 this._updateSelectedRangeStats(); 642 this._updateSelectedRangeStats();
652 643
653 this._stackView.show(this._searchableView.element); 644 this._stackView.show(this._searchableView.element);
654 }, 645 },
655 646
656 /** 647 /**
657 * @param {boolean} userInitiated 648 * @param {boolean} userInitiated
658 */ 649 */
659 _startRecording: function(userInitiated) 650 _startRecording: function(userInitiated)
660 { 651 {
661 this._userInitiatedRecording = userInitiated; 652 this._userInitiatedRecording = userInitiated;
662 if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) { 653 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(); 654 this._model.willStartRecordingTraceEvents();
667 this._tracingModel().start(categories.join(","), ""); 655 this._tracingTimelineModel.startRecording(this._captureStacksSetting .get(), this._captureMemorySetting.get());
668 this._tracingTimelineModel.willStartRecordingTraceEvents();
669 } else { 656 } else {
670 this._model.startRecording(this._captureStacksSetting.get(), this._c aptureMemorySetting.get()); 657 this._model.startRecording(this._captureStacksSetting.get(), this._c aptureMemorySetting.get());
671 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled() ) { 658 if (this._captureTracingSetting && this._captureTracingSetting.get() )
672 this._tracingModel().start(WebInspector.TimelinePanel.defaultTra cingCategoryFilter, ""); 659 this._tracingTimelineModel.startRecording(this._captureStacksSet ting.get(), this._captureMemorySetting.get());
673 this._tracingTimelineModel.willStartRecordingTraceEvents();
674 }
675 } 660 }
676 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel) 661 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel)
677 this._lazyFrameModel.setMergeRecords(false); 662 this._lazyFrameModel.setMergeRecords(false);
678 663
679 for (var i = 0; i < this._overviewControls.length; ++i) 664 for (var i = 0; i < this._overviewControls.length; ++i)
680 this._overviewControls[i].timelineStarted(); 665 this._overviewControls[i].timelineStarted();
681 666
682 if (userInitiated) 667 if (userInitiated)
683 WebInspector.userMetrics.TimelineStarted.record(); 668 WebInspector.userMetrics.TimelineStarted.record();
684 }, 669 },
685 670
686 _stopRecording: function() 671 _stopRecording: function()
687 { 672 {
688 this._userInitiatedRecording = false; 673 this._userInitiatedRecording = false;
689 this._model.stopRecording(); 674 this._model.stopRecording();
690 if (this._lazyTracingModel) 675 if (this._tracingTimelineModel)
691 this._lazyTracingModel.stop(this._onTracingComplete.bind(this)); 676 this._tracingTimelineModel.stopRecording()
692 677
693 for (var i = 0; i < this._overviewControls.length; ++i) 678 for (var i = 0; i < this._overviewControls.length; ++i)
694 this._overviewControls[i].timelineStopped(); 679 this._overviewControls[i].timelineStopped();
695 }, 680 },
696 681
697 _onTracingComplete: function() 682 _onTracingComplete: function()
698 { 683 {
699 this._tracingTimelineModel.didStopRecordingTraceEvents();
700 if (this._lazyFrameModel) { 684 if (this._lazyFrameModel) {
701 this._lazyFrameModel.reset(); 685 this._lazyFrameModel.reset();
702 this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.inspe ctedTargetEvents(), this._lazyTracingModel.sessionId()); 686 this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.inspe ctedTargetEvents(), this._tracingModel.sessionId());
703 this._overviewPane.update(); 687 this._overviewPane.update();
704 } 688 }
705 if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) 689 if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled())
706 this._model.didStopRecordingTraceEvents(this._tracingTimelineModel.m ainThreadEvents()); 690 this._model.didStopRecordingTraceEvents(this._tracingTimelineModel.m ainThreadEvents());
707 this._refreshViews(); 691 this._refreshViews();
708 }, 692 },
709 693
710 _onProfilingStateChanged: function() 694 _onProfilingStateChanged: function()
711 { 695 {
712 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); 696 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled);
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 * @param {!WebInspector.TimelineModel.Record} record 1432 * @param {!WebInspector.TimelineModel.Record} record
1449 * @return {boolean} 1433 * @return {boolean}
1450 */ 1434 */
1451 accept: function(record) 1435 accept: function(record)
1452 { 1436 {
1453 return !this._hiddenRecords[record.type()]; 1437 return !this._hiddenRecords[record.type()];
1454 }, 1438 },
1455 1439
1456 __proto__: WebInspector.TimelineModel.Filter.prototype 1440 __proto__: WebInspector.TimelineModel.Filter.prototype
1457 } 1441 }
OLDNEW
« no previous file with comments | « LayoutTests/inspector/layers/tracing-layer-tree.html ('k') | Source/devtools/front_end/timeline/TracingTimelineModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698