OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.TimelineUIUtils} | 7 * @extends {WebInspector.TimelineUIUtils} |
8 */ | 8 */ |
9 WebInspector.TimelineUIUtilsImpl = function() | 9 WebInspector.TimelineUIUtilsImpl = function() |
10 { | 10 { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 return record.data().root; | 67 return record.data().root; |
68 case recordTypes.Paint: | 68 case recordTypes.Paint: |
69 return record.data().clip; | 69 return record.data().clip; |
70 default: | 70 default: |
71 return null; | 71 return null; |
72 } | 72 } |
73 }, | 73 }, |
74 | 74 |
75 /** | 75 /** |
76 * @param {!WebInspector.TimelineModel.Record} record | 76 * @param {!WebInspector.TimelineModel.Record} record |
| 77 * @return {string} |
| 78 */ |
| 79 titleForRecord: function(record) |
| 80 { |
| 81 return WebInspector.TimelineUIUtilsImpl.recordTitle(record); |
| 82 }, |
| 83 |
| 84 /** |
| 85 * @param {!WebInspector.TimelineModel.Record} record |
77 * @param {!WebInspector.Linkifier} linkifier | 86 * @param {!WebInspector.Linkifier} linkifier |
78 * @param {boolean} loadedFromFile | 87 * @param {boolean} loadedFromFile |
79 * @return {?Node} | 88 * @return {?Node} |
80 */ | 89 */ |
81 buildDetailsNode: function(record, linkifier, loadedFromFile) | 90 buildDetailsNode: function(record, linkifier, loadedFromFile) |
82 { | 91 { |
83 return WebInspector.TimelineUIUtilsImpl.buildDetailsNode(record, linkifi
er, loadedFromFile); | 92 return WebInspector.TimelineUIUtilsImpl.buildDetailsNode(record, linkifi
er, loadedFromFile); |
84 }, | 93 }, |
85 | 94 |
86 /** | 95 /** |
(...skipping 11 matching lines...) Expand all Loading... |
98 /** | 107 /** |
99 * @param {string} recordType | 108 * @param {string} recordType |
100 * @param {string=} title | 109 * @param {string=} title |
101 * @return {!Element} | 110 * @return {!Element} |
102 */ | 111 */ |
103 createEventDivider: function(recordType, title) | 112 createEventDivider: function(recordType, title) |
104 { | 113 { |
105 return WebInspector.TimelineUIUtilsImpl._createEventDivider(recordType,
title); | 114 return WebInspector.TimelineUIUtilsImpl._createEventDivider(recordType,
title); |
106 }, | 115 }, |
107 | 116 |
| 117 /** |
| 118 * @param {!WebInspector.TimelineModel.Record} record |
| 119 * @param {!RegExp} regExp |
| 120 * @return {boolean} |
| 121 */ |
| 122 testContentMatching: function(record, regExp) |
| 123 { |
| 124 var tokens = [WebInspector.TimelineUIUtilsImpl.recordTitle(record)]; |
| 125 var data = record.data(); |
| 126 for (var key in data) |
| 127 tokens.push(data[key]) |
| 128 return regExp.test(tokens.join("|")); |
| 129 }, |
| 130 |
108 __proto__: WebInspector.TimelineUIUtils.prototype | 131 __proto__: WebInspector.TimelineUIUtils.prototype |
109 } | 132 } |
110 | 133 |
111 | 134 |
112 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes = {}; | 135 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes = {}; |
113 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo
del.RecordType.Layout] = 1; | 136 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo
del.RecordType.Layout] = 1; |
114 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo
del.RecordType.Paint] = 1; | 137 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo
del.RecordType.Paint] = 1; |
115 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo
del.RecordType.Rasterize] = 1; | 138 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo
del.RecordType.Rasterize] = 1; |
116 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo
del.RecordType.DecodeImage] = 1; | 139 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo
del.RecordType.DecodeImage] = 1; |
117 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo
del.RecordType.ResizeImage] = 1; | 140 WebInspector.TimelineUIUtilsImpl._coalescableRecordTypes[WebInspector.TimelineMo
del.RecordType.ResizeImage] = 1; |
118 | 141 |
119 | 142 |
120 /** | 143 /** |
121 * @param {!WebInspector.TimelineModel.Record} record | 144 * @param {!WebInspector.TimelineModel.Record} record |
| 145 * @return {string} |
| 146 */ |
| 147 WebInspector.TimelineUIUtilsImpl.recordTitle = function(record) |
| 148 { |
| 149 var recordData = record.data(); |
| 150 if (record.type() === WebInspector.TimelineModel.RecordType.TimeStamp) |
| 151 return recordData["message"]; |
| 152 if (record.type() === WebInspector.TimelineModel.RecordType.JSFrame) |
| 153 return recordData["functionName"]; |
| 154 if (WebInspector.TimelineUIUtilsImpl.isEventDivider(record)) { |
| 155 var startTime = Number.millisToString(record.startTime() - record._model
.minimumRecordTime()); |
| 156 return WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.re
cordStyle(record).title, startTime, true); |
| 157 } |
| 158 return WebInspector.TimelineUIUtils.recordStyle(record).title; |
| 159 } |
| 160 |
| 161 /** |
| 162 * @param {!WebInspector.TimelineModel.Record} record |
122 * @return {boolean} | 163 * @return {boolean} |
123 */ | 164 */ |
124 WebInspector.TimelineUIUtilsImpl.isEventDivider = function(record) | 165 WebInspector.TimelineUIUtilsImpl.isEventDivider = function(record) |
125 { | 166 { |
126 var recordTypes = WebInspector.TimelineModel.RecordType; | 167 var recordTypes = WebInspector.TimelineModel.RecordType; |
127 if (record.type() === recordTypes.TimeStamp) | 168 if (record.type() === recordTypes.TimeStamp) |
128 return true; | 169 return true; |
129 if (record.type() === recordTypes.MarkFirstPaint) | 170 if (record.type() === recordTypes.MarkFirstPaint) |
130 return true; | 171 return true; |
131 if (record.type() === recordTypes.MarkDOMContent || record.type() === record
Types.MarkLoad) | 172 if (record.type() === recordTypes.MarkDOMContent || record.type() === record
Types.MarkLoad) |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 else if (recordType === recordTypes.TimeStamp) | 554 else if (recordType === recordTypes.TimeStamp) |
514 eventDivider.className += " resources-orange-divider"; | 555 eventDivider.className += " resources-orange-divider"; |
515 else if (recordType === recordTypes.BeginFrame) | 556 else if (recordType === recordTypes.BeginFrame) |
516 eventDivider.className += " timeline-frame-divider"; | 557 eventDivider.className += " timeline-frame-divider"; |
517 | 558 |
518 if (title) | 559 if (title) |
519 eventDivider.title = title; | 560 eventDivider.title = title; |
520 | 561 |
521 return eventDivider; | 562 return eventDivider; |
522 } | 563 } |
OLD | NEW |