OLD | NEW |
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 Loading... |
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 {!WebInspector.TimelineUIUtils} uiUtils | |
37 */ | 36 */ |
38 WebInspector.TimelinePresentationModel = function(model, uiUtils) | 37 WebInspector.TimelinePresentationModel = function(model) |
39 { | 38 { |
40 this._model = model; | 39 this._model = model; |
41 this._uiUtils = uiUtils; | |
42 this._filters = []; | 40 this._filters = []; |
43 /** | 41 /** |
44 * @type {!Map.<!WebInspector.TimelineModel.Record, !WebInspector.TimelinePr
esentationModel.Record>} | 42 * @type {!Map.<!WebInspector.TimelineModel.Record, !WebInspector.TimelinePr
esentationModel.Record>} |
45 */ | 43 */ |
46 this._recordToPresentationRecord = new Map(); | 44 this._recordToPresentationRecord = new Map(); |
47 this.reset(); | 45 this.reset(); |
48 } | 46 } |
49 | 47 |
50 WebInspector.TimelinePresentationModel.prototype = { | 48 WebInspector.TimelinePresentationModel.prototype = { |
51 /** | 49 /** |
(...skipping 29 matching lines...) Expand all Loading... |
81 this._rootRecord = new WebInspector.TimelinePresentationModel.RootRecord
(); | 79 this._rootRecord = new WebInspector.TimelinePresentationModel.RootRecord
(); |
82 /** @type {!Object.<string, !WebInspector.TimelinePresentationModel.Reco
rd>} */ | 80 /** @type {!Object.<string, !WebInspector.TimelinePresentationModel.Reco
rd>} */ |
83 this._coalescingBuckets = {}; | 81 this._coalescingBuckets = {}; |
84 }, | 82 }, |
85 | 83 |
86 /** | 84 /** |
87 * @param {!WebInspector.TimelineModel.Record} record | 85 * @param {!WebInspector.TimelineModel.Record} record |
88 */ | 86 */ |
89 addRecord: function(record) | 87 addRecord: function(record) |
90 { | 88 { |
91 if (this._uiUtils.isProgram(record)) { | 89 if (record.type() === WebInspector.TracingTimelineModel.RecordType.Progr
am) { |
92 var records = record.children(); | 90 var records = record.children(); |
93 for (var i = 0; i < records.length; ++i) | 91 for (var i = 0; i < records.length; ++i) |
94 this._innerAddRecord(this._rootRecord, records[i]); | 92 this._innerAddRecord(this._rootRecord, records[i]); |
95 } else { | 93 } else { |
96 this._innerAddRecord(this._rootRecord, record); | 94 this._innerAddRecord(this._rootRecord, record); |
97 } | 95 } |
98 }, | 96 }, |
99 | 97 |
100 /** | 98 /** |
101 * @param {!WebInspector.TimelinePresentationModel.Record} parentRecord | 99 * @param {!WebInspector.TimelinePresentationModel.Record} parentRecord |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 136 |
139 var lastRecord = bucket ? this._coalescingBuckets[bucket] : newParent._p
resentationChildren.peekLast(); | 137 var lastRecord = bucket ? this._coalescingBuckets[bucket] : newParent._p
resentationChildren.peekLast(); |
140 if (lastRecord && lastRecord.coalesced()) | 138 if (lastRecord && lastRecord.coalesced()) |
141 lastRecord = lastRecord._presentationChildren.peekLast(); | 139 lastRecord = lastRecord._presentationChildren.peekLast(); |
142 var startTime = record.startTime(); | 140 var startTime = record.startTime(); |
143 var endTime = record.endTime(); | 141 var endTime = record.endTime(); |
144 if (!lastRecord) | 142 if (!lastRecord) |
145 return null; | 143 return null; |
146 if (lastRecord.record().type() !== record.type()) | 144 if (lastRecord.record().type() !== record.type()) |
147 return null; | 145 return null; |
148 if (!this._uiUtils.isCoalescable(record.type())) | 146 if (!WebInspector.TimelineUIUtils.isCoalescable(record.type())) |
149 return null; | 147 return null; |
150 if (lastRecord.record().endTime() + coalescingThresholdMillis < startTim
e) | 148 if (lastRecord.record().endTime() + coalescingThresholdMillis < startTim
e) |
151 return null; | 149 return null; |
152 if (endTime + coalescingThresholdMillis < lastRecord.record().startTime(
)) | 150 if (endTime + coalescingThresholdMillis < lastRecord.record().startTime(
)) |
153 return null; | 151 return null; |
154 if (lastRecord.presentationParent().coalesced()) | 152 if (lastRecord.presentationParent().coalesced()) |
155 return lastRecord.presentationParent(); | 153 return lastRecord.presentationParent(); |
156 return this._replaceWithCoalescedRecord(lastRecord); | 154 return this._replaceWithCoalescedRecord(lastRecord); |
157 }, | 155 }, |
158 | 156 |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
575 /** | 573 /** |
576 * @return {boolean} | 574 * @return {boolean} |
577 */ | 575 */ |
578 hasWarnings: function() | 576 hasWarnings: function() |
579 { | 577 { |
580 return false; | 578 return false; |
581 }, | 579 }, |
582 | 580 |
583 __proto__: WebInspector.TimelinePresentationModel.Record.prototype | 581 __proto__: WebInspector.TimelinePresentationModel.Record.prototype |
584 } | 582 } |
OLD | NEW |