OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /** | 7 /** |
8 * @constructor | 8 * @constructor |
9 * @extends {WebInspector.Object} | 9 * @extends {WebInspector.Object} |
10 */ | 10 */ |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 * @param {!Array.<!WebInspector.TracingModel.EventPayload>} events | 167 * @param {!Array.<!WebInspector.TracingModel.EventPayload>} events |
168 */ | 168 */ |
169 _eventsCollected: function(events) | 169 _eventsCollected: function(events) |
170 { | 170 { |
171 for (var i = 0; i < events.length; ++i) | 171 for (var i = 0; i < events.length; ++i) |
172 this._addEvent(events[i]); | 172 this._addEvent(events[i]); |
173 }, | 173 }, |
174 | 174 |
175 _tracingComplete: function() | 175 _tracingComplete: function() |
176 { | 176 { |
177 this._calculateWarnings(); | |
178 | |
177 this._active = false; | 179 this._active = false; |
178 if (!this._pendingStopCallback) | 180 if (!this._pendingStopCallback) |
179 return; | 181 return; |
180 this._pendingStopCallback(); | 182 this._pendingStopCallback(); |
181 this._pendingStopCallback = null; | 183 this._pendingStopCallback = null; |
182 }, | 184 }, |
185 | |
186 _calculateWarnings: function() | |
187 { | |
188 var events = this._inspectedTargetMainThreadEvents; | |
189 var currentScriptEvent = null; | |
190 for (var i = 0, l = events.length; i < l; i++) { | |
191 var event = events[i]; | |
192 if (currentScriptEvent && event.startTime > currentScriptEvent.endTi me) | |
193 currentScriptEvent = null; | |
194 if (event.name === WebInspector.TimelineModel.RecordType.Layout && c urrentScriptEvent) | |
195 this._eventToWarning.put(event, WebInspector.UIString("Forced sy nchronous layout is a possible performance bottleneck.")); | |
196 if (event.name === WebInspector.TimelineModel.RecordType.EvaluateScr ipt || event.name === WebInspector.TimelineModel.RecordType.FunctionCall) | |
caseq
2014/05/07 15:44:33
Looks like this belongs to a higher level than tra
yurys
2014/05/08 07:46:46
Done. Extracted this code into TracingModel.EventB
| |
197 currentScriptEvent = event; | |
198 } | |
199 }, | |
200 | |
201 /** | |
202 * @param {!WebInspector.TracingModel.Event} event | |
203 * @return {?string} | |
204 */ | |
205 eventWarning: function(event) | |
206 { | |
207 return this._eventToWarning.get(event); | |
208 }, | |
183 | 209 |
184 reset: function() | 210 reset: function() |
185 { | 211 { |
186 this._processById = {}; | 212 this._processById = {}; |
187 this._minimumRecordTime = null; | 213 this._minimumRecordTime = null; |
188 this._maximumRecordTime = null; | 214 this._maximumRecordTime = null; |
189 this._sessionId = null; | 215 this._sessionId = null; |
190 this._inspectedTargetProcessId = null; | 216 this._inspectedTargetProcessId = null; |
191 this._inspectedTargetMainThread = null; | 217 this._inspectedTargetMainThread = null; |
192 this._inspectedTargetMainThreadEvents = []; | 218 this._inspectedTargetMainThreadEvents = []; |
193 this._inspectedTargetLayerTreeHostId = 0; | 219 this._inspectedTargetLayerTreeHostId = 0; |
194 this._frameLifecycleEvents = []; | 220 this._frameLifecycleEvents = []; |
221 this._eventToWarning = new Map(); | |
195 }, | 222 }, |
196 | 223 |
197 /** | 224 /** |
198 * @param {!WebInspector.TracingModel.EventPayload} payload | 225 * @param {!WebInspector.TracingModel.EventPayload} payload |
199 */ | 226 */ |
200 _addEvent: function(payload) | 227 _addEvent: function(payload) |
201 { | 228 { |
202 var process = this._processById[payload.pid]; | 229 var process = this._processById[payload.pid]; |
203 if (!process) { | 230 if (!process) { |
204 process = new WebInspector.TracingModel.Process(payload.pid); | 231 process = new WebInspector.TracingModel.Process(payload.pid); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
545 dataCollected: function(data) | 572 dataCollected: function(data) |
546 { | 573 { |
547 this._tracingModel._eventsCollected(data); | 574 this._tracingModel._eventsCollected(data); |
548 }, | 575 }, |
549 | 576 |
550 tracingComplete: function() | 577 tracingComplete: function() |
551 { | 578 { |
552 this._tracingModel._tracingComplete(); | 579 this._tracingModel._tracingComplete(); |
553 } | 580 } |
554 } | 581 } |
OLD | NEW |