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

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

Issue 2313093004: Timeline: always create filmstrip model and share single instance of it (Closed)
Patch Set: Timeline: always create filmstrip model Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 if (!Runtime.experiments.isEnabled("timelineShowAllEvents")) { 56 if (!Runtime.experiments.isEnabled("timelineShowAllEvents")) {
57 this._filters.push(WebInspector.TimelineUIUtils.visibleEventsFilter()); 57 this._filters.push(WebInspector.TimelineUIUtils.visibleEventsFilter());
58 this._filters.push(new WebInspector.ExcludeTopLevelFilter()); 58 this._filters.push(new WebInspector.ExcludeTopLevelFilter());
59 } 59 }
60 60
61 // Create models. 61 // Create models.
62 this._tracingModelBackingStorage = new WebInspector.TempFileBackingStorage(" tracing"); 62 this._tracingModelBackingStorage = new WebInspector.TempFileBackingStorage(" tracing");
63 this._tracingModel = new WebInspector.TracingModel(this._tracingModelBacking Storage); 63 this._tracingModel = new WebInspector.TracingModel(this._tracingModelBacking Storage);
64 this._model = new WebInspector.TimelineModel(WebInspector.TimelineUIUtils.vi sibleEventsFilter()); 64 this._model = new WebInspector.TimelineModel(WebInspector.TimelineUIUtils.vi sibleEventsFilter());
65 this._frameModel = new WebInspector.TimelineFrameModel(event => WebInspector .TimelineUIUtils.eventStyle(event).category.name); 65 this._frameModel = new WebInspector.TimelineFrameModel(event => WebInspector .TimelineUIUtils.eventStyle(event).category.name);
66 this._filmStripModel = new WebInspector.FilmStripModel(this._tracingModel);
66 this._irModel = new WebInspector.TimelineIRModel(); 67 this._irModel = new WebInspector.TimelineIRModel();
67 68
68 this._cpuThrottlingManager = new WebInspector.CPUThrottlingManager(); 69 this._cpuThrottlingManager = new WebInspector.CPUThrottlingManager();
69 70
70 /** @type {!Array.<!WebInspector.TimelineModeView>} */ 71 /** @type {!Array.<!WebInspector.TimelineModeView>} */
71 this._currentViews = []; 72 this._currentViews = [];
72 73
73 this._captureNetworkSetting = WebInspector.settings.createSetting("timelineC aptureNetwork", false); 74 this._captureNetworkSetting = WebInspector.settings.createSetting("timelineC aptureNetwork", false);
74 this._captureJSProfileSetting = WebInspector.settings.createSetting("timelin eEnableJSSampling", true); 75 this._captureJSProfileSetting = WebInspector.settings.createSetting("timelin eEnableJSSampling", true);
75 this._captureMemorySetting = WebInspector.settings.createSetting("timelineCa ptureMemory", false); 76 this._captureMemorySetting = WebInspector.settings.createSetting("timelineCa ptureMemory", false);
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 { 539 {
539 // Set up overview controls. 540 // Set up overview controls.
540 this._overviewControls = []; 541 this._overviewControls = [];
541 this._overviewControls.push(new WebInspector.TimelineEventOverview.Respo nsiveness(this._model, this._frameModel)); 542 this._overviewControls.push(new WebInspector.TimelineEventOverview.Respo nsiveness(this._model, this._frameModel));
542 if (Runtime.experiments.isEnabled("inputEventsOnTimelineOverview")) 543 if (Runtime.experiments.isEnabled("inputEventsOnTimelineOverview"))
543 this._overviewControls.push(new WebInspector.TimelineEventOverview.I nput(this._model)); 544 this._overviewControls.push(new WebInspector.TimelineEventOverview.I nput(this._model));
544 this._overviewControls.push(new WebInspector.TimelineEventOverview.Frame s(this._model, this._frameModel)); 545 this._overviewControls.push(new WebInspector.TimelineEventOverview.Frame s(this._model, this._frameModel));
545 this._overviewControls.push(new WebInspector.TimelineEventOverview.CPUAc tivity(this._model)); 546 this._overviewControls.push(new WebInspector.TimelineEventOverview.CPUAc tivity(this._model));
546 this._overviewControls.push(new WebInspector.TimelineEventOverview.Netwo rk(this._model)); 547 this._overviewControls.push(new WebInspector.TimelineEventOverview.Netwo rk(this._model));
547 if (this._captureFilmStripSetting.get()) 548 if (this._captureFilmStripSetting.get())
548 this._overviewControls.push(new WebInspector.TimelineFilmStripOvervi ew(this._model, this._tracingModel)); 549 this._overviewControls.push(new WebInspector.TimelineFilmStripOvervi ew(this._model, this._filmStripModel));
549 if (this._captureMemorySetting.get()) 550 if (this._captureMemorySetting.get())
550 this._overviewControls.push(new WebInspector.TimelineEventOverview.M emory(this._model)); 551 this._overviewControls.push(new WebInspector.TimelineEventOverview.M emory(this._model));
551 this._overviewPane.setOverviewControls(this._overviewControls); 552 this._overviewPane.setOverviewControls(this._overviewControls);
552 553
553 // Set up the main view. 554 // Set up the main view.
554 this._removeAllModeViews(); 555 this._removeAllModeViews();
555 this._flameChart = new WebInspector.TimelineFlameChartView(this, this._m odel, this._frameModel, this._irModel, this._filters); 556 this._flameChart = new WebInspector.TimelineFlameChartView(this, this._m odel, this._frameModel, this._irModel, this._filters);
556 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get()); 557 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get());
557 this._addModeView(this._flameChart); 558 this._addModeView(this._flameChart);
558 559
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 _clear: function() 677 _clear: function()
677 { 678 {
678 WebInspector.LineLevelProfile.instance().reset(); 679 WebInspector.LineLevelProfile.instance().reset();
679 this._tracingModel.reset(); 680 this._tracingModel.reset();
680 this._model.reset(); 681 this._model.reset();
681 this._showRecordingHelpMessage(); 682 this._showRecordingHelpMessage();
682 683
683 this.requestWindowTimes(0, Infinity); 684 this.requestWindowTimes(0, Infinity);
684 delete this._selection; 685 delete this._selection;
685 this._frameModel.reset(); 686 this._frameModel.reset();
687 this._filmStripModel.reset(this._tracingModel);
686 this._overviewPane.reset(); 688 this._overviewPane.reset();
687 for (var i = 0; i < this._currentViews.length; ++i) 689 for (var i = 0; i < this._currentViews.length; ++i)
688 this._currentViews[i].reset(); 690 this._currentViews[i].reset();
689 for (var i = 0; i < this._overviewControls.length; ++i) 691 for (var i = 0; i < this._overviewControls.length; ++i)
690 this._overviewControls[i].reset(); 692 this._overviewControls[i].reset();
691 this.select(null); 693 this.select(null);
692 delete this._filmStripModel;
693 this._detailsSplitWidget.hideSidebar(); 694 this._detailsSplitWidget.hideSidebar();
694 }, 695 },
695 696
696 /** 697 /**
697 * @override 698 * @override
698 */ 699 */
699 recordingStarted: function() 700 recordingStarted: function()
700 { 701 {
701 this._clear(); 702 this._clear();
702 this._setState(WebInspector.TimelinePanel.State.Recording); 703 this._setState(WebInspector.TimelinePanel.State.Recording);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 delete this._statusPane; 797 delete this._statusPane;
797 this._clear(); 798 this._clear();
798 return; 799 return;
799 } 800 }
800 801
801 if (this._statusPane) 802 if (this._statusPane)
802 this._statusPane.updateStatus(WebInspector.UIString("Processing time line\u2026")); 803 this._statusPane.updateStatus(WebInspector.UIString("Processing time line\u2026"));
803 this._model.setEvents(this._tracingModel, loadedFromFile); 804 this._model.setEvents(this._tracingModel, loadedFromFile);
804 this._frameModel.reset(); 805 this._frameModel.reset();
805 this._frameModel.addTraceEvents(WebInspector.targetManager.mainTarget(), this._model.inspectedTargetEvents(), this._model.sessionId() || ""); 806 this._frameModel.addTraceEvents(WebInspector.targetManager.mainTarget(), this._model.inspectedTargetEvents(), this._model.sessionId() || "");
806 807 this._filmStripModel.reset(this._tracingModel);
807 var groups = WebInspector.TimelineModel.AsyncEventGroup; 808 var groups = WebInspector.TimelineModel.AsyncEventGroup;
808 var asyncEventsByGroup = this._model.mainThreadAsyncEvents(); 809 var asyncEventsByGroup = this._model.mainThreadAsyncEvents();
809 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEvents ByGroup.get(groups.animation)); 810 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEvents ByGroup.get(groups.animation));
810 this._model.cpuProfiles().forEach(profile => WebInspector.LineLevelProfi le.instance().appendCPUProfile(profile)); 811 this._model.cpuProfiles().forEach(profile => WebInspector.LineLevelProfi le.instance().appendCPUProfile(profile));
811 if (this._statusPane) 812 if (this._statusPane)
812 this._statusPane.hide(); 813 this._statusPane.hide();
813 delete this._statusPane; 814 delete this._statusPane;
814 this._overviewPane.reset(); 815 this._overviewPane.reset();
815 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._mode l.maximumRecordTime()); 816 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._mode l.maximumRecordTime());
816 this._setAutoWindowTimes(); 817 this._setAutoWindowTimes();
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 1029
1029 _updateSelectionDetails: function() 1030 _updateSelectionDetails: function()
1030 { 1031 {
1031 switch (this._selection.type()) { 1032 switch (this._selection.type()) {
1032 case WebInspector.TimelineSelection.Type.TraceEvent: 1033 case WebInspector.TimelineSelection.Type.TraceEvent:
1033 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._s election.object()); 1034 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._s election.object());
1034 WebInspector.TimelineUIUtils.buildTraceEventDetails(event, this._mod el, this._detailsLinkifier, true, this._appendDetailsTabsForTraceEventAndShowDet ails.bind(this, event)); 1035 WebInspector.TimelineUIUtils.buildTraceEventDetails(event, this._mod el, this._detailsLinkifier, true, this._appendDetailsTabsForTraceEventAndShowDet ails.bind(this, event));
1035 break; 1036 break;
1036 case WebInspector.TimelineSelection.Type.Frame: 1037 case WebInspector.TimelineSelection.Type.Frame:
1037 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._select ion.object()); 1038 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._select ion.object());
1038 if (!this._filmStripModel) 1039 var filmStripFrame = null;
1039 this._filmStripModel = new WebInspector.FilmStripModel(this._tra cingModel);
1040 var screenshotTime = frame.idle ? frame.startTime : frame.endTime; / / For idle frames, look at the state at the beginning of the frame. 1040 var screenshotTime = frame.idle ? frame.startTime : frame.endTime; / / For idle frames, look at the state at the beginning of the frame.
1041 var filmStripFrame = this._filmStripModel && this._filmStripModel.fr ameByTimestamp(screenshotTime); 1041 filmStripFrame = this._filmStripModel.frameByTimestamp(screenshotTim e);
alph 2016/09/08 00:03:07 var ...
1042 if (filmStripFrame && filmStripFrame.timestamp - frame.endTime > 10) 1042 if (filmStripFrame && filmStripFrame.timestamp - frame.endTime > 10)
1043 filmStripFrame = null; 1043 filmStripFrame = null;
1044 this.showInDetails(WebInspector.TimelineUIUtils.generateDetailsConte ntForFrame(this._frameModel, frame, filmStripFrame)); 1044 this.showInDetails(WebInspector.TimelineUIUtils.generateDetailsConte ntForFrame(this._frameModel, frame, filmStripFrame));
1045 if (frame.layerTree) { 1045 if (frame.layerTree) {
1046 var layersView = this._layersView(); 1046 var layersView = this._layersView();
1047 layersView.showLayerTree(frame.layerTree, frame.paints); 1047 layersView.showLayerTree(frame.layerTree, frame.paints);
1048 if (!this._detailsView.hasTab(WebInspector.TimelinePanel.Details Tab.LayerViewer)) 1048 if (!this._detailsView.hasTab(WebInspector.TimelinePanel.Details Tab.LayerViewer))
1049 this._detailsView.appendTab(WebInspector.TimelinePanel.Detai lsTab.LayerViewer, WebInspector.UIString("Layers"), layersView); 1049 this._detailsView.appendTab(WebInspector.TimelinePanel.Detai lsTab.LayerViewer, WebInspector.UIString("Layers"), layersView);
1050 } 1050 }
1051 break; 1051 break;
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 _onKeyDown: function(event) 2117 _onKeyDown: function(event)
2118 { 2118 {
2119 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code) { 2119 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code) {
2120 event.preventDefault(); 2120 event.preventDefault();
2121 this._apply(); 2121 this._apply();
2122 } 2122 }
2123 }, 2123 },
2124 2124
2125 __proto__: WebInspector.HBox.prototype 2125 __proto__: WebInspector.HBox.prototype
2126 } 2126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698