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 * @param {!WebInspector.TracingModel} tracingModel | 7 * @param {!WebInspector.TracingModel} tracingModel |
8 * @param {!WebInspector.TimelineModel.Filter} recordFilter | 8 * @param {!WebInspector.TimelineModel.Filter} recordFilter |
9 * @extends {WebInspector.TimelineModel} | 9 * @extends {WebInspector.TimelineModel} |
10 */ | 10 */ |
(...skipping 13 matching lines...) Expand all Loading... | |
24 EventDispatch: "EventDispatch", | 24 EventDispatch: "EventDispatch", |
25 | 25 |
26 GPUTask: "GPUTask", | 26 GPUTask: "GPUTask", |
27 | 27 |
28 RequestMainThreadFrame: "RequestMainThreadFrame", | 28 RequestMainThreadFrame: "RequestMainThreadFrame", |
29 BeginFrame: "BeginFrame", | 29 BeginFrame: "BeginFrame", |
30 BeginMainThreadFrame: "BeginMainThreadFrame", | 30 BeginMainThreadFrame: "BeginMainThreadFrame", |
31 ActivateLayerTree: "ActivateLayerTree", | 31 ActivateLayerTree: "ActivateLayerTree", |
32 DrawFrame: "DrawFrame", | 32 DrawFrame: "DrawFrame", |
33 ScheduleStyleRecalculation: "ScheduleStyleRecalculation", | 33 ScheduleStyleRecalculation: "ScheduleStyleRecalculation", |
34 Invalidation: "Invalidation", | |
34 RecalculateStyles: "RecalculateStyles", | 35 RecalculateStyles: "RecalculateStyles", |
35 InvalidateLayout: "InvalidateLayout", | 36 InvalidateLayout: "InvalidateLayout", |
36 Layout: "Layout", | 37 Layout: "Layout", |
37 UpdateLayer: "UpdateLayer", | 38 UpdateLayer: "UpdateLayer", |
38 UpdateLayerTree: "UpdateLayerTree", | 39 UpdateLayerTree: "UpdateLayerTree", |
39 PaintSetup: "PaintSetup", | 40 PaintSetup: "PaintSetup", |
40 Paint: "Paint", | 41 Paint: "Paint", |
41 PaintImage: "PaintImage", | 42 PaintImage: "PaintImage", |
42 Rasterize: "Rasterize", | 43 Rasterize: "Rasterize", |
43 RasterTask: "RasterTask", | 44 RasterTask: "RasterTask", |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 this._configureCpuProfilerSamplingInterval(); | 132 this._configureCpuProfilerSamplingInterval(); |
132 this._currentTarget.profilerAgent().start(); | 133 this._currentTarget.profilerAgent().start(); |
133 } | 134 } |
134 } | 135 } |
135 if (capturePictures) { | 136 if (capturePictures) { |
136 categoriesArray = categoriesArray.concat([ | 137 categoriesArray = categoriesArray.concat([ |
137 disabledByDefault("devtools.timeline.layers"), | 138 disabledByDefault("devtools.timeline.layers"), |
138 disabledByDefault("devtools.timeline.picture"), | 139 disabledByDefault("devtools.timeline.picture"), |
139 disabledByDefault("blink.graphics_context_annotations")]); | 140 disabledByDefault("blink.graphics_context_annotations")]); |
140 } | 141 } |
142 // FIXME: Do not always enable this expensive category for invalidations . | |
143 categoriesArray.push(disabledByDefault("devtools.timeline.invalidations" )); | |
141 var categories = categoriesArray.join(","); | 144 var categories = categoriesArray.join(","); |
142 this._startRecordingWithCategories(categories); | 145 this._startRecordingWithCategories(categories); |
143 }, | 146 }, |
144 | 147 |
145 stopRecording: function() | 148 stopRecording: function() |
146 { | 149 { |
147 this._stopCallbackBarrier = new CallbackBarrier(); | 150 this._stopCallbackBarrier = new CallbackBarrier(); |
148 if (this._jsProfilerStarted) { | 151 if (this._jsProfilerStarted) { |
149 this._currentTarget.profilerAgent().stop(this._stopCallbackBarrier.c reateCallback(this._didStopRecordingJSSamples.bind(this))); | 152 this._currentTarget.profilerAgent().stop(this._stopCallbackBarrier.c reateCallback(this._didStopRecordingJSSamples.bind(this))); |
150 this._jsProfilerStarted = false; | 153 this._jsProfilerStarted = false; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 if (record.type() === WebInspector.TracingTimelineModel.RecordType.GPUTa sk) | 362 if (record.type() === WebInspector.TracingTimelineModel.RecordType.GPUTa sk) |
360 this._gpuThreadTasks.push(record); | 363 this._gpuThreadTasks.push(record); |
361 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordAd ded, record); | 364 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordAd ded, record); |
362 }, | 365 }, |
363 | 366 |
364 _resetProcessingState: function() | 367 _resetProcessingState: function() |
365 { | 368 { |
366 this._sendRequestEvents = {}; | 369 this._sendRequestEvents = {}; |
367 this._timerEvents = {}; | 370 this._timerEvents = {}; |
368 this._requestAnimationFrameEvents = {}; | 371 this._requestAnimationFrameEvents = {}; |
372 this._invalidations = {}; | |
369 this._layoutInvalidate = {}; | 373 this._layoutInvalidate = {}; |
370 this._lastScheduleStyleRecalculation = {}; | 374 this._lastScheduleStyleRecalculation = {}; |
371 this._webSocketCreateEvents = {}; | 375 this._webSocketCreateEvents = {}; |
372 this._paintImageEventByPixelRefId = {}; | 376 this._paintImageEventByPixelRefId = {}; |
373 this._lastPaintForLayer = {}; | 377 this._lastPaintForLayer = {}; |
374 this._lastRecalculateStylesEvent = null; | 378 this._lastRecalculateStylesEvent = null; |
375 this._currentScriptEvent = null; | 379 this._currentScriptEvent = null; |
376 this._eventStack = []; | 380 this._eventStack = []; |
377 }, | 381 }, |
378 | 382 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
469 | 473 |
470 case recordTypes.ScheduleStyleRecalculation: | 474 case recordTypes.ScheduleStyleRecalculation: |
471 this._lastScheduleStyleRecalculation[event.args.frame] = event; | 475 this._lastScheduleStyleRecalculation[event.args.frame] = event; |
472 break; | 476 break; |
473 | 477 |
474 case recordTypes.RecalculateStyles: | 478 case recordTypes.RecalculateStyles: |
475 event.initiator = this._lastScheduleStyleRecalculation[event.args.fr ame]; | 479 event.initiator = this._lastScheduleStyleRecalculation[event.args.fr ame]; |
476 this._lastRecalculateStylesEvent = event; | 480 this._lastRecalculateStylesEvent = event; |
477 break; | 481 break; |
478 | 482 |
483 case recordTypes.Invalidation: | |
484 var layoutInitator = event; | |
485 var frameId = event.args.data.frame; | |
486 var rootNode = event.args.data.root_node; | |
487 var styleChange = event.args.data.styleChange; | |
488 | |
489 var invalidationString = rootNode + " was invalidated with " + style Change; | |
490 if (this._invalidations[frameId] === undefined) | |
491 this._invalidations[frameId] = [invalidationString]; | |
492 else | |
493 this._invalidations[frameId].push(invalidationString); | |
494 break; | |
495 | |
479 case recordTypes.InvalidateLayout: | 496 case recordTypes.InvalidateLayout: |
480 // Consider style recalculation as a reason for layout invalidation, | 497 // Consider style recalculation as a reason for layout invalidation, |
481 // but only if we had no earlier layout invalidation records. | 498 // but only if we had no earlier layout invalidation records. |
482 var layoutInitator = event; | 499 var layoutInitator = event; |
483 var frameId = event.args.frame; | 500 var frameId = event.args.frame; |
484 if (!this._layoutInvalidate[frameId] && this._lastRecalculateStylesE vent && this._lastRecalculateStylesEvent.endTime > event.startTime) | 501 if (!this._layoutInvalidate[frameId] && this._lastRecalculateStylesE vent && this._lastRecalculateStylesEvent.endTime > event.startTime) |
485 layoutInitator = this._lastRecalculateStylesEvent.initiator; | 502 layoutInitator = this._lastRecalculateStylesEvent.initiator; |
kouhei (in TOK)
2014/08/13 16:32:14
This line is interesting. Looks like they are alre
| |
486 this._layoutInvalidate[frameId] = layoutInitator; | 503 this._layoutInvalidate[frameId] = layoutInitator; |
487 break; | 504 break; |
488 | 505 |
489 case recordTypes.Layout: | 506 case recordTypes.Layout: |
490 var frameId = event.args["beginData"]["frame"]; | 507 var frameId = event.args["beginData"]["frame"]; |
491 event.initiator = this._layoutInvalidate[frameId]; | 508 event.initiator = this._layoutInvalidate[frameId]; |
509 event.invalidations = this._invalidations[frameId] ? this._invalidat ions[frameId].join('<br>') : 'No invalidations'; | |
kouhei (in TOK)
2014/08/13 16:32:14
I'm wondering how well we should track the flow of
| |
492 event.backendNodeId = event.args["endData"]["rootNode"]; | 510 event.backendNodeId = event.args["endData"]["rootNode"]; |
493 event.highlightQuad = event.args["endData"]["root"]; | 511 event.highlightQuad = event.args["endData"]["root"]; |
494 this._layoutInvalidate[frameId] = null; | 512 this._layoutInvalidate[frameId] = null; |
513 this._invalidations[frameId] = undefined; | |
495 if (this._currentScriptEvent) | 514 if (this._currentScriptEvent) |
496 event.warning = WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."); | 515 event.warning = WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."); |
497 break; | 516 break; |
498 | 517 |
499 case recordTypes.WebSocketCreate: | 518 case recordTypes.WebSocketCreate: |
500 this._webSocketCreateEvents[event.args.data["identifier"]] = event; | 519 this._webSocketCreateEvents[event.args.data["identifier"]] = event; |
501 break; | 520 break; |
502 | 521 |
503 case recordTypes.WebSocketSendHandshakeRequest: | 522 case recordTypes.WebSocketSendHandshakeRequest: |
504 case recordTypes.WebSocketReceiveHandshakeResponse: | 523 case recordTypes.WebSocketReceiveHandshakeResponse: |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
995 }, | 1014 }, |
996 | 1015 |
997 _didWriteNextChunk: function(stream) | 1016 _didWriteNextChunk: function(stream) |
998 { | 1017 { |
999 if (this._recordIndex === this._payloads.length) | 1018 if (this._recordIndex === this._payloads.length) |
1000 stream.close(); | 1019 stream.close(); |
1001 else | 1020 else |
1002 this._writeNextChunk(stream); | 1021 this._writeNextChunk(stream); |
1003 } | 1022 } |
1004 } | 1023 } |
OLD | NEW |