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

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

Issue 397313003: DevTools: Remove target function from TimelineModel (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase once more Created 6 years, 5 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
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 importScript("TracingModel.js"); 53 importScript("TracingModel.js");
54 importScript("TracingTimelineUIUtils.js"); 54 importScript("TracingTimelineUIUtils.js");
55 importScript("TransformController.js"); 55 importScript("TransformController.js");
56 importScript("PaintProfilerView.js"); 56 importScript("PaintProfilerView.js");
57 57
58 /** 58 /**
59 * @constructor 59 * @constructor
60 * @extends {WebInspector.Panel} 60 * @extends {WebInspector.Panel}
61 * @implements {WebInspector.TimelineModeViewDelegate} 61 * @implements {WebInspector.TimelineModeViewDelegate}
62 * @implements {WebInspector.Searchable} 62 * @implements {WebInspector.Searchable}
63 * @implements {WebInspector.TargetManager.Observer}
63 */ 64 */
64 WebInspector.TimelinePanel = function() 65 WebInspector.TimelinePanel = function()
65 { 66 {
66 WebInspector.Panel.call(this, "timeline"); 67 WebInspector.Panel.call(this, "timeline");
67 this.registerRequiredCSS("timelinePanel.css"); 68 this.registerRequiredCSS("timelinePanel.css");
68 this.registerRequiredCSS("layersPanel.css"); 69 this.registerRequiredCSS("layersPanel.css");
69 this.registerRequiredCSS("filter.css"); 70 this.registerRequiredCSS("filter.css");
70 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse); 71 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse);
71 72
72 this._detailsLinkifier = new WebInspector.Linkifier(); 73 this._detailsLinkifier = new WebInspector.Linkifier();
(...skipping 13 matching lines...) Expand all
86 this._model = new WebInspector.TimelineModelImpl(WebInspector.timelineMa nager); 87 this._model = new WebInspector.TimelineModelImpl(WebInspector.timelineMa nager);
87 } 88 }
88 89
89 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar ted, this._onRecordingStarted, this); 90 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar ted, this._onRecordingStarted, this);
90 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStop ped, this._onRecordingStopped, this); 91 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStop ped, this._onRecordingStopped, this);
91 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare d, this._onRecordsCleared, this); 92 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare d, this._onRecordsCleared, this);
92 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingProg ress, this._onRecordingProgress, this); 93 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingProg ress, this._onRecordingProgress, this);
93 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordFilterC hanged, this._refreshViews, this); 94 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordFilterC hanged, this._refreshViews, this);
94 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded, this._onRecordAdded, this); 95 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded, this._onRecordAdded, this);
95 96
96 this._model.target().profilingLock.addEventListener(WebInspector.Lock.Events .StateChanged, this._onProfilingStateChanged, this);
97
98 this._categoryFilter = new WebInspector.TimelineCategoryFilter(this._uiUtils ); 97 this._categoryFilter = new WebInspector.TimelineCategoryFilter(this._uiUtils );
99 this._durationFilter = new WebInspector.TimelineIsLongFilter(); 98 this._durationFilter = new WebInspector.TimelineIsLongFilter();
100 this._textFilter = new WebInspector.TimelineTextFilter(this._uiUtils); 99 this._textFilter = new WebInspector.TimelineTextFilter(this._uiUtils);
101 100
102 var hiddenEmptyRecordsFilter = this._uiUtils.hiddenEmptyRecordsFilter(); 101 var hiddenEmptyRecordsFilter = this._uiUtils.hiddenEmptyRecordsFilter();
103 if (hiddenEmptyRecordsFilter) 102 if (hiddenEmptyRecordsFilter)
104 this._model.addFilter(hiddenEmptyRecordsFilter); 103 this._model.addFilter(hiddenEmptyRecordsFilter);
105 this._model.addFilter(this._uiUtils.hiddenRecordsFilter()); 104 this._model.addFilter(this._uiUtils.hiddenRecordsFilter());
106 this._model.addFilter(this._categoryFilter); 105 this._model.addFilter(this._categoryFilter);
107 this._model.addFilter(this._durationFilter); 106 this._model.addFilter(this._durationFilter);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 }; 162 };
164 163
165 // Define row and header height, should be in sync with styles for timeline grap hs. 164 // Define row and header height, should be in sync with styles for timeline grap hs.
166 WebInspector.TimelinePanel.rowHeight = 18; 165 WebInspector.TimelinePanel.rowHeight = 18;
167 WebInspector.TimelinePanel.headerHeight = 20; 166 WebInspector.TimelinePanel.headerHeight = 20;
168 167
169 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; 168 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15];
170 169
171 WebInspector.TimelinePanel.prototype = { 170 WebInspector.TimelinePanel.prototype = {
172 /** 171 /**
172 * @param {!WebInspector.Target} target
173 */
174 targetAdded: function(target)
175 {
176 target.profilingLock.addEventListener(WebInspector.Lock.Events.StateChan ged, this._onProfilingStateChanged, this);
177 },
178
179 /**
180 * @param {!WebInspector.Target} target
181 */
182 targetRemoved: function(target)
183 {
184 target.profilingLock.removeEventListener(WebInspector.Lock.Events.StateC hanged, this._onProfilingStateChanged, this);
185 },
186
187 /**
173 * @return {?WebInspector.SearchableView} 188 * @return {?WebInspector.SearchableView}
174 */ 189 */
175 searchableView: function() 190 searchableView: function()
176 { 191 {
177 return this._searchableView; 192 return this._searchableView;
178 }, 193 },
179 194
180 wasShown: function() 195 wasShown: function()
181 { 196 {
182 if (!WebInspector.TimelinePanel._categoryStylesInitialized) { 197 if (!WebInspector.TimelinePanel._categoryStylesInitialized) {
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 _onProfilingStateChanged: function() 733 _onProfilingStateChanged: function()
719 { 734 {
720 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); 735 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled);
721 }, 736 },
722 737
723 /** 738 /**
724 * @param {boolean} toggled 739 * @param {boolean} toggled
725 */ 740 */
726 _updateToggleTimelineButton: function(toggled) 741 _updateToggleTimelineButton: function(toggled)
727 { 742 {
743 var isAcquiredInSomeTarget = WebInspector.targetManager.targets().some(f unction(target) { return target.profilingLock.isAcquired(); });
728 this.toggleTimelineButton.toggled = toggled; 744 this.toggleTimelineButton.toggled = toggled;
729 if (toggled) { 745 if (toggled) {
730 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); 746 this.toggleTimelineButton.title = WebInspector.UIString("Stop");
731 this.toggleTimelineButton.setEnabled(true); 747 this.toggleTimelineButton.setEnabled(true);
732 } else if (this._stopPending) { 748 } else if (this._stopPending) {
733 this.toggleTimelineButton.title = WebInspector.UIString("Stop pendin g"); 749 this.toggleTimelineButton.title = WebInspector.UIString("Stop pendin g");
734 this.toggleTimelineButton.setEnabled(false); 750 this.toggleTimelineButton.setEnabled(false);
735 } else if (this._model.target().profilingLock.isAcquired()) { 751 } else if (isAcquiredInSomeTarget) {
736 this.toggleTimelineButton.title = WebInspector.anotherProfilerActive Label(); 752 this.toggleTimelineButton.title = WebInspector.anotherProfilerActive Label();
737 this.toggleTimelineButton.setEnabled(false); 753 this.toggleTimelineButton.setEnabled(false);
738 } else { 754 } else {
739 this.toggleTimelineButton.title = WebInspector.UIString("Record"); 755 this.toggleTimelineButton.title = WebInspector.UIString("Record");
740 this.toggleTimelineButton.setEnabled(true); 756 this.toggleTimelineButton.setEnabled(true);
741 } 757 }
742 }, 758 },
743 759
744 /** 760 /**
745 * @return {boolean} 761 * @return {boolean}
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 if (this._tracingTimelineModel) { 1036 if (this._tracingTimelineModel) {
1021 var event = record.traceEvent(); 1037 var event = record.traceEvent();
1022 this._uiUtils.generateDetailsContent(record, this._model, this._ detailsLinkifier, this._appendDetailsTabsForTraceEventAndShowDetails.bind(this, event), this._model.loadedFromFile()); 1038 this._uiUtils.generateDetailsContent(record, this._model, this._ detailsLinkifier, this._appendDetailsTabsForTraceEventAndShowDetails.bind(this, event), this._model.loadedFromFile());
1023 break; 1039 break;
1024 } 1040 }
1025 var title = this._uiUtils.titleForRecord(record); 1041 var title = this._uiUtils.titleForRecord(record);
1026 this._uiUtils.generateDetailsContent(record, this._model, this._deta ilsLinkifier, this.showInDetails.bind(this, title), this._model.loadedFromFile() ); 1042 this._uiUtils.generateDetailsContent(record, this._model, this._deta ilsLinkifier, this.showInDetails.bind(this, title), this._model.loadedFromFile() );
1027 break; 1043 break;
1028 case WebInspector.TimelineSelection.Type.TraceEvent: 1044 case WebInspector.TimelineSelection.Type.TraceEvent:
1029 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._s election.object()); 1045 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._s election.object());
1030 WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(event, th is._tracingTimelineModel, this._detailsLinkifier, this._appendDetailsTabsForTrac eEventAndShowDetails.bind(this, event), false, this._model.target()); 1046 WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(event, th is._tracingTimelineModel, this._detailsLinkifier, this._appendDetailsTabsForTrac eEventAndShowDetails.bind(this, event), false);
1031 break; 1047 break;
1032 case WebInspector.TimelineSelection.Type.Frame: 1048 case WebInspector.TimelineSelection.Type.Frame:
1033 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._select ion.object()); 1049 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._select ion.object());
1034 this.showInDetails(WebInspector.UIString("Frame Statistics"), WebIns pector.TimelineUIUtils.generateDetailsContentForFrame(this._lazyFrameModel, fram e)); 1050 this.showInDetails(WebInspector.UIString("Frame Statistics"), WebIns pector.TimelineUIUtils.generateDetailsContentForFrame(this._lazyFrameModel, fram e));
1035 if (frame.layerTree) { 1051 if (frame.layerTree) {
1036 var layersView = this._layersView(); 1052 var layersView = this._layersView();
1037 layersView.showLayerTree(frame.layerTree, frame.paints); 1053 layersView.showLayerTree(frame.layerTree, frame.paints);
1038 this._detailsView.appendTab("layers", WebInspector.UIString("Lay ers"), layersView); 1054 this._detailsView.appendTab("layers", WebInspector.UIString("Lay ers"), layersView);
1039 } 1055 }
1040 break; 1056 break;
1041 } 1057 }
1042 }, 1058 },
1043 1059
1044 /** 1060 /**
1045 * @param {!WebInspector.TracingModel.Event} event 1061 * @param {!WebInspector.TracingModel.Event} event
1046 * @param {!Node} content 1062 * @param {!Node} content
1047 */ 1063 */
1048 _appendDetailsTabsForTraceEventAndShowDetails: function(event, content) 1064 _appendDetailsTabsForTraceEventAndShowDetails: function(event, content)
1049 { 1065 {
1050 var title = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event .name).title; 1066 var title = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event .name).title;
1051 this.showInDetails(title, content); 1067 this.showInDetails(title, content);
1052 if (event.picture) { 1068 if (event.picture) {
1053 var paintProfilerView = this._paintProfilerView(); 1069 var paintProfilerView = this._paintProfilerView();
1054 paintProfilerView.setPicture(this._model.target().weakReference(), e vent.picture); 1070 paintProfilerView.setPicture(event.thread.target(), event.picture);
1055 this._detailsView.appendTab("paintProfiler", WebInspector.UIString(" Paint Profiler"), paintProfilerView); 1071 this._detailsView.appendTab("paintProfiler", WebInspector.UIString(" Paint Profiler"), paintProfilerView);
1056 } 1072 }
1057 }, 1073 },
1058 1074
1059 _updateSelectedRangeStats: function() 1075 _updateSelectedRangeStats: function()
1060 { 1076 {
1061 if (this._selection) 1077 if (this._selection)
1062 return; 1078 return;
1063 1079
1064 var startTime = this._windowStartTime; 1080 var startTime = this._windowStartTime;
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 * @param {!WebInspector.TimelineModel.Record} record 1480 * @param {!WebInspector.TimelineModel.Record} record
1465 * @return {boolean} 1481 * @return {boolean}
1466 */ 1482 */
1467 accept: function(record) 1483 accept: function(record)
1468 { 1484 {
1469 return !this._regex || this._uiUtils.testContentMatching(record, this._r egex); 1485 return !this._regex || this._uiUtils.testContentMatching(record, this._r egex);
1470 }, 1486 },
1471 1487
1472 __proto__: WebInspector.TimelineModel.Filter.prototype 1488 __proto__: WebInspector.TimelineModel.Filter.prototype
1473 } 1489 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698