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

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

Issue 318343003: Move trace event based implementation parts of TimelineModel into TracingTimelineModel (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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 this.registerRequiredCSS("timelinePanel.css"); 66 this.registerRequiredCSS("timelinePanel.css");
67 this.registerRequiredCSS("layersPanel.css"); 67 this.registerRequiredCSS("layersPanel.css");
68 this.registerRequiredCSS("filter.css"); 68 this.registerRequiredCSS("filter.css");
69 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse); 69 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse);
70 70
71 this._detailsLinkifier = new WebInspector.Linkifier(); 71 this._detailsLinkifier = new WebInspector.Linkifier();
72 this._windowStartTime = 0; 72 this._windowStartTime = 0;
73 this._windowEndTime = Infinity; 73 this._windowEndTime = Infinity;
74 74
75 // Create model. 75 // Create model.
76 this._model = new WebInspector.TimelineModelImpl(WebInspector.timelineManage r); 76 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled() ||
77 WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) {
78 this._tracingModel = new WebInspector.TracingModel(WebInspector.targetMa nager.activeTarget());
79 this._tracingModel.addEventListener(WebInspector.TracingModel.Events.Buf ferUsage, this._onTracingBufferUsage, this);
80
81 this._tracingTimelineModel = new WebInspector.TracingTimelineModel(this. _tracingModel);
82 this._tracingTimelineModel.addEventListener(WebInspector.TracingTimeline Model.Events.TracingComplete, this._onTracingComplete, this);
83
84 this._model = this._tracingTimelineModel;
85 } else {
86 this._model = new WebInspector.TimelineModelImpl(WebInspector.timelineMa nager);
87 }
88
77 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar ted, this._onRecordingStarted, this); 89 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar ted, this._onRecordingStarted, this);
78 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStop ped, this._onRecordingStopped, this); 90 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStop ped, this._onRecordingStopped, this);
79 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare d, this._onRecordsCleared, this); 91 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare d, this._onRecordsCleared, this);
80 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingProg ress, this._onRecordingProgress, this); 92 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingProg ress, this._onRecordingProgress, this);
81 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordFilterC hanged, this._refreshViews, this); 93 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordFilterC hanged, this._refreshViews, this);
82 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded, this._onRecordAdded, this); 94 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded, this._onRecordAdded, this);
83 95
84 this._model.target().profilingLock.addEventListener(WebInspector.Lock.Events .StateChanged, this._onProfilingStateChanged, this); 96 this._model.target().profilingLock.addEventListener(WebInspector.Lock.Events .StateChanged, this._onProfilingStateChanged, this);
85 97
86 this._categoryFilter = new WebInspector.TimelineCategoryFilter(); 98 this._categoryFilter = new WebInspector.TimelineCategoryFilter();
87 this._durationFilter = new WebInspector.TimelineIsLongFilter(); 99 this._durationFilter = new WebInspector.TimelineIsLongFilter();
88 this._textFilter = new WebInspector.TimelineTextFilter(); 100 this._textFilter = new WebInspector.TimelineTextFilter();
89 101
90 this._model.addFilter(new WebInspector.TimelineHiddenFilter()); 102 this._model.addFilter(new WebInspector.TimelineHiddenFilter());
91 this._model.addFilter(this._categoryFilter); 103 this._model.addFilter(this._categoryFilter);
92 this._model.addFilter(this._durationFilter); 104 this._model.addFilter(this._durationFilter);
93 this._model.addFilter(this._textFilter); 105 this._model.addFilter(this._textFilter);
94 106
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
104 /** @type {!Array.<!WebInspector.TimelineModeView>} */ 107 /** @type {!Array.<!WebInspector.TimelineModeView>} */
105 this._currentViews = []; 108 this._currentViews = [];
106 109
107 this._overviewModeSetting = WebInspector.settings.createSetting("timelineOve rviewMode", WebInspector.TimelinePanel.OverviewMode.Events); 110 this._overviewModeSetting = WebInspector.settings.createSetting("timelineOve rviewMode", WebInspector.TimelinePanel.OverviewMode.Events);
108 this._flameChartEnabledSetting = WebInspector.settings.createSetting("timeli neFlameChartEnabled", false); 111 this._flameChartEnabledSetting = WebInspector.settings.createSetting("timeli neFlameChartEnabled", false);
109 this._createStatusBarItems(); 112 this._createStatusBarItems();
110 113
111 this._topPane = new WebInspector.SplitView(true, false); 114 this._topPane = new WebInspector.SplitView(true, false);
112 this._topPane.element.id = "timeline-overview-panel"; 115 this._topPane.element.id = "timeline-overview-panel";
113 this._topPane.show(this.element); 116 this._topPane.show(this.element);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 this._detailsView.setVertical(vertically); 197 this._detailsView.setVertical(vertically);
195 }, 198 },
196 199
197 /** 200 /**
198 * @return {number} 201 * @return {number}
199 */ 202 */
200 windowStartTime: function() 203 windowStartTime: function()
201 { 204 {
202 if (this._windowStartTime) 205 if (this._windowStartTime)
203 return this._windowStartTime; 206 return this._windowStartTime;
204 if (this._model.minimumRecordTime() != -1) 207 var minimumRecordTime = this._model.minimumRecordTime();
205 return this._model.minimumRecordTime(); 208 if (minimumRecordTime && minimumRecordTime != -1)
caseq 2014/06/09 11:59:03 !==?
yurys 2014/06/09 12:16:13 Done.
209 return minimumRecordTime;
206 return 0; 210 return 0;
207 }, 211 },
208 212
209 /** 213 /**
210 * @return {number} 214 * @return {number}
211 */ 215 */
212 windowEndTime: function() 216 windowEndTime: function()
213 { 217 {
214 if (this._windowEndTime < Infinity) 218 if (this._windowEndTime < Infinity)
215 return this._windowEndTime; 219 return this._windowEndTime;
216 if (this._model.maximumRecordTime() != -1) 220 var maximumRecordTime = this._model.maximumRecordTime();
217 return this._model.maximumRecordTime(); 221 if (maximumRecordTime && maximumRecordTime != -1)
caseq 2014/06/09 11:59:03 ditto
yurys 2014/06/09 12:16:13 Done.
222 return maximumRecordTime;
218 return Infinity; 223 return Infinity;
219 }, 224 },
220 225
221 /** 226 /**
222 * @param {!WebInspector.Event} event 227 * @param {!WebInspector.Event} event
223 */ 228 */
224 _sidebarResized: function(event) 229 _sidebarResized: function(event)
225 { 230 {
226 var width = /** @type {number} */ (event.data); 231 var width = /** @type {number} */ (event.data);
227 this._topPane.setSidebarSize(width); 232 this._topPane.setSidebarSize(width);
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 648
644 this._stackView.show(this._searchableView.element); 649 this._stackView.show(this._searchableView.element);
645 }, 650 },
646 651
647 /** 652 /**
648 * @param {boolean} userInitiated 653 * @param {boolean} userInitiated
649 */ 654 */
650 _startRecording: function(userInitiated) 655 _startRecording: function(userInitiated)
651 { 656 {
652 this._userInitiatedRecording = userInitiated; 657 this._userInitiatedRecording = userInitiated;
653 if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled()) { 658 this._model.startRecording(this._captureStacksSetting.get(), this._captu reMemorySetting.get());
654 this._model.willStartRecordingTraceEvents();
655 this._tracingTimelineModel.startRecording(this._captureStacksSetting .get(), this._captureMemorySetting.get());
656 } else {
657 this._model.startRecording(this._captureStacksSetting.get(), this._c aptureMemorySetting.get());
658 if (this._captureTracingSetting && this._captureTracingSetting.get() )
659 this._tracingTimelineModel.startRecording(this._captureStacksSet ting.get(), this._captureMemorySetting.get());
660 }
661 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel) 659 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel)
662 this._lazyFrameModel.setMergeRecords(false); 660 this._lazyFrameModel.setMergeRecords(false);
663 661
664 for (var i = 0; i < this._overviewControls.length; ++i) 662 for (var i = 0; i < this._overviewControls.length; ++i)
665 this._overviewControls[i].timelineStarted(); 663 this._overviewControls[i].timelineStarted();
666 664
667 if (userInitiated) 665 if (userInitiated)
668 WebInspector.userMetrics.TimelineStarted.record(); 666 WebInspector.userMetrics.TimelineStarted.record();
669 }, 667 },
670 668
671 _stopRecording: function() 669 _stopRecording: function()
672 { 670 {
673 this._userInitiatedRecording = false; 671 this._userInitiatedRecording = false;
674 this._model.stopRecording(); 672 this._model.stopRecording();
675 if (this._tracingTimelineModel)
676 this._tracingTimelineModel.stopRecording()
677 673
678 for (var i = 0; i < this._overviewControls.length; ++i) 674 for (var i = 0; i < this._overviewControls.length; ++i)
679 this._overviewControls[i].timelineStopped(); 675 this._overviewControls[i].timelineStopped();
680 }, 676 },
681 677
682 _onTracingComplete: function() 678 _onTracingComplete: function()
683 { 679 {
684 if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnabled())
685 this._model.didStopRecordingTraceEvents(this._tracingTimelineModel.m ainThreadEvents());
686 if (this._lazyFrameModel) { 680 if (this._lazyFrameModel) {
687 this._lazyFrameModel.reset(); 681 this._lazyFrameModel.reset();
688 this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.inspe ctedTargetEvents(), this._tracingModel.sessionId()); 682 this._lazyFrameModel.addTraceEvents(this._tracingTimelineModel.inspe ctedTargetEvents(), this._tracingModel.sessionId());
689 this._overviewPane.update(); 683 this._overviewPane.update();
690 } 684 }
691 this._refreshViews(); 685 this._refreshViews();
692 }, 686 },
693 687
694 _onProfilingStateChanged: function() 688 _onProfilingStateChanged: function()
695 { 689 {
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 * @param {!WebInspector.TimelineModel.Record} record 1426 * @param {!WebInspector.TimelineModel.Record} record
1433 * @return {boolean} 1427 * @return {boolean}
1434 */ 1428 */
1435 accept: function(record) 1429 accept: function(record)
1436 { 1430 {
1437 return !this._hiddenRecords[record.type()]; 1431 return !this._hiddenRecords[record.type()];
1438 }, 1432 },
1439 1433
1440 __proto__: WebInspector.TimelineModel.Filter.prototype 1434 __proto__: WebInspector.TimelineModel.Filter.prototype
1441 } 1435 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698