Chromium Code Reviews| 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) { | |
|
caseq
2014/05/08 09:58:18
{ => next line.
yurys
2014/05/08 10:49:27
Done.
| |
| 308 this._eventToWarning = new Map(); | |
| 309 this._model = model; | |
| 310 this._calculateWarnings(); | |
| 311 } | |
| 312 | |
| 313 WebInspector.TracingModel.EventBindings.prototype = { | |
| 314 /** | |
| 315 * @param {!WebInspector.TracingModel.Event} event | |
| 316 * @return {string|undefined} | |
| 317 */ | |
| 318 eventWarning: function(event) | |
| 319 { | |
| 320 return this._eventToWarning.get(event); | |
| 321 }, | |
| 322 | |
| 323 _calculateWarnings: function() | |
| 324 { | |
| 325 var events = this._model.inspectedTargetMainThreadEvents(); | |
| 326 var currentScriptEvent = null; | |
| 327 for (var i = 0, length = events.length; i < length; i++) { | |
| 328 var event = events[i]; | |
| 329 if (currentScriptEvent && event.startTime > currentScriptEvent.endTi me) | |
| 330 currentScriptEvent = null; | |
| 331 if (event.name === WebInspector.TimelineModel.RecordType.Layout && c urrentScriptEvent) | |
| 332 this._eventToWarning.put(event, WebInspector.UIString("Forced sy nchronous layout is a possible performance bottleneck.")); | |
| 333 if (!currentScriptEvent && (event.name === WebInspector.TimelineMode l.RecordType.EvaluateScript || event.name === WebInspector.TimelineModel.RecordT ype.FunctionCall)) | |
| 334 currentScriptEvent = event; | |
| 335 } | |
| 336 } | |
| 337 } | |
| 338 | |
| 339 /** | |
| 294 * @constructor | 340 * @constructor |
| 295 * @param {!WebInspector.TracingModel.EventPayload} payload | 341 * @param {!WebInspector.TracingModel.EventPayload} payload |
| 296 * @param {number} level | 342 * @param {number} level |
| 297 */ | 343 */ |
| 298 WebInspector.TracingModel.Event = function(payload, level) | 344 WebInspector.TracingModel.Event = function(payload, level) |
| 299 { | 345 { |
| 300 this.name = payload.name; | 346 this.name = payload.name; |
| 301 this.category = payload.cat; | 347 this.category = payload.cat; |
| 302 this.startTime = payload.ts; | 348 this.startTime = payload.ts; |
| 303 this.args = payload.args; | 349 this.args = payload.args; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 dataCollected: function(data) | 591 dataCollected: function(data) |
| 546 { | 592 { |
| 547 this._tracingModel._eventsCollected(data); | 593 this._tracingModel._eventsCollected(data); |
| 548 }, | 594 }, |
| 549 | 595 |
| 550 tracingComplete: function() | 596 tracingComplete: function() |
| 551 { | 597 { |
| 552 this._tracingModel._tracingComplete(); | 598 this._tracingModel._tracingComplete(); |
| 553 } | 599 } |
| 554 } | 600 } |
| OLD | NEW |