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

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-decode-resize was fixed? Created 6 years, 5 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()
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 this._currentTarget = WebInspector.context.flavor(WebInspector.Target); 53 this._currentTarget = WebInspector.context.flavor(WebInspector.Target);
54 console.assert(this._currentTarget); 54 console.assert(this._currentTarget);
55 55
56 this._clientInitiatedRecording = true; 56 this._clientInitiatedRecording = true;
57 var maxStackFrames = captureStacks ? 30 : 0; 57 var maxStackFrames = captureStacks ? 30 : 0;
58 var includeGPUEvents = WebInspector.experimentsSettings.gpuTimeline.isEn abled(); 58 var includeGPUEvents = WebInspector.experimentsSettings.gpuTimeline.isEn abled();
59 var liveEvents = [ WebInspector.TimelineModel.RecordType.BeginFrame, 59 var liveEvents = [ WebInspector.TimelineModel.RecordType.BeginFrame,
60 WebInspector.TimelineModel.RecordType.DrawFrame, 60 WebInspector.TimelineModel.RecordType.DrawFrame,
61 WebInspector.TimelineModel.RecordType.RequestMainThre adFrame, 61 WebInspector.TimelineModel.RecordType.RequestMainThre adFrame,
62 WebInspector.TimelineModel.RecordType.ActivateLayerTr ee ]; 62 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)); 63 this._currentTarget.timelineManager.start(maxStackFrames, liveEvents.joi n(","), captureMemory, includeGPUEvents, this._fireRecordingStarted.bind(this));
64 }, 64 },
65 65
66 stopRecording: function() 66 stopRecording: function()
67 { 67 {
68 if (!this._currentTarget) 68 if (!this._currentTarget)
69 return; 69 return;
70 70
71 if (!this._clientInitiatedRecording) { 71 if (!this._clientInitiatedRecording) {
72 this._currentTarget.timelineManager.start(undefined, undefined, unde fined, undefined, undefined, stopTimeline.bind(this)); 72 this._currentTarget.timelineManager.start(undefined, undefined, unde fined, undefined, stopTimeline.bind(this));
73 return; 73 return;
74 } 74 }
75 75
76 /** 76 /**
77 * Console started this one and we are just sniffing it. Initiate record ing so that we 77 * Console started this one and we are just sniffing it. Initiate record ing so that we
78 * could stop it. 78 * could stop it.
79 * @this {WebInspector.TimelineModelImpl} 79 * @this {WebInspector.TimelineModelImpl}
80 */ 80 */
81 function stopTimeline() 81 function stopTimeline()
82 { 82 {
(...skipping 11 matching lines...) Expand all
94 { 94 {
95 return this._records; 95 return this._records;
96 }, 96 },
97 97
98 /** 98 /**
99 * @param {!WebInspector.Event} event 99 * @param {!WebInspector.Event} event
100 */ 100 */
101 _onRecordAdded: function(event) 101 _onRecordAdded: function(event)
102 { 102 {
103 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target); 103 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target);
104 if (this._collectionEnabled && timelineManager.target() === this._curren tTarget) 104 if (timelineManager.target() === this._currentTarget)
105 this._addRecord(/** @type {!TimelineAgent.TimelineEvent} */(event.da ta)); 105 this._addRecord(/** @type {!TimelineAgent.TimelineEvent} */(event.da ta));
106 }, 106 },
107 107
108 /** 108 /**
109 * @param {!WebInspector.Event} event 109 * @param {!WebInspector.Event} event
110 */ 110 */
111 _onStarted: function(event) 111 _onStarted: function(event)
112 { 112 {
113 if (!event.data || this._collectionEnabled) 113 if (!event.data)
yurys 2014/07/24 16:58:37 Revert this. You can reset this flag on RecordProc
loislo 2014/07/28 14:00:06 Done.
114 return; 114 return;
115 // Started from console. 115 // Started from console.
116 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target); 116 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target);
117 if (this._currentTarget !== timelineManager.target()) { 117 if (this._currentTarget !== timelineManager.target()) {
118 this.reset(); 118 this.reset();
119 this._currentTarget = timelineManager.target(); 119 this._currentTarget = timelineManager.target();
120 } 120 }
121 this._fireRecordingStarted(); 121 this._fireRecordingStarted();
122 }, 122 },
123 123
124 /** 124 /**
125 * @param {!WebInspector.Event} event 125 * @param {!WebInspector.Event} event
126 */ 126 */
127 _onStopped: function(event) 127 _onStopped: function(event)
128 { 128 {
129 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target); 129 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target);
130 if (timelineManager.target() !== this._currentTarget) 130 if (timelineManager.target() !== this._currentTarget)
131 return; 131 return;
132 // If we were buffering events, discard those that got through, the real ones are coming! 132 // We were buffering events, discard those that got through, the real on es are coming!
133 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled()) { 133 this.reset();
134 this.reset(); 134 this._currentTarget = timelineManager.target();
135 this._currentTarget = timelineManager.target();
136 }
137 if (event.data) { 135 if (event.data) {
138 // Stopped from console. 136 // Stopped from console.
139 this._fireRecordingStopped(null, null); 137 this._fireRecordingStopped(null, null);
140 } 138 }
141 }, 139 },
142 140
143 /** 141 /**
144 * @param {!WebInspector.Event} event 142 * @param {!WebInspector.Event} event
145 */ 143 */
146 _onProgress: function(event) 144 _onProgress: function(event)
147 { 145 {
148 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target); 146 var timelineManager = /** @type {!WebInspector.TimelineManager} */ (even t.target);
149 if (timelineManager.target() === this._currentTarget) 147 if (timelineManager.target() === this._currentTarget)
150 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Reco rdingProgress, event.data); 148 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Reco rdingProgress, event.data);
151 }, 149 },
152 150
153 _fireRecordingStarted: function() 151 _fireRecordingStarted: function()
154 { 152 {
155 this._collectionEnabled = true;
156 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted); 153 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted);
157 }, 154 },
158 155
159 /** 156 /**
160 * @param {?Protocol.Error} error 157 * @param {?Protocol.Error} error
161 * @param {?ProfilerAgent.CPUProfile} cpuProfile 158 * @param {?ProfilerAgent.CPUProfile} cpuProfile
162 */ 159 */
163 _fireRecordingStopped: function(error, cpuProfile) 160 _fireRecordingStopped: function(error, cpuProfile)
164 { 161 {
165 this._collectionEnabled = false;
166 if (cpuProfile) 162 if (cpuProfile)
167 WebInspector.TimelineJSProfileProcessor.mergeJSProfileIntoTimeline(t his, cpuProfile); 163 WebInspector.TimelineJSProfileProcessor.mergeJSProfileIntoTimeline(t his, cpuProfile);
168 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStopped); 164 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStopped);
169 }, 165 },
170 166
171 /** 167 /**
172 * @param {!TimelineAgent.TimelineEvent} payload 168 * @param {!TimelineAgent.TimelineEvent} payload
173 */ 169 */
174 _addRecord: function(payload) 170 _addRecord: function(payload)
175 { 171 {
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 break; 723 break;
728 length += itemLength; 724 length += itemLength;
729 data.push(item); 725 data.push(item);
730 ++this._recordIndex; 726 ++this._recordIndex;
731 } 727 }
732 if (this._recordIndex === this._payloads.length) 728 if (this._recordIndex === this._payloads.length)
733 data.push(data.pop() + "]"); 729 data.push(data.pop() + "]");
734 stream.write(data.join(separator), this._writeNextChunk.bind(this)); 730 stream.write(data.join(separator), this._writeNextChunk.bind(this));
735 } 731 }
736 } 732 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698