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 {!Object.<string, number>} coalescableRecordTypes |
36 */ | 37 */ |
37 WebInspector.TimelinePresentationModel = function(model) | 38 WebInspector.TimelinePresentationModel = function(model, coalescableRecordTypes) |
38 { | 39 { |
39 this._model = model; | 40 this._model = model; |
| 41 this._coalescableRecordTypes = coalescableRecordTypes; |
40 this._filters = []; | 42 this._filters = []; |
41 /** | 43 /** |
42 * @type {!Map.<!WebInspector.TimelineModel.Record, !WebInspector.TimelinePr
esentationModel.Record>} | 44 * @type {!Map.<!WebInspector.TimelineModel.Record, !WebInspector.TimelinePr
esentationModel.Record>} |
43 */ | 45 */ |
44 this._recordToPresentationRecord = new Map(); | 46 this._recordToPresentationRecord = new Map(); |
45 this.reset(); | 47 this.reset(); |
46 } | 48 } |
47 | 49 |
48 WebInspector.TimelinePresentationModel._coalescingRecords = { }; | |
49 WebInspector.TimelinePresentationModel._coalescingRecords[WebInspector.TimelineM
odel.RecordType.Layout] = 1; | |
50 WebInspector.TimelinePresentationModel._coalescingRecords[WebInspector.TimelineM
odel.RecordType.Paint] = 1; | |
51 WebInspector.TimelinePresentationModel._coalescingRecords[WebInspector.TimelineM
odel.RecordType.Rasterize] = 1; | |
52 WebInspector.TimelinePresentationModel._coalescingRecords[WebInspector.TimelineM
odel.RecordType.DecodeImage] = 1; | |
53 WebInspector.TimelinePresentationModel._coalescingRecords[WebInspector.TimelineM
odel.RecordType.ResizeImage] = 1; | |
54 | |
55 WebInspector.TimelinePresentationModel.prototype = { | 50 WebInspector.TimelinePresentationModel.prototype = { |
56 /** | 51 /** |
57 * @param {number} startTime | 52 * @param {number} startTime |
58 * @param {number} endTime | 53 * @param {number} endTime |
59 */ | 54 */ |
60 setWindowTimes: function(startTime, endTime) | 55 setWindowTimes: function(startTime, endTime) |
61 { | 56 { |
62 this._windowStartTime = startTime; | 57 this._windowStartTime = startTime; |
63 this._windowEndTime = endTime; | 58 this._windowEndTime = endTime; |
64 }, | 59 }, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 139 |
145 var lastRecord = bucket ? this._coalescingBuckets[bucket] : newParent._p
resentationChildren.peekLast(); | 140 var lastRecord = bucket ? this._coalescingBuckets[bucket] : newParent._p
resentationChildren.peekLast(); |
146 if (lastRecord && lastRecord.coalesced()) | 141 if (lastRecord && lastRecord.coalesced()) |
147 lastRecord = lastRecord._presentationChildren.peekLast(); | 142 lastRecord = lastRecord._presentationChildren.peekLast(); |
148 var startTime = record.startTime(); | 143 var startTime = record.startTime(); |
149 var endTime = record.endTime(); | 144 var endTime = record.endTime(); |
150 if (!lastRecord) | 145 if (!lastRecord) |
151 return null; | 146 return null; |
152 if (lastRecord.record().type() !== record.type()) | 147 if (lastRecord.record().type() !== record.type()) |
153 return null; | 148 return null; |
154 if (!WebInspector.TimelinePresentationModel._coalescingRecords[record.ty
pe()]) | 149 if (!this._coalescableRecordTypes[record.type()]) |
155 return null; | 150 return null; |
156 if (lastRecord.record().endTime() + coalescingThresholdMillis < startTim
e) | 151 if (lastRecord.record().endTime() + coalescingThresholdMillis < startTim
e) |
157 return null; | 152 return null; |
158 if (endTime + coalescingThresholdMillis < lastRecord.record().startTime(
)) | 153 if (endTime + coalescingThresholdMillis < lastRecord.record().startTime(
)) |
159 return null; | 154 return null; |
160 if (lastRecord.presentationParent().coalesced()) | 155 if (lastRecord.presentationParent().coalesced()) |
161 return lastRecord.presentationParent(); | 156 return lastRecord.presentationParent(); |
162 return this._replaceWithCoalescedRecord(lastRecord); | 157 return this._replaceWithCoalescedRecord(lastRecord); |
163 }, | 158 }, |
164 | 159 |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 /** | 599 /** |
605 * @return {boolean} | 600 * @return {boolean} |
606 */ | 601 */ |
607 hasWarnings: function() | 602 hasWarnings: function() |
608 { | 603 { |
609 return false; | 604 return false; |
610 }, | 605 }, |
611 | 606 |
612 __proto__: WebInspector.TimelinePresentationModel.Record.prototype | 607 __proto__: WebInspector.TimelinePresentationModel.Record.prototype |
613 } | 608 } |
OLD | NEW |