| OLD | NEW |
| 1 var initialize_Timeline = function() { | 1 var initialize_Timeline = function() { |
| 2 | 2 |
| 3 // Scrub values when printing out these properties in the record or data field. | 3 // Scrub values when printing out these properties in the record or data field. |
| 4 InspectorTest.timelinePropertyFormatters = { | 4 InspectorTest.timelinePropertyFormatters = { |
| 5 children: "formatAsTypeName", | 5 children: "formatAsTypeName", |
| 6 endTime: "formatAsTypeName", | 6 endTime: "formatAsTypeName", |
| 7 requestId: "formatAsTypeName", | 7 requestId: "formatAsTypeName", |
| 8 startTime: "formatAsTypeName", | 8 startTime: "formatAsTypeName", |
| 9 stackTrace: "formatAsTypeName", | 9 stackTrace: "formatAsTypeName", |
| 10 url: "formatAsURL", | 10 url: "formatAsURL", |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 InspectorTest.dumpTimelineRecord = function(record, detailsCallback, level, filt
erTypes) | 145 InspectorTest.dumpTimelineRecord = function(record, detailsCallback, level, filt
erTypes) |
| 146 { | 146 { |
| 147 if (typeof level !== "number") | 147 if (typeof level !== "number") |
| 148 level = 0; | 148 level = 0; |
| 149 var prefix = ""; | 149 var prefix = ""; |
| 150 var suffix = ""; | 150 var suffix = ""; |
| 151 for (var i = 0; i < level ; ++i) | 151 for (var i = 0; i < level ; ++i) |
| 152 prefix = "----" + prefix; | 152 prefix = "----" + prefix; |
| 153 if (level > 0) | 153 if (level > 0) |
| 154 prefix = prefix + "> "; | 154 prefix = prefix + "> "; |
| 155 if (record.coalesced) { | 155 if (record.type === WebInspector.TimelineModel.RecordType.TimeStamp |
| 156 suffix = " x " + record.children.length; | |
| 157 } else if (record.type === WebInspector.TimelineModel.RecordType.TimeStamp | |
| 158 || record.type === WebInspector.TimelineModel.RecordType.ConsoleTime) { | 156 || record.type === WebInspector.TimelineModel.RecordType.ConsoleTime) { |
| 159 suffix = " : " + record.data.message; | 157 suffix = " : " + record.data.message; |
| 160 } | 158 } |
| 161 if (detailsCallback) | 159 if (detailsCallback) |
| 162 suffix += " " + detailsCallback(record); | 160 suffix += " " + detailsCallback(record); |
| 163 InspectorTest.addResult(prefix + InspectorTest._timelineAgentTypeToString(re
cord.type) + suffix); | 161 InspectorTest.addResult(prefix + InspectorTest._timelineAgentTypeToString(re
cord.type) + suffix); |
| 164 | 162 |
| 165 var numChildren = record.children ? record.children.length : 0; | 163 var numChildren = record.children ? record.children.length : 0; |
| 166 for (var i = 0; i < numChildren; ++i) { | 164 for (var i = 0; i < numChildren; ++i) { |
| 167 if (filterTypes && filterTypes.indexOf(record.children[i].type) == -1) | 165 if (filterTypes && filterTypes.indexOf(record.children[i].type) == -1) |
| 168 continue; | 166 continue; |
| 169 InspectorTest.dumpTimelineRecord(record.children[i], detailsCallback, le
vel + 1, filterTypes); | 167 InspectorTest.dumpTimelineRecord(record.children[i], detailsCallback, le
vel + 1, filterTypes); |
| 170 } | 168 } |
| 171 } | 169 } |
| 172 | 170 |
| 171 // Dump just the record name, indenting output on separate lines for subrecords |
| 172 InspectorTest.dumpPresentationRecord = function(presentationRecord, detailsCallb
ack, level, filterTypes) |
| 173 { |
| 174 var record = presentationRecord.record(); |
| 175 if (typeof level !== "number") |
| 176 level = 0; |
| 177 var prefix = ""; |
| 178 var suffix = ""; |
| 179 for (var i = 0; i < level ; ++i) |
| 180 prefix = "----" + prefix; |
| 181 if (level > 0) |
| 182 prefix = prefix + "> "; |
| 183 if (presentationRecord.coalesced()) { |
| 184 suffix = " x " + presentationRecord.presentationChildren().length; |
| 185 } else if (record.type === WebInspector.TimelineModel.RecordType.TimeStamp |
| 186 || record.type === WebInspector.TimelineModel.RecordType.ConsoleTime) { |
| 187 suffix = " : " + record.data.message; |
| 188 } |
| 189 if (detailsCallback) |
| 190 suffix += " " + detailsCallback(record); |
| 191 InspectorTest.addResult(prefix + InspectorTest._timelineAgentTypeToString(re
cord.type) + suffix); |
| 192 |
| 193 var numChildren = presentationRecord.presentationChildren() ? presentationRe
cord.presentationChildren().length : 0; |
| 194 for (var i = 0; i < numChildren; ++i) { |
| 195 if (filterTypes && filterTypes.indexOf(presentationRecord.presentationCh
ildren()[i].record().type) == -1) |
| 196 continue; |
| 197 InspectorTest.dumpPresentationRecord(presentationRecord.presentationChil
dren()[i], detailsCallback, level + 1, filterTypes); |
| 198 } |
| 199 } |
| 200 |
| 173 InspectorTest.dumpTimelineRecords = function(timelineRecords) | 201 InspectorTest.dumpTimelineRecords = function(timelineRecords) |
| 174 { | 202 { |
| 175 for (var i = 0; i < timelineRecords.length; ++i) | 203 for (var i = 0; i < timelineRecords.length; ++i) |
| 176 InspectorTest.dumpTimelineRecord(timelineRecords[i], 0); | 204 InspectorTest.dumpTimelineRecord(timelineRecords[i], 0); |
| 177 }; | 205 }; |
| 178 | 206 |
| 179 InspectorTest.printTimelineRecordProperties = function(record) | 207 InspectorTest.printTimelineRecordProperties = function(record) |
| 180 { | 208 { |
| 181 InspectorTest.addResult(InspectorTest._timelineAgentTypeToString(record.type
) + " Properties:"); | 209 InspectorTest.addResult(InspectorTest._timelineAgentTypeToString(record.type
) + " Properties:"); |
| 182 // Use this recursive routine to print the properties | 210 // Use this recursive routine to print the properties |
| 211 if (record instanceof WebInspector.TimelineModel.Record) |
| 212 record = record._record; |
| 183 InspectorTest.addObject(record, InspectorTest.timelinePropertyFormatters); | 213 InspectorTest.addObject(record, InspectorTest.timelinePropertyFormatters); |
| 184 }; | 214 }; |
| 185 | 215 |
| 186 InspectorTest._timelineAgentTypeToString = function(numericType) | 216 InspectorTest._timelineAgentTypeToString = function(numericType) |
| 187 { | 217 { |
| 188 for (var prop in WebInspector.TimelineModel.RecordType) { | 218 for (var prop in WebInspector.TimelineModel.RecordType) { |
| 189 if (WebInspector.TimelineModel.RecordType[prop] === numericType) | 219 if (WebInspector.TimelineModel.RecordType[prop] === numericType) |
| 190 return prop; | 220 return prop; |
| 191 } | 221 } |
| 192 return undefined; | 222 return undefined; |
| 193 }; | 223 }; |
| 194 | 224 |
| 195 InspectorTest.findPresentationRecord = function(type) | 225 InspectorTest.findPresentationRecord = function(type) |
| 196 { | 226 { |
| 197 var result; | 227 var result; |
| 198 function findByType(record) | 228 function findByType(record) |
| 199 { | 229 { |
| 200 if (record.type !== type) | 230 if (record.type !== type) |
| 201 return false; | 231 return false; |
| 202 result = record; | 232 result = record; |
| 203 return true; | 233 return true; |
| 204 } | 234 } |
| 205 var records = WebInspector.panel("timeline")._currentViews[0]._rootRecord().
children; | 235 WebInspector.panel("timeline")._model.forAllRecords(findByType); |
| 206 WebInspector.TimelinePresentationModel.forAllRecords(records, findByType); | |
| 207 return result; | 236 return result; |
| 208 } | 237 } |
| 209 | 238 |
| 210 InspectorTest.FakeFileReader = function(input, delegate, callback) | 239 InspectorTest.FakeFileReader = function(input, delegate, callback) |
| 211 { | 240 { |
| 212 this._delegate = delegate; | 241 this._delegate = delegate; |
| 213 this._callback = callback; | 242 this._callback = callback; |
| 214 this._input = input; | 243 this._input = input; |
| 215 this._loadedSize = 0; | 244 this._loadedSize = 0; |
| 216 this._fileSize = input.length; | 245 this._fileSize = input.length; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 return this._fileSize; | 281 return this._fileSize; |
| 253 }, | 282 }, |
| 254 | 283 |
| 255 fileName: function() | 284 fileName: function() |
| 256 { | 285 { |
| 257 return "fakeFile"; | 286 return "fakeFile"; |
| 258 } | 287 } |
| 259 }; | 288 }; |
| 260 | 289 |
| 261 }; | 290 }; |
| OLD | NEW |