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

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

Issue 705273002: DevTools: loading timeline pretends it is recording w/ 0 events collected. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « Source/devtools/front_end/timeline/TimelinePanel.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * @param {!WebInspector.TracingManager} tracingManager 7 * @param {!WebInspector.TracingManager} tracingManager
8 * @param {!WebInspector.TracingModel} tracingModel 8 * @param {!WebInspector.TracingModel} tracingModel
9 * @param {!WebInspector.TimelineModel.Filter} recordFilter 9 * @param {!WebInspector.TimelineModel.Filter} recordFilter
10 * @extends {WebInspector.TimelineModel} 10 * @extends {WebInspector.TimelineModel}
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 this._jsProfilerStarted = false; 171 this._jsProfilerStarted = false;
172 } 172 }
173 this._tracingManager.stop(); 173 this._tracingManager.stop();
174 }, 174 },
175 175
176 /** 176 /**
177 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events 177 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events
178 */ 178 */
179 setEventsForTest: function(events) 179 setEventsForTest: function(events)
180 { 180 {
181 this._onTracingStarted(); 181 this._startCollectingTraceEvents(false);
182 this._tracingModel.addEvents(events); 182 this._tracingModel.addEvents(events);
183 this._onTracingComplete(); 183 this._onTracingComplete();
184 }, 184 },
185 185
186 _configureCpuProfilerSamplingInterval: function() 186 _configureCpuProfilerSamplingInterval: function()
187 { 187 {
188 var intervalUs = WebInspector.settings.highResolutionCpuProfiling.get() ? 100 : 1000; 188 var intervalUs = WebInspector.settings.highResolutionCpuProfiling.get() ? 100 : 1000;
189 this._currentTarget.profilerAgent().setSamplingInterval(intervalUs, didC hangeInterval); 189 this._currentTarget.profilerAgent().setSamplingInterval(intervalUs, didC hangeInterval);
190 190
191 function didChangeInterval(error) 191 function didChangeInterval(error)
192 { 192 {
193 if (error) 193 if (error)
194 WebInspector.console.error(error); 194 WebInspector.console.error(error);
195 } 195 }
196 }, 196 },
197 197
198 /** 198 /**
199 * @param {string} categories 199 * @param {string} categories
200 */ 200 */
201 _startRecordingWithCategories: function(categories) 201 _startRecordingWithCategories: function(categories)
202 { 202 {
203 this._tracingManager.start(categories, ""); 203 this._tracingManager.start(categories, "");
204 }, 204 },
205 205
206 _onTracingStarted: function() 206 _onTracingStarted: function()
207 { 207 {
208 this.reset(); 208 this._startCollectingTraceEvents(false);
209 this._tracingModel.reset();
210 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted);
211 }, 209 },
212 210
213 /** 211 /**
212 * @param {boolean} fromFile
213 */
214 _startCollectingTraceEvents: function(fromFile)
215 {
216 this.reset();
217 this._tracingModel.reset();
218 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin gStarted, fromFile);
loislo 2014/11/07 14:23:11 Could you please put something more readable like
yurys 2014/11/07 14:23:52 Done.
219 },
220
221 /**
214 * @param {!WebInspector.Event} event 222 * @param {!WebInspector.Event} event
215 */ 223 */
216 _onEventsCollected: function(event) 224 _onEventsCollected: function(event)
217 { 225 {
218 var traceEvents = /** @type {!Array.<!WebInspector.TracingManager.EventP ayload>} */ (event.data); 226 var traceEvents = /** @type {!Array.<!WebInspector.TracingManager.EventP ayload>} */ (event.data);
219 this._tracingModel.addEvents(traceEvents); 227 this._tracingModel.addEvents(traceEvents);
220 }, 228 },
221 229
222 _onTracingComplete: function() 230 _onTracingComplete: function()
223 { 231 {
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 lastIndex = WebInspector.TextUtils.findBalancedCurlyBrackets(data, i ndex); 1047 lastIndex = WebInspector.TextUtils.findBalancedCurlyBrackets(data, i ndex);
1040 } while (lastIndex !== -1) 1048 } while (lastIndex !== -1)
1041 1049
1042 var json = data.slice(0, index) + "]"; 1050 var json = data.slice(0, index) + "]";
1043 this._buffer = data.slice(index); 1051 this._buffer = data.slice(index);
1044 1052
1045 if (!index) 1053 if (!index)
1046 return; 1054 return;
1047 1055
1048 if (this._firstChunk) { 1056 if (this._firstChunk) {
1049 this._model._onTracingStarted(); 1057 this._model._startCollectingTraceEvents(true);
1050 } else { 1058 } else {
1051 var commaIndex = json.indexOf(","); 1059 var commaIndex = json.indexOf(",");
1052 if (commaIndex !== -1) 1060 if (commaIndex !== -1)
1053 json = json.slice(commaIndex + 1); 1061 json = json.slice(commaIndex + 1);
1054 json = "[" + json; 1062 json = "[" + json;
1055 } 1063 }
1056 1064
1057 var items; 1065 var items;
1058 try { 1066 try {
1059 items = /** @type {!Array.<!WebInspector.TracingManager.EventPayload >} */ (JSON.parse(json)); 1067 items = /** @type {!Array.<!WebInspector.TracingManager.EventPayload >} */ (JSON.parse(json));
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 _initializePerFrameState: function() 1289 _initializePerFrameState: function()
1282 { 1290 {
1283 /** @type {!Array.<!WebInspector.InvalidationTrackingEvent>} */ 1291 /** @type {!Array.<!WebInspector.InvalidationTrackingEvent>} */
1284 this._invalidationEvents = []; 1292 this._invalidationEvents = [];
1285 this._lastStyleRecalcEventIndex = 0; 1293 this._lastStyleRecalcEventIndex = 0;
1286 this._lastLayoutEventIndex = 0; 1294 this._lastLayoutEventIndex = 0;
1287 this._lastPaintWithLayer = undefined; 1295 this._lastPaintWithLayer = undefined;
1288 this._didPaint = false; 1296 this._didPaint = false;
1289 } 1297 }
1290 } 1298 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TimelinePanel.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698