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

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

Issue 344443007: Encapsulate implementation-specific timeline record handling in TimelineUIUtils (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 15 matching lines...) Expand all
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 /** 32 /**
33 * @constructor 33 * @constructor
34 * @extends {WebInspector.Object} 34 * @extends {WebInspector.Object}
35 * @param {!WebInspector.TimelineModel} model 35 * @param {!WebInspector.TimelineModel} model
36 * @param {!Object.<string, number>} coalescableRecordTypes 36 * @param {!WebInspector.TimelineUIUtils} uiUtils
37 */ 37 */
38 WebInspector.TimelinePresentationModel = function(model, coalescableRecordTypes) 38 WebInspector.TimelinePresentationModel = function(model, uiUtils)
39 { 39 {
40 this._model = model; 40 this._model = model;
41 this._coalescableRecordTypes = coalescableRecordTypes; 41 this._uiUtils = uiUtils;
42 this._filters = []; 42 this._filters = [];
43 /** 43 /**
44 * @type {!Map.<!WebInspector.TimelineModel.Record, !WebInspector.TimelinePr esentationModel.Record>} 44 * @type {!Map.<!WebInspector.TimelineModel.Record, !WebInspector.TimelinePr esentationModel.Record>}
45 */ 45 */
46 this._recordToPresentationRecord = new Map(); 46 this._recordToPresentationRecord = new Map();
47 this.reset(); 47 this.reset();
48 } 48 }
49 49
50 WebInspector.TimelinePresentationModel.prototype = { 50 WebInspector.TimelinePresentationModel.prototype = {
51 /** 51 /**
(...skipping 29 matching lines...) Expand all
81 this._rootRecord = new WebInspector.TimelinePresentationModel.RootRecord (); 81 this._rootRecord = new WebInspector.TimelinePresentationModel.RootRecord ();
82 /** @type {!Object.<string, !WebInspector.TimelinePresentationModel.Reco rd>} */ 82 /** @type {!Object.<string, !WebInspector.TimelinePresentationModel.Reco rd>} */
83 this._coalescingBuckets = {}; 83 this._coalescingBuckets = {};
84 }, 84 },
85 85
86 /** 86 /**
87 * @param {!WebInspector.TimelineModel.Record} record 87 * @param {!WebInspector.TimelineModel.Record} record
88 */ 88 */
89 addRecord: function(record) 89 addRecord: function(record)
90 { 90 {
91 if (record.isProgram()) { 91 if (this._uiUtils.isProgram(record)) {
92 var records = record.children(); 92 var records = record.children();
93 for (var i = 0; i < records.length; ++i) 93 for (var i = 0; i < records.length; ++i)
94 this._innerAddRecord(this._rootRecord, records[i]); 94 this._innerAddRecord(this._rootRecord, records[i]);
95 } else { 95 } else {
96 this._innerAddRecord(this._rootRecord, record); 96 this._innerAddRecord(this._rootRecord, record);
97 } 97 }
98 }, 98 },
99 99
100 /** 100 /**
101 * @param {!WebInspector.TimelinePresentationModel.Record} parentRecord 101 * @param {!WebInspector.TimelinePresentationModel.Record} parentRecord
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 var lastRecord = bucket ? this._coalescingBuckets[bucket] : newParent._p resentationChildren.peekLast(); 139 var lastRecord = bucket ? this._coalescingBuckets[bucket] : newParent._p resentationChildren.peekLast();
140 if (lastRecord && lastRecord.coalesced()) 140 if (lastRecord && lastRecord.coalesced())
141 lastRecord = lastRecord._presentationChildren.peekLast(); 141 lastRecord = lastRecord._presentationChildren.peekLast();
142 var startTime = record.startTime(); 142 var startTime = record.startTime();
143 var endTime = record.endTime(); 143 var endTime = record.endTime();
144 if (!lastRecord) 144 if (!lastRecord)
145 return null; 145 return null;
146 if (lastRecord.record().type() !== record.type()) 146 if (lastRecord.record().type() !== record.type())
147 return null; 147 return null;
148 if (!this._coalescableRecordTypes[record.type()]) 148 if (!this._uiUtils.isCoalescable(record.type()))
149 return null; 149 return null;
150 if (lastRecord.record().endTime() + coalescingThresholdMillis < startTim e) 150 if (lastRecord.record().endTime() + coalescingThresholdMillis < startTim e)
151 return null; 151 return null;
152 if (endTime + coalescingThresholdMillis < lastRecord.record().startTime( )) 152 if (endTime + coalescingThresholdMillis < lastRecord.record().startTime( ))
153 return null; 153 return null;
154 if (lastRecord.presentationParent().coalesced()) 154 if (lastRecord.presentationParent().coalesced())
155 return lastRecord.presentationParent(); 155 return lastRecord.presentationParent();
156 return this._replaceWithCoalescedRecord(lastRecord); 156 return this._replaceWithCoalescedRecord(lastRecord);
157 }, 157 },
158 158
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 /** 598 /**
599 * @return {boolean} 599 * @return {boolean}
600 */ 600 */
601 hasWarnings: function() 601 hasWarnings: function()
602 { 602 {
603 return false; 603 return false;
604 }, 604 },
605 605
606 __proto__: WebInspector.TimelinePresentationModel.Record.prototype 606 __proto__: WebInspector.TimelinePresentationModel.Record.prototype
607 } 607 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/timeline/TimelinePanel.js ('k') | Source/devtools/front_end/timeline/TimelineUIUtils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698