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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 InspectorTest.FakeFileReader = function(input, delegate, callback) | 276 InspectorTest.FakeFileReader = function(input, delegate, callback) |
277 { | 277 { |
278 this._delegate = delegate; | 278 this._delegate = delegate; |
279 this._callback = callback; | 279 this._callback = callback; |
280 this._input = input; | 280 this._input = input; |
281 this._loadedSize = 0; | 281 this._loadedSize = 0; |
282 this._fileSize = input.length; | 282 this._fileSize = input.length; |
283 }; | 283 }; |
284 | 284 |
| 285 InspectorTest.dumpFrame = function(frame) |
| 286 { |
| 287 var fieldsToDump = ["cpuTime", "duration", "startTime", "endTime", "id", "ma
inThreadFrameId", "isBackground", "timeByCategory", "other", "scripting", "paint
ing", "rendering", "committedFrom"]; |
| 288 function formatFields(object) |
| 289 { |
| 290 var result = {}; |
| 291 for (var key in object) { |
| 292 if (fieldsToDump.indexOf(key) < 0) |
| 293 continue; |
| 294 var value = object[key]; |
| 295 if (typeof value === "number") |
| 296 value = Number(value.toFixed(7)); |
| 297 else if (typeof value === "object" && value) |
| 298 value = formatFields(value); |
| 299 result[key] = value; |
| 300 } |
| 301 return result; |
| 302 } |
| 303 InspectorTest.addObject(formatFields(frame)); |
| 304 } |
| 305 |
285 InspectorTest.FakeFileReader.prototype = { | 306 InspectorTest.FakeFileReader.prototype = { |
286 start: function(output) | 307 start: function(output) |
287 { | 308 { |
288 this._delegate.onTransferStarted(this); | 309 this._delegate.onTransferStarted(this); |
289 | 310 |
290 var length = this._input.length; | 311 var length = this._input.length; |
291 var half = (length + 1) >> 1; | 312 var half = (length + 1) >> 1; |
292 | 313 |
293 var chunk = this._input.substring(0, half); | 314 var chunk = this._input.substring(0, half); |
294 this._loadedSize += chunk.length; | 315 this._loadedSize += chunk.length; |
(...skipping 23 matching lines...) Expand all Loading... |
318 return this._fileSize; | 339 return this._fileSize; |
319 }, | 340 }, |
320 | 341 |
321 fileName: function() | 342 fileName: function() |
322 { | 343 { |
323 return "fakeFile"; | 344 return "fakeFile"; |
324 } | 345 } |
325 }; | 346 }; |
326 | 347 |
327 }; | 348 }; |
OLD | NEW |