Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 if (inputLatencies && inputLatencies.length) { | 380 if (inputLatencies && inputLatencies.length) { |
| 381 var title = WebInspector.TimelineUIUtils.titleForAsyncEventGroup(asyncEven tGroups.input); | 381 var title = WebInspector.TimelineUIUtils.titleForAsyncEventGroup(asyncEven tGroups.input); |
| 382 this._appendAsyncEventsGroup(title, inputLatencies, this._interactionsHead erLevel2); | 382 this._appendAsyncEventsGroup(title, inputLatencies, this._interactionsHead erLevel2); |
| 383 } | 383 } |
| 384 var animations = this._model.mainThreadAsyncEvents().get(asyncEventGroups.an imation); | 384 var animations = this._model.mainThreadAsyncEvents().get(asyncEventGroups.an imation); |
| 385 if (animations && animations.length) { | 385 if (animations && animations.length) { |
| 386 var title = WebInspector.TimelineUIUtils.titleForAsyncEventGroup(asyncEven tGroups.animation); | 386 var title = WebInspector.TimelineUIUtils.titleForAsyncEventGroup(asyncEven tGroups.animation); |
| 387 this._appendAsyncEventsGroup(title, animations, this._interactionsHeaderLe vel2); | 387 this._appendAsyncEventsGroup(title, animations, this._interactionsHeaderLe vel2); |
| 388 } | 388 } |
| 389 var threads = this._model.virtualThreads(); | 389 var threads = this._model.virtualThreads(); |
| 390 this._appendThreadTimelineData( | 390 if (!Runtime.experiments.isEnabled('timelinePerFrameTrack')) { |
| 391 WebInspector.UIString('Main'), this._model.mainThreadEvents(), this._mod el.mainThreadAsyncEvents(), true); | 391 this._appendThreadTimelineData( |
| 392 WebInspector.UIString('Main'), this._model.mainThreadEvents(), this._m odel.mainThreadAsyncEvents(), true); | |
| 393 } else { | |
| 394 this._appendThreadTimelineData( | |
| 395 WebInspector.UIString('Page'), this._model.eventsForFrame(WebInspector .TimelineModel.PageFrame.mainFrameId), this._model.mainThreadAsyncEvents(), true ); | |
| 396 for (var frame of this._model.rootFrames()) { | |
| 397 // Ignore top frame itself, since it should be part of page events. | |
| 398 frame.children.forEach(child => this._appendFrameEvents(child, 0)); | |
| 399 } | |
| 400 } | |
| 392 var compositorThreads = threads.filter(thread => thread.name.startsWith('Com positorTileWorker')); | 401 var compositorThreads = threads.filter(thread => thread.name.startsWith('Com positorTileWorker')); |
| 393 var otherThreads = threads.filter(thread => !thread.name.startsWith('Composi torTileWorker')); | 402 var otherThreads = threads.filter(thread => !thread.name.startsWith('Composi torTileWorker')); |
| 394 if (compositorThreads.length) { | 403 if (compositorThreads.length) { |
| 395 this._appendHeader(WebInspector.UIString('Raster'), this._headerLevel1); | 404 this._appendHeader(WebInspector.UIString('Raster'), this._headerLevel1); |
| 396 for (var i = 0; i < compositorThreads.length; ++i) | 405 for (var i = 0; i < compositorThreads.length; ++i) |
| 397 this._appendSyncEvents( | 406 this._appendSyncEvents( |
| 398 compositorThreads[i].events, WebInspector.UIString('Rasterizer Threa d %d', i), this._headerLevel2); | 407 compositorThreads[i].events, WebInspector.UIString('Rasterizer Threa d %d', i), this._headerLevel2); |
| 399 } | 408 } |
| 400 this._appendGPUEvents(); | 409 this._appendGPUEvents(); |
| 401 | 410 |
| 402 otherThreads.forEach( | 411 otherThreads.forEach( |
| 403 thread => this._appendThreadTimelineData(thread.name, thread.events, thr ead.asyncEventsByGroup)); | 412 thread => this._appendThreadTimelineData(thread.name, thread.events, thr ead.asyncEventsByGroup)); |
| 404 | 413 |
| 405 /** | 414 /** |
| 406 * @param {!WebInspector.TimelineFlameChartMarker} a | 415 * @param {!WebInspector.TimelineFlameChartMarker} a |
| 407 * @param {!WebInspector.TimelineFlameChartMarker} b | 416 * @param {!WebInspector.TimelineFlameChartMarker} b |
| 408 */ | 417 */ |
| 409 function compareStartTime(a, b) { | 418 function compareStartTime(a, b) { |
| 410 return a.startTime() - b.startTime(); | 419 return a.startTime() - b.startTime(); |
| 411 } | 420 } |
| 412 | 421 |
| 413 this._markers.sort(compareStartTime); | 422 this._markers.sort(compareStartTime); |
| 414 this._timelineData.markers = this._markers; | 423 this._timelineData.markers = this._markers; |
| 415 | 424 |
| 416 this._flowEventIndexById = {}; | 425 this._flowEventIndexById = {}; |
| 417 return this._timelineData; | 426 return this._timelineData; |
| 418 } | 427 } |
| 419 | 428 |
| 420 /** | 429 /** |
| 430 * @param {!WebInspector.TimelineModel.PageFrame} frame | |
| 431 * @param {number} level | |
| 432 */ | |
| 433 _appendFrameEvents(frame, level) { | |
| 434 var events = this._model.eventsForFrame(frame.id); | |
| 435 var clonedHeader = Object.assign({}, this._headerLevel1); | |
| 436 clonedHeader.nestingLevel = level; | |
| 437 this._appendSyncEvents(events, `"${frame.name.trimMiddle(30)}" ${frame.url.t rimEnd(80)}`, /** @type {!WebInspector.FlameChart.GroupStyle} */ (clonedHeader)) ; | |
| 438 frame.children.forEach(child => this._appendFrameEvents(child, level + 1)); | |
|
alph
2016/11/11 02:32:35
nit:
if you move the frame argument to the end you
| |
| 439 } | |
| 440 | |
| 441 /** | |
| 421 * @param {string} threadTitle | 442 * @param {string} threadTitle |
| 422 * @param {!Array<!WebInspector.TracingModel.Event>} syncEvents | 443 * @param {!Array<!WebInspector.TracingModel.Event>} syncEvents |
| 423 * @param {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!WebInspec tor.TracingModel.AsyncEvent>>} asyncEvents | 444 * @param {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!WebInspec tor.TracingModel.AsyncEvent>>} asyncEvents |
| 424 * @param {boolean=} forceExpanded | 445 * @param {boolean=} forceExpanded |
| 425 */ | 446 */ |
| 426 _appendThreadTimelineData(threadTitle, syncEvents, asyncEvents, forceExpanded) { | 447 _appendThreadTimelineData(threadTitle, syncEvents, asyncEvents, forceExpanded) { |
| 427 this._appendAsyncEvents(asyncEvents); | 448 this._appendAsyncEvents(asyncEvents); |
| 428 this._appendSyncEvents(syncEvents, threadTitle, this._headerLevel1, forceExp anded); | 449 this._appendSyncEvents(syncEvents, threadTitle, this._headerLevel1, forceExp anded); |
| 429 } | 450 } |
| 430 | 451 |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1483 WebInspector.TimelineFlameChartView.Selection = class { | 1504 WebInspector.TimelineFlameChartView.Selection = class { |
| 1484 /** | 1505 /** |
| 1485 * @param {!WebInspector.TimelineSelection} selection | 1506 * @param {!WebInspector.TimelineSelection} selection |
| 1486 * @param {number} entryIndex | 1507 * @param {number} entryIndex |
| 1487 */ | 1508 */ |
| 1488 constructor(selection, entryIndex) { | 1509 constructor(selection, entryIndex) { |
| 1489 this.timelineSelection = selection; | 1510 this.timelineSelection = selection; |
| 1490 this.entryIndex = entryIndex; | 1511 this.entryIndex = entryIndex; |
| 1491 } | 1512 } |
| 1492 }; | 1513 }; |
| OLD | NEW |