| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @param {function(!WebInspector.TracingModel.Event):string} categoryMapper | 33 * @param {function(!WebInspector.TracingModel.Event):string} categoryMapper |
| 34 */ | 34 */ |
| 35 WebInspector.TimelineFrameModel = function(categoryMapper) | 35 WebInspector.TimelineFrameModel = function(categoryMapper) |
| 36 { | 36 { |
| 37 this._categoryMapper = categoryMapper; | 37 this._categoryMapper = categoryMapper; |
| 38 this.reset(); | 38 this.reset(); |
| 39 } | 39 }; |
| 40 | 40 |
| 41 WebInspector.TimelineFrameModel._mainFrameMarkers = [ | 41 WebInspector.TimelineFrameModel._mainFrameMarkers = [ |
| 42 WebInspector.TimelineModel.RecordType.ScheduleStyleRecalculation, | 42 WebInspector.TimelineModel.RecordType.ScheduleStyleRecalculation, |
| 43 WebInspector.TimelineModel.RecordType.InvalidateLayout, | 43 WebInspector.TimelineModel.RecordType.InvalidateLayout, |
| 44 WebInspector.TimelineModel.RecordType.BeginMainThreadFrame, | 44 WebInspector.TimelineModel.RecordType.BeginMainThreadFrame, |
| 45 WebInspector.TimelineModel.RecordType.ScrollLayer | 45 WebInspector.TimelineModel.RecordType.ScrollLayer |
| 46 ]; | 46 ]; |
| 47 | 47 |
| 48 WebInspector.TimelineFrameModel.prototype = { | 48 WebInspector.TimelineFrameModel.prototype = { |
| 49 /** | 49 /** |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 * @param {!Object.<string, number>} timeByCategory | 372 * @param {!Object.<string, number>} timeByCategory |
| 373 * @param {!WebInspector.TracingModel.Event} event | 373 * @param {!WebInspector.TracingModel.Event} event |
| 374 */ | 374 */ |
| 375 _addTimeForCategory: function(timeByCategory, event) | 375 _addTimeForCategory: function(timeByCategory, event) |
| 376 { | 376 { |
| 377 if (!event.selfTime) | 377 if (!event.selfTime) |
| 378 return; | 378 return; |
| 379 var categoryName = this._categoryMapper(event); | 379 var categoryName = this._categoryMapper(event); |
| 380 timeByCategory[categoryName] = (timeByCategory[categoryName] || 0) + eve
nt.selfTime; | 380 timeByCategory[categoryName] = (timeByCategory[categoryName] || 0) + eve
nt.selfTime; |
| 381 }, | 381 }, |
| 382 } | 382 }; |
| 383 | 383 |
| 384 /** | 384 /** |
| 385 * @constructor | 385 * @constructor |
| 386 * @param {!WebInspector.Target} target | 386 * @param {!WebInspector.Target} target |
| 387 * @param {!WebInspector.TracingModel.ObjectSnapshot} snapshot | 387 * @param {!WebInspector.TracingModel.ObjectSnapshot} snapshot |
| 388 */ | 388 */ |
| 389 WebInspector.TracingFrameLayerTree = function(target, snapshot) | 389 WebInspector.TracingFrameLayerTree = function(target, snapshot) |
| 390 { | 390 { |
| 391 this._target = target; | 391 this._target = target; |
| 392 this._snapshot = snapshot; | 392 this._snapshot = snapshot; |
| 393 /** @type {!Array<!WebInspector.LayerPaintEvent>|undefined} */ | 393 /** @type {!Array<!WebInspector.LayerPaintEvent>|undefined} */ |
| 394 this._paints; | 394 this._paints; |
| 395 } | 395 }; |
| 396 | 396 |
| 397 WebInspector.TracingFrameLayerTree.prototype = { | 397 WebInspector.TracingFrameLayerTree.prototype = { |
| 398 /** | 398 /** |
| 399 * @return {!Promise<?WebInspector.TracingLayerTree>} | 399 * @return {!Promise<?WebInspector.TracingLayerTree>} |
| 400 */ | 400 */ |
| 401 layerTreePromise: function() | 401 layerTreePromise: function() |
| 402 { | 402 { |
| 403 return this._snapshot.objectPromise().then(result => { | 403 return this._snapshot.objectPromise().then(result => { |
| 404 if (!result) | 404 if (!result) |
| 405 return null; | 405 return null; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 this.duration = 0; | 445 this.duration = 0; |
| 446 this.timeByCategory = {}; | 446 this.timeByCategory = {}; |
| 447 this.cpuTime = 0; | 447 this.cpuTime = 0; |
| 448 this.idle = false; | 448 this.idle = false; |
| 449 /** @type {?WebInspector.TracingFrameLayerTree} */ | 449 /** @type {?WebInspector.TracingFrameLayerTree} */ |
| 450 this.layerTree = null; | 450 this.layerTree = null; |
| 451 /** @type {!Array.<!WebInspector.LayerPaintEvent>} */ | 451 /** @type {!Array.<!WebInspector.LayerPaintEvent>} */ |
| 452 this._paints = []; | 452 this._paints = []; |
| 453 /** @type {number|undefined} */ | 453 /** @type {number|undefined} */ |
| 454 this._mainFrameId = undefined; | 454 this._mainFrameId = undefined; |
| 455 } | 455 }; |
| 456 | 456 |
| 457 WebInspector.TimelineFrame.prototype = { | 457 WebInspector.TimelineFrame.prototype = { |
| 458 /** | 458 /** |
| 459 * @return {boolean} | 459 * @return {boolean} |
| 460 */ | 460 */ |
| 461 hasWarnings: function() | 461 hasWarnings: function() |
| 462 { | 462 { |
| 463 var /** @const */ longFrameDurationThresholdMs = 22; | 463 var /** @const */ longFrameDurationThresholdMs = 22; |
| 464 return !this.idle && this.duration > longFrameDurationThresholdMs; | 464 return !this.idle && this.duration > longFrameDurationThresholdMs; |
| 465 }, | 465 }, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 492 | 492 |
| 493 /** | 493 /** |
| 494 * @param {string} category | 494 * @param {string} category |
| 495 * @param {number} time | 495 * @param {number} time |
| 496 */ | 496 */ |
| 497 _addTimeForCategory: function(category, time) | 497 _addTimeForCategory: function(category, time) |
| 498 { | 498 { |
| 499 this.timeByCategory[category] = (this.timeByCategory[category] || 0) + t
ime; | 499 this.timeByCategory[category] = (this.timeByCategory[category] || 0) + t
ime; |
| 500 this.cpuTime += time; | 500 this.cpuTime += time; |
| 501 }, | 501 }, |
| 502 } | 502 }; |
| 503 | 503 |
| 504 /** | 504 /** |
| 505 * @constructor | 505 * @constructor |
| 506 * @param {!WebInspector.TracingModel.Event} event | 506 * @param {!WebInspector.TracingModel.Event} event |
| 507 * @param {?WebInspector.Target} target | 507 * @param {?WebInspector.Target} target |
| 508 */ | 508 */ |
| 509 WebInspector.LayerPaintEvent = function(event, target) | 509 WebInspector.LayerPaintEvent = function(event, target) |
| 510 { | 510 { |
| 511 this._event = event; | 511 this._event = event; |
| 512 this._target = target; | 512 this._target = target; |
| 513 } | 513 }; |
| 514 | 514 |
| 515 WebInspector.LayerPaintEvent.prototype = { | 515 WebInspector.LayerPaintEvent.prototype = { |
| 516 /** | 516 /** |
| 517 * @return {string} | 517 * @return {string} |
| 518 */ | 518 */ |
| 519 layerId: function() | 519 layerId: function() |
| 520 { | 520 { |
| 521 return this._event.args["data"]["layerId"]; | 521 return this._event.args["data"]["layerId"]; |
| 522 }, | 522 }, |
| 523 | 523 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 */ | 563 */ |
| 564 WebInspector.PendingFrame = function(triggerTime, timeByCategory) | 564 WebInspector.PendingFrame = function(triggerTime, timeByCategory) |
| 565 { | 565 { |
| 566 /** @type {!Object.<string, number>} */ | 566 /** @type {!Object.<string, number>} */ |
| 567 this.timeByCategory = timeByCategory; | 567 this.timeByCategory = timeByCategory; |
| 568 /** @type {!Array.<!WebInspector.LayerPaintEvent>} */ | 568 /** @type {!Array.<!WebInspector.LayerPaintEvent>} */ |
| 569 this.paints = []; | 569 this.paints = []; |
| 570 /** @type {number|undefined} */ | 570 /** @type {number|undefined} */ |
| 571 this.mainFrameId = undefined; | 571 this.mainFrameId = undefined; |
| 572 this.triggerTime = triggerTime; | 572 this.triggerTime = triggerTime; |
| 573 } | 573 }; |
| OLD | NEW |