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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineFlameChart.js

Issue 2491823003: Timeline: add experiment to show events from subframes in the frames of their own (Closed)
Patch Set: rebased, adjusted name logic Created 4 years, 1 month 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
OLDNEW
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
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(this._appendFrameEvents.bind(this, 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 {number} level
431 * @param {!WebInspector.TimelineModel.PageFrame} frame
432 */
433 _appendFrameEvents(level, frame) {
434 var events = this._model.eventsForFrame(frame.id);
435 var clonedHeader = Object.assign({}, this._headerLevel1);
436 clonedHeader.nestingLevel = level;
437 this._appendSyncEvents(events, WebInspector.TimelineUIUtils.displayNameForFr ame(frame),
438 /** @type {!WebInspector.FlameChart.GroupStyle} */ (c lonedHeader));
439 frame.children.forEach(this._appendFrameEvents.bind(this, level + 1));
440 }
441
442 /**
421 * @param {string} threadTitle 443 * @param {string} threadTitle
422 * @param {!Array<!WebInspector.TracingModel.Event>} syncEvents 444 * @param {!Array<!WebInspector.TracingModel.Event>} syncEvents
423 * @param {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!WebInspec tor.TracingModel.AsyncEvent>>} asyncEvents 445 * @param {!Map<!WebInspector.TimelineModel.AsyncEventGroup, !Array<!WebInspec tor.TracingModel.AsyncEvent>>} asyncEvents
424 * @param {boolean=} forceExpanded 446 * @param {boolean=} forceExpanded
425 */ 447 */
426 _appendThreadTimelineData(threadTitle, syncEvents, asyncEvents, forceExpanded) { 448 _appendThreadTimelineData(threadTitle, syncEvents, asyncEvents, forceExpanded) {
427 this._appendAsyncEvents(asyncEvents); 449 this._appendAsyncEvents(asyncEvents);
428 this._appendSyncEvents(syncEvents, threadTitle, this._headerLevel1, forceExp anded); 450 this._appendSyncEvents(syncEvents, threadTitle, this._headerLevel1, forceExp anded);
429 } 451 }
430 452
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 WebInspector.TimelineFlameChartView.Selection = class { 1503 WebInspector.TimelineFlameChartView.Selection = class {
1482 /** 1504 /**
1483 * @param {!WebInspector.TimelineSelection} selection 1505 * @param {!WebInspector.TimelineSelection} selection
1484 * @param {number} entryIndex 1506 * @param {number} entryIndex
1485 */ 1507 */
1486 constructor(selection, entryIndex) { 1508 constructor(selection, entryIndex) {
1487 this.timelineSelection = selection; 1509 this.timelineSelection = selection;
1488 this.entryIndex = entryIndex; 1510 this.entryIndex = entryIndex;
1489 } 1511 }
1490 }; 1512 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698