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

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

Issue 399043002: DevTools: switch Timeline frontend into buffered mode and remove the corresponding experiment. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: timeline-websocket-event rebaselined Created 6 years, 4 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.TimelineModel} 7 * @extends {WebInspector.TimelineModel}
8 * @implements {WebInspector.TargetManager.Observer} 8 * @implements {WebInspector.TargetManager.Observer}
9 */ 9 */
10 WebInspector.TimelineModelImpl = function() 10 WebInspector.TimelineModelImpl = function()
11 { 11 {
12 WebInspector.TimelineModel.call(this); 12 WebInspector.TimelineModel.call(this);
13 /** @type {?WebInspector.Target} */ 13 /** @type {?WebInspector.Target} */
14 this._currentTarget = null; 14 this._currentTarget = null;
15 this._filters = []; 15 this._filters = [];
16 this._bindings = new WebInspector.TimelineModelImpl.InterRecordBindings(); 16 this._bindings = new WebInspector.TimelineModelImpl.InterRecordBindings();
17 17
18 this.reset(); 18 this.reset();
19 19
20 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineEventRecorded, this._onRecordAdded , this); 20 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineEventRecorded, this._onRecordAdded , this);
21 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineStarted, this._onStarted, this); 21 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineStarted, this._onStarted, this);
22 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineStopped, this._onStopped, this); 22 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineStopped, this._onStopped, this);
23 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineAllEventsReceived, this._onAllEven tsReceived, this);
23 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineProgress, this._onProgress, this); 24 WebInspector.targetManager.addModelListener(WebInspector.TimelineManager, We bInspector.TimelineManager.EventTypes.TimelineProgress, this._onProgress, this);
24 WebInspector.targetManager.observeTargets(this); 25 WebInspector.targetManager.observeTargets(this);
25 } 26 }
26 27
27 WebInspector.TimelineModelImpl.TransferChunkLengthBytes = 5000000; 28 WebInspector.TimelineModelImpl.TransferChunkLengthBytes = 5000000;
28 29
29 WebInspector.TimelineModelImpl.prototype = { 30 WebInspector.TimelineModelImpl.prototype = {
30 /** 31 /**
31 * @param {!WebInspector.Target} target 32 * @param {!WebInspector.Target} target
32 */ 33 */
(...skipping 20 matching lines...) Expand all
53 this._currentTarget = WebInspector.context.flavor(WebInspector.Target); 54 this._currentTarget = WebInspector.context.flavor(WebInspector.Target);
54 console.assert(this._currentTarget); 55 console.assert(this._currentTarget);
55 56
56 this._clientInitiatedRecording = true; 57 this._clientInitiatedRecording = true;
57 var maxStackFrames = captureStacks ? 30 : 0; 58 var maxStackFrames = captureStacks ? 30 : 0;
58 var includeGPUEvents = WebInspector.experimentsSettings.gpuTimeline.isEn abled(); 59 var includeGPUEvents = WebInspector.experimentsSettings.gpuTimeline.isEn abled();
59 var liveEvents = [ WebInspector.TimelineModel.RecordType.BeginFrame, 60 var liveEvents = [ WebInspector.TimelineModel.RecordType.BeginFrame,
60 WebInspector.TimelineModel.RecordType.DrawFrame, 61 WebInspector.TimelineModel.RecordType.DrawFrame,
61 WebInspector.TimelineModel.RecordType.RequestMainThre adFrame, 62 WebInspector.TimelineModel.RecordType.RequestMainThre adFrame,
62 WebInspector.TimelineModel.RecordType.ActivateLayerTr ee ]; 63 WebInspector.TimelineModel.RecordType.ActivateLayerTr ee ];
63 this._currentTarget.timelineManager.start(maxStackFrames, WebInspector.e xperimentsSettings.timelineNoLiveUpdate.isEnabled(), liveEvents.join(","), captu reMemory, includeGPUEvents, this._fireRecordingStarted.bind(this)); 64 this._currentTarget.timelineManager.start(maxStackFrames, liveEvents.joi n(","), captureMemory, includeGPUEvents, this._fireRecordingStarted.bind(this));
64 }, 65 },
65 66
66 stopRecording: function() 67 stopRecording: function()
67 { 68 {
68 if (!this._currentTarget) 69 if (!this._currentTarget)
69 return; 70 return;
70 71
71 if (!this._clientInitiatedRecording) { 72 if (!this._clientInitiatedRecording) {
72 this._currentTarget.timelineManager.start(undefined, undefined, unde fined, undefined, undefined, stopTimeline.bind(this)); 73 this._currentTarget.timelineManager.start(undefined, undefined, unde fined, undefined, stopTimeline.bind(this));
73 return; 74 return;
74 } 75 }
75 76
76 /** 77 /**
77 * Console started this one and we are just sniffing it. Initiate record ing so that we 78 * Console started this one and we are just sniffing it. Initiate record ing so that we
78 * could stop it. 79 * could stop it.
79 * @this {WebInspector.TimelineModelImpl} 80 * @this {WebInspector.TimelineModelImpl}
80 */ 81 */
81 function stopTimeline() 82 function stopTimeline()
82 { 83 {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 }, 123 },
123 124
124 /** 125 /**
125 * @param {!WebInspector.Event} event 126 * @param {!WebInspector.Event} event
126 */ 127 */
127 _onStopped: function(event) 128 _onStopped: function(event)
128 { 129 {
129 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target); 130 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target);
130 if (timelineManager.target() !== this._currentTarget) 131 if (timelineManager.target() !== this._currentTarget)
131 return; 132 return;
132 // If we were buffering events, discard those that got through, the real ones are coming! 133 // We were buffering events, discard those that got through, the real on es are coming!
133 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled()) { 134 this.reset();
134 this.reset(); 135 this._currentTarget = timelineManager.target();
135 this._currentTarget = timelineManager.target();
136 }
137 if (event.data) { 136 if (event.data) {
138 // Stopped from console. 137 // Stopped from console.
139 this._fireRecordingStopped(null, null); 138 this._fireRecordingStopped(null, null);
140 } 139 }
141 }, 140 },
142 141
143 /** 142 /**
144 * @param {!WebInspector.Event} event 143 * @param {!WebInspector.Event} event
145 */ 144 */
145 _onAllEventsReceived: function(event)
146 {
147 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target);
148 if (timelineManager.target() !== this._currentTarget)
149 return;
150 this._collectionEnabled = false;
151 },
152
153 /**
154 * @param {!WebInspector.Event} event
155 */
146 _onProgress: function(event) 156 _onProgress: function(event)
147 { 157 {
148 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target); 158 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target);
149 if (timelineManager.target() === this._currentTarget) 159 if (timelineManager.target() === this._currentTarget)
150 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Reco rdingProgress, event.data); 160 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Reco rdingProgress, event.data);
151 }, 161 },
152 162
153 _fireRecordingStarted: function() 163 _fireRecordingStarted: function()
154 { 164 {
155 this._collectionEnabled = true; 165 this._collectionEnabled = true;
156 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted); 166 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted);
157 }, 167 },
158 168
159 /** 169 /**
160 * @param {?Protocol.Error} error 170 * @param {?Protocol.Error} error
161 * @param {?ProfilerAgent.CPUProfile} cpuProfile 171 * @param {?ProfilerAgent.CPUProfile} cpuProfile
162 */ 172 */
163 _fireRecordingStopped: function(error, cpuProfile) 173 _fireRecordingStopped: function(error, cpuProfile)
164 { 174 {
165 this._collectionEnabled = false;
166 if (cpuProfile) 175 if (cpuProfile)
167 WebInspector.TimelineJSProfileProcessor.mergeJSProfileIntoTimeline(t his, cpuProfile); 176 WebInspector.TimelineJSProfileProcessor.mergeJSProfileIntoTimeline(t his, cpuProfile);
168 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStopped); 177 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStopped);
169 this._currentTarget = null; 178 this._currentTarget = null;
170 }, 179 },
171 180
172 /** 181 /**
173 * @param {!TimelineAgent.TimelineEvent} payload 182 * @param {!TimelineAgent.TimelineEvent} payload
174 */ 183 */
175 _addRecord: function(payload) 184 _addRecord: function(payload)
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 break; 736 break;
728 length += itemLength; 737 length += itemLength;
729 data.push(item); 738 data.push(item);
730 ++this._recordIndex; 739 ++this._recordIndex;
731 } 740 }
732 if (this._recordIndex === this._payloads.length) 741 if (this._recordIndex === this._payloads.length)
733 data.push(data.pop() + "]"); 742 data.push(data.pop() + "]");
734 stream.write(data.join(separator), this._writeNextChunk.bind(this)); 743 stream.write(data.join(separator), this._writeNextChunk.bind(this));
735 } 744 }
736 } 745 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/TimelineManager.js ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698