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

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

Issue 402633002: DevTools: Remove redundant dependency on target from TimelineFrameModel (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 /** 31 /**
32 * @constructor 32 * @constructor
33 * @extends {WebInspector.SDKObject}
34 * @param {!WebInspector.Target} target
35 */ 33 */
36 WebInspector.TimelineFrameModelBase = function(target) 34 WebInspector.TimelineFrameModelBase = function()
37 { 35 {
38 WebInspector.SDKObject.call(this, target);
39
40 this.reset(); 36 this.reset();
41 } 37 }
42 38
43 WebInspector.TimelineFrameModelBase.prototype = { 39 WebInspector.TimelineFrameModelBase.prototype = {
44 /** 40 /**
45 * @return {!Array.<!WebInspector.TimelineFrame>} 41 * @return {!Array.<!WebInspector.TimelineFrame>}
46 */ 42 */
47 frames: function() 43 frames: function()
48 { 44 {
49 return this._frames; 45 return this._frames;
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 if (types.indexOf(record.type()) >= 0) 196 if (types.indexOf(record.type()) >= 0)
201 return record; 197 return record;
202 if (!record.children()) 198 if (!record.children())
203 return null; 199 return null;
204 for (var i = 0; i < record.children().length; ++i) { 200 for (var i = 0; i < record.children().length; ++i) {
205 var result = this._findRecordRecursively(types, record.children()[i] ); 201 var result = this._findRecordRecursively(types, record.children()[i] );
206 if (result) 202 if (result)
207 return result; 203 return result;
208 } 204 }
209 return null; 205 return null;
210 }, 206 }
211
212 __proto__: WebInspector.SDKObject.prototype
213 } 207 }
214 208
215 /** 209 /**
216 * @constructor 210 * @constructor
217 * @param {!WebInspector.Target} target
218 * @extends {WebInspector.TimelineFrameModelBase} 211 * @extends {WebInspector.TimelineFrameModelBase}
219 */ 212 */
220 WebInspector.TimelineFrameModel = function(target) 213 WebInspector.TimelineFrameModel = function()
221 { 214 {
222 WebInspector.TimelineFrameModelBase.call(this, target); 215 WebInspector.TimelineFrameModelBase.call(this);
223 } 216 }
224 217
225 WebInspector.TimelineFrameModel._mainFrameMarkers = [ 218 WebInspector.TimelineFrameModel._mainFrameMarkers = [
226 WebInspector.TimelineModel.RecordType.ScheduleStyleRecalculation, 219 WebInspector.TimelineModel.RecordType.ScheduleStyleRecalculation,
227 WebInspector.TimelineModel.RecordType.InvalidateLayout, 220 WebInspector.TimelineModel.RecordType.InvalidateLayout,
228 WebInspector.TimelineModel.RecordType.BeginFrame, 221 WebInspector.TimelineModel.RecordType.BeginFrame,
229 WebInspector.TimelineModel.RecordType.ScrollLayer 222 WebInspector.TimelineModel.RecordType.ScrollLayer
230 ]; 223 ];
231 224
232 WebInspector.TimelineFrameModel.prototype = { 225 WebInspector.TimelineFrameModel.prototype = {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 }, 298 },
306 299
307 /** 300 /**
308 * @param {?WebInspector.TimelineModel.Record} programRecord 301 * @param {?WebInspector.TimelineModel.Record} programRecord
309 * @param {!WebInspector.TimelineModel.Record} record 302 * @param {!WebInspector.TimelineModel.Record} record
310 */ 303 */
311 _addMainThreadRecord: function(programRecord, record) 304 _addMainThreadRecord: function(programRecord, record)
312 { 305 {
313 var recordTypes = WebInspector.TimelineModel.RecordType; 306 var recordTypes = WebInspector.TimelineModel.RecordType;
314 if (record.type() === recordTypes.UpdateLayerTree && record.data()["laye rTree"]) 307 if (record.type() === recordTypes.UpdateLayerTree && record.data()["laye rTree"])
315 this.handleLayerTreeSnapshot(new WebInspector.DeferredAgentLayerTree (this.target().weakReference(), record.data()["layerTree"])); 308 this.handleLayerTreeSnapshot(new WebInspector.DeferredAgentLayerTree (record.target().weakReference(), record.data()["layerTree"]));
316 if (!this._hasThreadedCompositing) { 309 if (!this._hasThreadedCompositing) {
317 if (record.type() === recordTypes.BeginFrame) 310 if (record.type() === recordTypes.BeginFrame)
318 this._startMainThreadFrame(record.startTime()); 311 this._startMainThreadFrame(record.startTime());
319 312
320 if (!this._lastFrame) 313 if (!this._lastFrame)
321 return; 314 return;
322 315
323 this._lastFrame._addTimeFromRecord(record); 316 this._lastFrame._addTimeFromRecord(record);
324 317
325 // Account for "other" time at the same time as the first child. 318 // Account for "other" time at the same time as the first child.
(...skipping 23 matching lines...) Expand all
349 for (var i = 0; i < programRecord.children().length; ++i) 342 for (var i = 0; i < programRecord.children().length; ++i)
350 accounted += programRecord.children()[i].endTime() - programRecord.c hildren()[i].startTime(); 343 accounted += programRecord.children()[i].endTime() - programRecord.c hildren()[i].startTime();
351 return programRecord.endTime() - programRecord.startTime() - accounted; 344 return programRecord.endTime() - programRecord.startTime() - accounted;
352 }, 345 },
353 346
354 __proto__: WebInspector.TimelineFrameModelBase.prototype, 347 __proto__: WebInspector.TimelineFrameModelBase.prototype,
355 }; 348 };
356 349
357 /** 350 /**
358 * @constructor 351 * @constructor
359 * @param {!WebInspector.Target} target
360 * @extends {WebInspector.TimelineFrameModelBase} 352 * @extends {WebInspector.TimelineFrameModelBase}
361 */ 353 */
362 WebInspector.TracingTimelineFrameModel = function(target) 354 WebInspector.TracingTimelineFrameModel = function()
363 { 355 {
364 WebInspector.TimelineFrameModelBase.call(this, target); 356 WebInspector.TimelineFrameModelBase.call(this);
365 } 357 }
366 358
367 WebInspector.TracingTimelineFrameModel._mainFrameMarkers = [ 359 WebInspector.TracingTimelineFrameModel._mainFrameMarkers = [
368 WebInspector.TracingTimelineModel.RecordType.ScheduleStyleRecalculation, 360 WebInspector.TracingTimelineModel.RecordType.ScheduleStyleRecalculation,
369 WebInspector.TracingTimelineModel.RecordType.InvalidateLayout, 361 WebInspector.TracingTimelineModel.RecordType.InvalidateLayout,
370 WebInspector.TracingTimelineModel.RecordType.BeginMainThreadFrame, 362 WebInspector.TracingTimelineModel.RecordType.BeginMainThreadFrame,
371 WebInspector.TracingTimelineModel.RecordType.ScrollLayer 363 WebInspector.TracingTimelineModel.RecordType.ScrollLayer
372 ]; 364 ];
373 365
374 WebInspector.TracingTimelineFrameModel.prototype = { 366 WebInspector.TracingTimelineFrameModel.prototype = {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 else 400 else
409 this._addBackgroundTraceEvent(event); 401 this._addBackgroundTraceEvent(event);
410 }, 402 },
411 403
412 /** 404 /**
413 * @param {!WebInspector.TracingModel.Event} event 405 * @param {!WebInspector.TracingModel.Event} event
414 */ 406 */
415 _addBackgroundTraceEvent: function(event) 407 _addBackgroundTraceEvent: function(event)
416 { 408 {
417 var eventNames = WebInspector.TracingTimelineModel.RecordType; 409 var eventNames = WebInspector.TracingTimelineModel.RecordType;
418 410 var target = event.thread.target();
419 if (event.phase === WebInspector.TracingModel.Phase.SnapshotObject && ev ent.name === eventNames.LayerTreeHostImplSnapshot && parseInt(event.id, 0) === t his._layerTreeId) { 411 if (event.phase === WebInspector.TracingModel.Phase.SnapshotObject && ev ent.name === eventNames.LayerTreeHostImplSnapshot && parseInt(event.id, 0) === t his._layerTreeId) {
420 this.handleLayerTreeSnapshot(new WebInspector.DeferredTracingLayerTr ee(this.target().weakReference(), event.args["snapshot"]["active_tree"]["root_la yer"], event.args["snapshot"]["device_viewport_size"])); 412 this.handleLayerTreeSnapshot(new WebInspector.DeferredTracingLayerTr ee(target ? target.weakReference() : new WeakReference(null), event.args["snapsh ot"]["active_tree"]["root_layer"], event.args["snapshot"]["device_viewport_size" ]));
caseq 2014/07/17 12:30:36 new WeakReference(null) looks rather unfortunate.
sergeyv 2014/07/17 14:34:29 Done.
421 return; 413 return;
422 } 414 }
423 if (this._lastFrame && event.selfTime) 415 if (this._lastFrame && event.selfTime)
424 this._lastFrame._addTimeForCategory(WebInspector.TracingTimelineUIUt ils.eventStyle(event).category.name, event.selfTime); 416 this._lastFrame._addTimeForCategory(WebInspector.TracingTimelineUIUt ils.eventStyle(event).category.name, event.selfTime);
425 417
426 if (event.args["layerTreeId"] !== this._layerTreeId) 418 if (event.args["layerTreeId"] !== this._layerTreeId)
427 return; 419 return;
428 420
429 var timestamp = event.startTime; 421 var timestamp = event.startTime;
430 if (event.name === eventNames.BeginFrame) 422 if (event.name === eventNames.BeginFrame)
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 /** 587 /**
596 * @constructor 588 * @constructor
597 */ 589 */
598 WebInspector.PendingFrame = function() 590 WebInspector.PendingFrame = function()
599 { 591 {
600 /** @type {!Object.<string, number>} */ 592 /** @type {!Object.<string, number>} */
601 this.timeByCategory = {}; 593 this.timeByCategory = {};
602 /** @type {!Array.<!WebInspector.LayerPaintEvent>} */ 594 /** @type {!Array.<!WebInspector.LayerPaintEvent>} */
603 this.paints = []; 595 this.paints = [];
604 } 596 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698