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._bindings = new WebInspector.TracingModel.EventBindings(this); |
177 this._active = false; | 178 this._active = false; |
178 if (!this._pendingStopCallback) | 179 if (!this._pendingStopCallback) |
179 return; | 180 return; |
180 this._pendingStopCallback(); | 181 this._pendingStopCallback(); |
181 this._pendingStopCallback = null; | 182 this._pendingStopCallback = null; |
182 }, | 183 }, |
183 | 184 |
| 185 /** |
| 186 * @return {?WebInspector.TracingModel.EventBindings} |
| 187 */ |
| 188 bindings: function() |
| 189 { |
| 190 return this._bindings; |
| 191 }, |
| 192 |
184 reset: function() | 193 reset: function() |
185 { | 194 { |
186 this._processById = {}; | 195 this._processById = {}; |
187 this._minimumRecordTime = null; | 196 this._minimumRecordTime = null; |
188 this._maximumRecordTime = null; | 197 this._maximumRecordTime = null; |
189 this._sessionId = null; | 198 this._sessionId = null; |
190 this._inspectedTargetProcessId = null; | 199 this._inspectedTargetProcessId = null; |
191 this._inspectedTargetMainThread = null; | 200 this._inspectedTargetMainThread = null; |
192 this._inspectedTargetMainThreadEvents = []; | 201 this._inspectedTargetMainThreadEvents = []; |
193 this._inspectedTargetLayerTreeHostId = 0; | 202 this._inspectedTargetLayerTreeHostId = 0; |
194 this._frameLifecycleEvents = []; | 203 this._frameLifecycleEvents = []; |
| 204 this._bindings = null; |
195 }, | 205 }, |
196 | 206 |
197 /** | 207 /** |
198 * @param {!WebInspector.TracingModel.EventPayload} payload | 208 * @param {!WebInspector.TracingModel.EventPayload} payload |
199 */ | 209 */ |
200 _addEvent: function(payload) | 210 _addEvent: function(payload) |
201 { | 211 { |
202 var process = this._processById[payload.pid]; | 212 var process = this._processById[payload.pid]; |
203 if (!process) { | 213 if (!process) { |
204 process = new WebInspector.TracingModel.Process(payload.pid); | 214 process = new WebInspector.TracingModel.Process(payload.pid); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 */ | 294 */ |
285 sortedProcesses: function() | 295 sortedProcesses: function() |
286 { | 296 { |
287 return WebInspector.TracingModel.NamedObject._sort(Object.values(this._p
rocessById)); | 297 return WebInspector.TracingModel.NamedObject._sort(Object.values(this._p
rocessById)); |
288 }, | 298 }, |
289 | 299 |
290 __proto__: WebInspector.Object.prototype | 300 __proto__: WebInspector.Object.prototype |
291 } | 301 } |
292 | 302 |
293 /** | 303 /** |
| 304 * @param {!WebInspector.TracingModel} model |
| 305 * @constructor |
| 306 */ |
| 307 WebInspector.TracingModel.EventBindings = function(model) |
| 308 { |
| 309 this._eventToWarning = new Map(); |
| 310 this._model = model; |
| 311 this._calculateWarnings(); |
| 312 } |
| 313 |
| 314 WebInspector.TracingModel.EventBindings.prototype = { |
| 315 /** |
| 316 * @param {!WebInspector.TracingModel.Event} event |
| 317 * @return {string|undefined} |
| 318 */ |
| 319 eventWarning: function(event) |
| 320 { |
| 321 return this._eventToWarning.get(event); |
| 322 }, |
| 323 |
| 324 _calculateWarnings: function() |
| 325 { |
| 326 var events = this._model.inspectedTargetMainThreadEvents(); |
| 327 var currentScriptEvent = null; |
| 328 for (var i = 0, length = events.length; i < length; i++) { |
| 329 var event = events[i]; |
| 330 if (currentScriptEvent && event.startTime > currentScriptEvent.endTi
me) |
| 331 currentScriptEvent = null; |
| 332 if (event.name === WebInspector.TimelineModel.RecordType.Layout) { |
| 333 if (currentScriptEvent) |
| 334 this._eventToWarning.put(event, WebInspector.UIString("Force
d synchronous layout is a possible performance bottleneck.")); |
| 335 } |
| 336 if (!currentScriptEvent && (event.name === WebInspector.TimelineMode
l.RecordType.EvaluateScript || event.name === WebInspector.TimelineModel.RecordT
ype.FunctionCall)) |
| 337 currentScriptEvent = event; |
| 338 } |
| 339 } |
| 340 } |
| 341 |
| 342 /** |
294 * @constructor | 343 * @constructor |
295 * @param {!WebInspector.TracingModel.EventPayload} payload | 344 * @param {!WebInspector.TracingModel.EventPayload} payload |
296 * @param {number} level | 345 * @param {number} level |
297 */ | 346 */ |
298 WebInspector.TracingModel.Event = function(payload, level) | 347 WebInspector.TracingModel.Event = function(payload, level) |
299 { | 348 { |
300 this.name = payload.name; | 349 this.name = payload.name; |
301 this.category = payload.cat; | 350 this.category = payload.cat; |
302 this.startTime = payload.ts; | 351 this.startTime = payload.ts; |
303 this.args = payload.args; | 352 this.args = payload.args; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 dataCollected: function(data) | 594 dataCollected: function(data) |
546 { | 595 { |
547 this._tracingModel._eventsCollected(data); | 596 this._tracingModel._eventsCollected(data); |
548 }, | 597 }, |
549 | 598 |
550 tracingComplete: function() | 599 tracingComplete: function() |
551 { | 600 { |
552 this._tracingModel._tracingComplete(); | 601 this._tracingModel._tracingComplete(); |
553 } | 602 } |
554 } | 603 } |
OLD | NEW |