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

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

Issue 715803002: DevTools: merge TracingTimelineModel into TimelineModel (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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 /** 216 /**
217 * @constructor 217 * @constructor
218 * @extends {WebInspector.TimelineFrameModelBase} 218 * @extends {WebInspector.TimelineFrameModelBase}
219 */ 219 */
220 WebInspector.TracingTimelineFrameModel = function() 220 WebInspector.TracingTimelineFrameModel = function()
221 { 221 {
222 WebInspector.TimelineFrameModelBase.call(this); 222 WebInspector.TimelineFrameModelBase.call(this);
223 } 223 }
224 224
225 WebInspector.TracingTimelineFrameModel._mainFrameMarkers = [ 225 WebInspector.TracingTimelineFrameModel._mainFrameMarkers = [
226 WebInspector.TracingTimelineModel.RecordType.ScheduleStyleRecalculation, 226 WebInspector.TimelineModel.RecordType.ScheduleStyleRecalculation,
227 WebInspector.TracingTimelineModel.RecordType.InvalidateLayout, 227 WebInspector.TimelineModel.RecordType.InvalidateLayout,
228 WebInspector.TracingTimelineModel.RecordType.BeginMainThreadFrame, 228 WebInspector.TimelineModel.RecordType.BeginMainThreadFrame,
229 WebInspector.TracingTimelineModel.RecordType.ScrollLayer 229 WebInspector.TimelineModel.RecordType.ScrollLayer
230 ]; 230 ];
231 231
232 WebInspector.TracingTimelineFrameModel.prototype = { 232 WebInspector.TracingTimelineFrameModel.prototype = {
233 /** 233 /**
234 * @param {!Array.<!WebInspector.TracingModel.Event>} events 234 * @param {!Array.<!WebInspector.TracingModel.Event>} events
235 * @param {string} sessionId 235 * @param {string} sessionId
236 */ 236 */
237 addTraceEvents: function(events, sessionId) 237 addTraceEvents: function(events, sessionId)
238 { 238 {
239 this._sessionId = sessionId; 239 this._sessionId = sessionId;
240 if (!events.length) 240 if (!events.length)
241 return; 241 return;
242 if (events[0].startTime < this._minimumRecordTime) 242 if (events[0].startTime < this._minimumRecordTime)
243 this._minimumRecordTime = events[0].startTime; 243 this._minimumRecordTime = events[0].startTime;
244 for (var i = 0; i < events.length; ++i) 244 for (var i = 0; i < events.length; ++i)
245 this._addTraceEvent(events[i]); 245 this._addTraceEvent(events[i]);
246 }, 246 },
247 247
248 /** 248 /**
249 * @param {!WebInspector.TracingModel.Event} event 249 * @param {!WebInspector.TracingModel.Event} event
250 */ 250 */
251 _addTraceEvent: function(event) 251 _addTraceEvent: function(event)
252 { 252 {
253 var eventNames = WebInspector.TracingTimelineModel.RecordType; 253 var eventNames = WebInspector.TimelineModel.RecordType;
254 254
255 if (event.name === eventNames.SetLayerTreeId) { 255 if (event.name === eventNames.SetLayerTreeId) {
256 if (this._sessionId === event.args["sessionId"]) 256 if (this._sessionId === event.args["sessionId"])
257 this._layerTreeId = event.args["layerTreeId"]; 257 this._layerTreeId = event.args["layerTreeId"];
258 return; 258 return;
259 } 259 }
260 if (event.name === eventNames.TracingStartedInPage) { 260 if (event.name === eventNames.TracingStartedInPage) {
261 this._mainThread = event.thread; 261 this._mainThread = event.thread;
262 return; 262 return;
263 } 263 }
264 if (event.thread === this._mainThread) 264 if (event.thread === this._mainThread)
265 this._addMainThreadTraceEvent(event); 265 this._addMainThreadTraceEvent(event);
266 else 266 else
267 this._addBackgroundTraceEvent(event); 267 this._addBackgroundTraceEvent(event);
268 }, 268 },
269 269
270 /** 270 /**
271 * @param {!WebInspector.TracingModel.Event} event 271 * @param {!WebInspector.TracingModel.Event} event
272 */ 272 */
273 _addBackgroundTraceEvent: function(event) 273 _addBackgroundTraceEvent: function(event)
274 { 274 {
275 var eventNames = WebInspector.TracingTimelineModel.RecordType; 275 var eventNames = WebInspector.TimelineModel.RecordType;
276 if (event.phase === WebInspector.TracingModel.Phase.SnapshotObject && ev ent.name === eventNames.LayerTreeHostImplSnapshot && parseInt(event.id, 0) === t his._layerTreeId) { 276 if (event.phase === WebInspector.TracingModel.Phase.SnapshotObject && ev ent.name === eventNames.LayerTreeHostImplSnapshot && parseInt(event.id, 0) === t his._layerTreeId) {
277 var snapshot = /** @type {!WebInspector.TracingModel.ObjectSnapshot} */ (event); 277 var snapshot = /** @type {!WebInspector.TracingModel.ObjectSnapshot} */ (event);
278 this.handleLayerTreeSnapshot(new WebInspector.DeferredTracingLayerTr ee(snapshot)); 278 this.handleLayerTreeSnapshot(new WebInspector.DeferredTracingLayerTr ee(snapshot));
279 return; 279 return;
280 } 280 }
281 if (this._lastFrame && event.selfTime) 281 if (this._lastFrame && event.selfTime)
282 this._lastFrame._addTimeForCategory(WebInspector.TimelineUIUtils.eve ntStyle(event).category.name, event.selfTime); 282 this._lastFrame._addTimeForCategory(WebInspector.TimelineUIUtils.eve ntStyle(event).category.name, event.selfTime);
283 283
284 if (event.args["layerTreeId"] !== this._layerTreeId) 284 if (event.args["layerTreeId"] !== this._layerTreeId)
285 return; 285 return;
286 286
287 var timestamp = event.startTime; 287 var timestamp = event.startTime;
288 if (event.name === eventNames.BeginFrame) 288 if (event.name === eventNames.BeginFrame)
289 this.handleBeginFrame(timestamp); 289 this.handleBeginFrame(timestamp);
290 else if (event.name === eventNames.DrawFrame) 290 else if (event.name === eventNames.DrawFrame)
291 this.handleDrawFrame(timestamp); 291 this.handleDrawFrame(timestamp);
292 else if (event.name === eventNames.ActivateLayerTree) 292 else if (event.name === eventNames.ActivateLayerTree)
293 this.handleActivateLayerTree(); 293 this.handleActivateLayerTree();
294 else if (event.name === eventNames.RequestMainThreadFrame) 294 else if (event.name === eventNames.RequestMainThreadFrame)
295 this.handleRequestMainThreadFrame(); 295 this.handleRequestMainThreadFrame();
296 }, 296 },
297 297
298 /** 298 /**
299 * @param {!WebInspector.TracingModel.Event} event 299 * @param {!WebInspector.TracingModel.Event} event
300 */ 300 */
301 _addMainThreadTraceEvent: function(event) 301 _addMainThreadTraceEvent: function(event)
302 { 302 {
303 var eventNames = WebInspector.TracingTimelineModel.RecordType; 303 var eventNames = WebInspector.TimelineModel.RecordType;
304 var timestamp = event.startTime; 304 var timestamp = event.startTime;
305 var selfTime = event.selfTime || 0; 305 var selfTime = event.selfTime || 0;
306 306
307 if (!this._hasThreadedCompositing) { 307 if (!this._hasThreadedCompositing) {
308 if (event.name === eventNames.BeginMainThreadFrame) 308 if (event.name === eventNames.BeginMainThreadFrame)
309 this._startMainThreadFrame(timestamp); 309 this._startMainThreadFrame(timestamp);
310 if (!this._lastFrame) 310 if (!this._lastFrame)
311 return; 311 return;
312 if (!selfTime) 312 if (!selfTime)
313 return; 313 return;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 /** 519 /**
520 * @constructor 520 * @constructor
521 */ 521 */
522 WebInspector.PendingFrame = function() 522 WebInspector.PendingFrame = function()
523 { 523 {
524 /** @type {!Object.<string, number>} */ 524 /** @type {!Object.<string, number>} */
525 this.timeByCategory = {}; 525 this.timeByCategory = {};
526 /** @type {!Array.<!WebInspector.LayerPaintEvent>} */ 526 /** @type {!Array.<!WebInspector.LayerPaintEvent>} */
527 this.paints = []; 527 this.paints = [];
528 } 528 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698