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

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

Issue 310313003: Introduce TracingTimelineModel (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months 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 | Annotate | Revision Log
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/timeline/TimelineFrameModel.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 } 435 }
436 } 436 }
437 return -1; 437 return -1;
438 } 438 }
439 } 439 }
440 440
441 /** 441 /**
442 * @constructor 442 * @constructor
443 * @implements {WebInspector.FlameChartDataProvider} 443 * @implements {WebInspector.FlameChartDataProvider}
444 * @implements {WebInspector.TimelineFlameChart.SelectionProvider} 444 * @implements {WebInspector.TimelineFlameChart.SelectionProvider}
445 * @param {!WebInspector.TracingModel} model 445 * @param {!WebInspector.TracingTimelineModel} model
446 * @param {!WebInspector.TimelineTraceEventBindings} traceEventBindings
447 * @param {!WebInspector.TimelineFrameModel} frameModel 446 * @param {!WebInspector.TimelineFrameModel} frameModel
448 * @param {!WebInspector.Target} target 447 * @param {!WebInspector.Target} target
449 */ 448 */
450 WebInspector.TracingBasedTimelineFlameChartDataProvider = function(model, traceE ventBindings, frameModel, target) 449 WebInspector.TracingBasedTimelineFlameChartDataProvider = function(model, frameM odel, target)
451 { 450 {
452 WebInspector.FlameChartDataProvider.call(this); 451 WebInspector.FlameChartDataProvider.call(this);
453 this._model = model; 452 this._model = model;
454 this._traceEventBindings = traceEventBindings;
455 this._frameModel = frameModel; 453 this._frameModel = frameModel;
456 this._target = target; 454 this._target = target;
457 this._font = "12px " + WebInspector.fontFamily(); 455 this._font = "12px " + WebInspector.fontFamily();
458 this._linkifier = new WebInspector.Linkifier(); 456 this._linkifier = new WebInspector.Linkifier();
459 this._palette = new WebInspector.TraceViewPalette(); 457 this._palette = new WebInspector.TraceViewPalette();
460 this._entryIndexToTitle = {}; 458 this._entryIndexToTitle = {};
461 } 459 }
462 460
463 WebInspector.TracingBasedTimelineFlameChartDataProvider.prototype = { 461 WebInspector.TracingBasedTimelineFlameChartDataProvider.prototype = {
464 /** 462 /**
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 /** 495 /**
498 * @param {number} entryIndex 496 * @param {number} entryIndex
499 * @return {?string} 497 * @return {?string}
500 */ 498 */
501 entryTitle: function(entryIndex) 499 entryTitle: function(entryIndex)
502 { 500 {
503 var event = this._entryEvents[entryIndex]; 501 var event = this._entryEvents[entryIndex];
504 if (event) { 502 if (event) {
505 var name = WebInspector.TimelineUIUtils.styleForTimelineEvent(event. name).title; 503 var name = WebInspector.TimelineUIUtils.styleForTimelineEvent(event. name).title;
506 // TODO(yurys): support event dividers 504 // TODO(yurys): support event dividers
507 var details = WebInspector.TimelineUIUtils.buildDetailsNodeForTraceE vent(event, this._linkifier, false, this._traceEventBindings, this._target); 505 var details = WebInspector.TimelineUIUtils.buildDetailsNodeForTraceE vent(event, this._linkifier, false, this._target);
508 return details ? WebInspector.UIString("%s (%s)", name, details.text Content) : name; 506 return details ? WebInspector.UIString("%s (%s)", name, details.text Content) : name;
509 } 507 }
510 var title = this._entryIndexToTitle[entryIndex]; 508 var title = this._entryIndexToTitle[entryIndex];
511 if (!title) { 509 if (!title) {
512 title = WebInspector.UIString("Unexpected entryIndex %d", entryIndex ); 510 title = WebInspector.UIString("Unexpected entryIndex %d", entryIndex );
513 console.error(title); 511 console.error(title);
514 } 512 }
515 return title; 513 return title;
516 }, 514 },
517 515
(...skipping 29 matching lines...) Expand all
547 this._timelineData = { 545 this._timelineData = {
548 entryLevels: [], 546 entryLevels: [],
549 entryTotalTimes: [], 547 entryTotalTimes: [],
550 entryStartTimes: [] 548 entryStartTimes: []
551 }; 549 };
552 550
553 this._currentLevel = 0; 551 this._currentLevel = 0;
554 this._minimumBoundary = this._model.minimumRecordTime() || 0; 552 this._minimumBoundary = this._model.minimumRecordTime() || 0;
555 this._timeSpan = Math.max((this._model.maximumRecordTime() || 0) - this. _minimumBoundary, 1000000); 553 this._timeSpan = Math.max((this._model.maximumRecordTime() || 0) - this. _minimumBoundary, 1000000);
556 this._appendHeaderRecord("CPU"); 554 this._appendHeaderRecord("CPU");
557 var events = this._traceEventBindings.mainThreadEvents(); 555 var events = this._model.mainThreadEvents();
558 var maxStackDepth = 0; 556 var maxStackDepth = 0;
559 for (var eventIndex = 0; eventIndex < events.length; ++eventIndex) { 557 for (var eventIndex = 0; eventIndex < events.length; ++eventIndex) {
560 var event = events[eventIndex]; 558 var event = events[eventIndex];
561 var category = event.category; 559 var category = event.category;
562 if (category !== "disabled-by-default-devtools.timeline" && category !== "devtools") 560 if (category !== "disabled-by-default-devtools.timeline" && category !== "devtools")
563 continue; 561 continue;
564 if (event.duration || event.phase === WebInspector.TracingModel.Phas e.Instant) { 562 if (event.duration || event.phase === WebInspector.TracingModel.Phas e.Instant) {
565 this._appendEvent(event); 563 this._appendEvent(event);
566 if (maxStackDepth < event.level) 564 if (maxStackDepth < event.level)
567 maxStackDepth = event.level; 565 maxStackDepth = event.level;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 return WebInspector.TimelineFlameChartDataProvider._jsFrameColorGenerator; 806 return WebInspector.TimelineFlameChartDataProvider._jsFrameColorGenerator;
809 } 807 }
810 808
811 /** 809 /**
812 * @constructor 810 * @constructor
813 * @extends {WebInspector.VBox} 811 * @extends {WebInspector.VBox}
814 * @implements {WebInspector.TimelineModeView} 812 * @implements {WebInspector.TimelineModeView}
815 * @implements {WebInspector.FlameChartDelegate} 813 * @implements {WebInspector.FlameChartDelegate}
816 * @param {!WebInspector.TimelineModeViewDelegate} delegate 814 * @param {!WebInspector.TimelineModeViewDelegate} delegate
817 * @param {!WebInspector.TimelineModel} model 815 * @param {!WebInspector.TimelineModel} model
818 * @param {?WebInspector.TracingModel} tracingModel 816 * @param {?WebInspector.TracingTimelineModel} tracingModel
819 * @param {?WebInspector.TimelineTraceEventBindings} traceEventBindings
820 * @param {!WebInspector.TimelineFrameModel} frameModel 817 * @param {!WebInspector.TimelineFrameModel} frameModel
821 */ 818 */
822 WebInspector.TimelineFlameChart = function(delegate, model, tracingModel, traceE ventBindings, frameModel) 819 WebInspector.TimelineFlameChart = function(delegate, model, tracingModel, frameM odel)
823 { 820 {
824 WebInspector.VBox.call(this); 821 WebInspector.VBox.call(this);
825 this.element.classList.add("timeline-flamechart"); 822 this.element.classList.add("timeline-flamechart");
826 this.registerRequiredCSS("flameChart.css"); 823 this.registerRequiredCSS("flameChart.css");
827 this._delegate = delegate; 824 this._delegate = delegate;
828 this._model = model; 825 this._model = model;
829 this._dataProvider = tracingModel && traceEventBindings 826 this._dataProvider = tracingModel
830 ? new WebInspector.TracingBasedTimelineFlameChartDataProvider(tracingMod el, traceEventBindings, frameModel, model.target()) 827 ? new WebInspector.TracingBasedTimelineFlameChartDataProvider(tracingMod el, frameModel, model.target())
831 : new WebInspector.TimelineFlameChartDataProvider(model, frameModel); 828 : new WebInspector.TimelineFlameChartDataProvider(model, frameModel);
832 this._mainView = new WebInspector.FlameChart(this._dataProvider, this, true) ; 829 this._mainView = new WebInspector.FlameChart(this._dataProvider, this, true) ;
833 this._mainView.show(this.element); 830 this._mainView.show(this.element);
834 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar ted, this._onRecordingStarted, this); 831 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar ted, this._onRecordingStarted, this);
835 this._mainView.addEventListener(WebInspector.FlameChart.Events.EntrySelected , this._onEntrySelected, this); 832 this._mainView.addEventListener(WebInspector.FlameChart.Events.EntrySelected , this._onEntrySelected, this);
836 } 833 }
837 834
838 WebInspector.TimelineFlameChart.prototype = { 835 WebInspector.TimelineFlameChart.prototype = {
839 dispose: function() 836 dispose: function()
840 { 837 {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 * @param {number} entryIndex 980 * @param {number} entryIndex
984 * @return {?WebInspector.TimelineSelection} 981 * @return {?WebInspector.TimelineSelection}
985 */ 982 */
986 createSelection: function(entryIndex) { }, 983 createSelection: function(entryIndex) { },
987 /** 984 /**
988 * @param {?WebInspector.TimelineSelection} selection 985 * @param {?WebInspector.TimelineSelection} selection
989 * @return {number} 986 * @return {number}
990 */ 987 */
991 entryIndexForSelection: function(selection) { } 988 entryIndexForSelection: function(selection) { }
992 } 989 }
OLDNEW
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/timeline/TimelineFrameModel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698