Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: Source/devtools/front_end/timeline/TracingTimelineModel.js

Issue 671913005: Implement layout invalidation tracking in devtools (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/inspector/tracing/timeline-paint-with-style-recalc-invalidations.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.TracingManager} tracingManager 7 * @param {!WebInspector.TracingManager} tracingManager
8 * @param {!WebInspector.TracingModel} tracingModel 8 * @param {!WebInspector.TracingModel} tracingModel
9 * @param {!WebInspector.TimelineModel.Filter} recordFilter 9 * @param {!WebInspector.TimelineModel.Filter} recordFilter
10 * @extends {WebInspector.TimelineModel} 10 * @extends {WebInspector.TimelineModel}
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 // Consider style recalculation as a reason for layout invalidation, 611 // Consider style recalculation as a reason for layout invalidation,
612 // but only if we had no earlier layout invalidation records. 612 // but only if we had no earlier layout invalidation records.
613 var layoutInitator = event; 613 var layoutInitator = event;
614 var frameId = event.args["frame"]; 614 var frameId = event.args["frame"];
615 if (!this._layoutInvalidate[frameId] && this._lastRecalculateStylesE vent && this._lastRecalculateStylesEvent.endTime > event.startTime) 615 if (!this._layoutInvalidate[frameId] && this._lastRecalculateStylesE vent && this._lastRecalculateStylesEvent.endTime > event.startTime)
616 layoutInitator = this._lastRecalculateStylesEvent.initiator; 616 layoutInitator = this._lastRecalculateStylesEvent.initiator;
617 this._layoutInvalidate[frameId] = layoutInitator; 617 this._layoutInvalidate[frameId] = layoutInitator;
618 break; 618 break;
619 619
620 case recordTypes.Layout: 620 case recordTypes.Layout:
621 this._invalidationTracker.didLayout(event);
621 var frameId = event.args["beginData"]["frame"]; 622 var frameId = event.args["beginData"]["frame"];
622 event.initiator = this._layoutInvalidate[frameId]; 623 event.initiator = this._layoutInvalidate[frameId];
623 // In case we have no closing Layout event, endData is not available . 624 // In case we have no closing Layout event, endData is not available .
624 if (event.args["endData"]) { 625 if (event.args["endData"]) {
625 event.backendNodeId = event.args["endData"]["rootNode"]; 626 event.backendNodeId = event.args["endData"]["rootNode"];
626 event.highlightQuad = event.args["endData"]["root"]; 627 event.highlightQuad = event.args["endData"]["root"];
627 } 628 }
628 this._layoutInvalidate[frameId] = null; 629 this._layoutInvalidate[frameId] = null;
629 if (this._currentScriptEvent) 630 if (this._currentScriptEvent)
630 event.warning = WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."); 631 event.warning = WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck.");
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 if (invalidation.type !== WebInspector.TracingTimelineModel.RecordTy pe.StyleRecalcInvalidationTracking) 1191 if (invalidation.type !== WebInspector.TracingTimelineModel.RecordTy pe.StyleRecalcInvalidationTracking)
1191 continue; 1192 continue;
1192 if (invalidation.frameId === recalcFrameId) 1193 if (invalidation.frameId === recalcFrameId)
1193 this._addInvalidationTrackingEvent(styleRecalcEvent, invalidatio n); 1194 this._addInvalidationTrackingEvent(styleRecalcEvent, invalidatio n);
1194 } 1195 }
1195 1196
1196 this._lastStyleRecalcEventIndex = invalidationCount; 1197 this._lastStyleRecalcEventIndex = invalidationCount;
1197 }, 1198 },
1198 1199
1199 /** 1200 /**
1201 * @param {!WebInspector.TracingModel.Event} layoutEvent
1202 */
1203 didLayout: function(layoutEvent)
kouhei (in TOK) 2014/10/23 04:48:38 I think we should share the logic here with didRec
pdr. 2014/10/23 05:09:44 I thought the same but it feels a little overengin
1204 {
1205 var layoutFrameId = layoutEvent.args["beginData"]["frame"];
1206 var index = this._lastLayoutEventIndex;
1207 var invalidationCount = this._invalidationEvents.length;
1208 for (; index < invalidationCount; index++) {
1209 var invalidation = this._invalidationEvents[index];
1210 if (invalidation.type !== WebInspector.TracingTimelineModel.RecordTy pe.LayoutInvalidationTracking)
1211 continue;
1212 if (invalidation.frameId === layoutFrameId)
1213 this._addInvalidationTrackingEvent(layoutEvent, invalidation);
1214 }
1215
1216 this._lastLayoutEventIndex = invalidationCount;
1217 },
1218
1219 /**
1200 * @param {!WebInspector.TracingModel.Event} paintEvent 1220 * @param {!WebInspector.TracingModel.Event} paintEvent
1201 */ 1221 */
1202 didPaint: function(paintEvent) 1222 didPaint: function(paintEvent)
1203 { 1223 {
1204 this._didPaint = true; 1224 this._didPaint = true;
1205 1225
1206 // If a paint doesn't have a corresponding graphics layer id, it paints 1226 // If a paint doesn't have a corresponding graphics layer id, it paints
1207 // into its parent so add an effectivePaintId to these events. 1227 // into its parent so add an effectivePaintId to these events.
1208 var layerId = paintEvent.args["data"]["layerId"]; 1228 var layerId = paintEvent.args["data"]["layerId"];
1209 if (layerId) 1229 if (layerId)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 if (!this._didPaint) 1261 if (!this._didPaint)
1242 return; 1262 return;
1243 1263
1244 this._initializePerFrameState(); 1264 this._initializePerFrameState();
1245 }, 1265 },
1246 1266
1247 _initializePerFrameState: function() 1267 _initializePerFrameState: function()
1248 { 1268 {
1249 this._invalidationEvents = []; 1269 this._invalidationEvents = [];
1250 this._lastStyleRecalcEventIndex = 0; 1270 this._lastStyleRecalcEventIndex = 0;
1271 this._lastLayoutEventIndex = 0;
kouhei (in TOK) 2014/10/23 04:48:38 Perhaps make this a map? this._lastEventIndex[Styl
1251 this._lastPaintWithLayer = undefined; 1272 this._lastPaintWithLayer = undefined;
1252 this._didPaint = false; 1273 this._didPaint = false;
1253 } 1274 }
1254 } 1275 }
OLDNEW
« no previous file with comments | « LayoutTests/inspector/tracing/timeline-paint-with-style-recalc-invalidations.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698