OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 importScript("TracingModel.js"); | 54 importScript("TracingModel.js"); |
55 importScript("TracingTimelineUIUtils.js"); | 55 importScript("TracingTimelineUIUtils.js"); |
56 importScript("TransformController.js"); | 56 importScript("TransformController.js"); |
57 importScript("PaintProfilerView.js"); | 57 importScript("PaintProfilerView.js"); |
58 | 58 |
59 /** | 59 /** |
60 * @constructor | 60 * @constructor |
61 * @extends {WebInspector.Panel} | 61 * @extends {WebInspector.Panel} |
62 * @implements {WebInspector.TimelineModeViewDelegate} | 62 * @implements {WebInspector.TimelineModeViewDelegate} |
63 * @implements {WebInspector.Searchable} | 63 * @implements {WebInspector.Searchable} |
| 64 * @implements {WebInspector.TargetManager.Observer} |
64 */ | 65 */ |
65 WebInspector.TimelinePanel = function() | 66 WebInspector.TimelinePanel = function() |
66 { | 67 { |
67 WebInspector.Panel.call(this, "timeline"); | 68 WebInspector.Panel.call(this, "timeline"); |
68 this.registerRequiredCSS("timelinePanel.css"); | 69 this.registerRequiredCSS("timelinePanel.css"); |
69 this.registerRequiredCSS("layersPanel.css"); | 70 this.registerRequiredCSS("layersPanel.css"); |
70 this.registerRequiredCSS("filter.css"); | 71 this.registerRequiredCSS("filter.css"); |
71 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f
alse); | 72 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f
alse); |
72 | 73 |
73 this._detailsLinkifier = new WebInspector.Linkifier(); | 74 this._detailsLinkifier = new WebInspector.Linkifier(); |
(...skipping 14 matching lines...) Expand all Loading... |
88 this._model = new WebInspector.TimelineModelImpl(WebInspector.timelineMa
nager); | 89 this._model = new WebInspector.TimelineModelImpl(WebInspector.timelineMa
nager); |
89 } | 90 } |
90 | 91 |
91 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar
ted, this._onRecordingStarted, this); | 92 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar
ted, this._onRecordingStarted, this); |
92 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStop
ped, this._onRecordingStopped, this); | 93 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStop
ped, this._onRecordingStopped, this); |
93 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare
d, this._onRecordsCleared, this); | 94 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare
d, this._onRecordsCleared, this); |
94 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingProg
ress, this._onRecordingProgress, this); | 95 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingProg
ress, this._onRecordingProgress, this); |
95 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordFilterC
hanged, this._refreshViews, this); | 96 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordFilterC
hanged, this._refreshViews, this); |
96 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded,
this._onRecordAdded, this); | 97 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded,
this._onRecordAdded, this); |
97 | 98 |
98 this._model.target().profilingLock.addEventListener(WebInspector.Lock.Events
.StateChanged, this._onProfilingStateChanged, this); | |
99 | |
100 this._categoryFilter = new WebInspector.TimelineCategoryFilter(this._uiUtils
); | 99 this._categoryFilter = new WebInspector.TimelineCategoryFilter(this._uiUtils
); |
101 this._durationFilter = new WebInspector.TimelineIsLongFilter(); | 100 this._durationFilter = new WebInspector.TimelineIsLongFilter(); |
102 this._textFilter = new WebInspector.TimelineTextFilter(this._uiUtils); | 101 this._textFilter = new WebInspector.TimelineTextFilter(this._uiUtils); |
103 | 102 |
104 var hiddenEmptyRecordsFilter = this._uiUtils.hiddenEmptyRecordsFilter(); | 103 var hiddenEmptyRecordsFilter = this._uiUtils.hiddenEmptyRecordsFilter(); |
105 if (hiddenEmptyRecordsFilter) | 104 if (hiddenEmptyRecordsFilter) |
106 this._model.addFilter(hiddenEmptyRecordsFilter); | 105 this._model.addFilter(hiddenEmptyRecordsFilter); |
107 this._model.addFilter(this._uiUtils.hiddenRecordsFilter()); | 106 this._model.addFilter(this._uiUtils.hiddenRecordsFilter()); |
108 this._model.addFilter(this._categoryFilter); | 107 this._model.addFilter(this._categoryFilter); |
109 this._model.addFilter(this._durationFilter); | 108 this._model.addFilter(this._durationFilter); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 }; | 164 }; |
166 | 165 |
167 // Define row and header height, should be in sync with styles for timeline grap
hs. | 166 // Define row and header height, should be in sync with styles for timeline grap
hs. |
168 WebInspector.TimelinePanel.rowHeight = 18; | 167 WebInspector.TimelinePanel.rowHeight = 18; |
169 WebInspector.TimelinePanel.headerHeight = 20; | 168 WebInspector.TimelinePanel.headerHeight = 20; |
170 | 169 |
171 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; | 170 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; |
172 | 171 |
173 WebInspector.TimelinePanel.prototype = { | 172 WebInspector.TimelinePanel.prototype = { |
174 /** | 173 /** |
| 174 * @param {!WebInspector.Target} target |
| 175 */ |
| 176 targetAdded: function(target) |
| 177 { |
| 178 target.profilingLock.addEventListener(WebInspector.Lock.Events.StateChan
ged, this._onProfilingStateChanged, this); |
| 179 }, |
| 180 |
| 181 /** |
| 182 * @param {!WebInspector.Target} target |
| 183 */ |
| 184 targetRemoved: function(target) |
| 185 { |
| 186 target.profilingLock.removeEventListener(WebInspector.Lock.Events.StateC
hanged, this._onProfilingStateChanged, this); |
| 187 }, |
| 188 |
| 189 /** |
175 * @return {?WebInspector.SearchableView} | 190 * @return {?WebInspector.SearchableView} |
176 */ | 191 */ |
177 searchableView: function() | 192 searchableView: function() |
178 { | 193 { |
179 return this._searchableView; | 194 return this._searchableView; |
180 }, | 195 }, |
181 | 196 |
182 wasShown: function() | 197 wasShown: function() |
183 { | 198 { |
184 if (!WebInspector.TimelinePanel._categoryStylesInitialized) { | 199 if (!WebInspector.TimelinePanel._categoryStylesInitialized) { |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 _onProfilingStateChanged: function() | 746 _onProfilingStateChanged: function() |
732 { | 747 { |
733 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); | 748 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); |
734 }, | 749 }, |
735 | 750 |
736 /** | 751 /** |
737 * @param {boolean} toggled | 752 * @param {boolean} toggled |
738 */ | 753 */ |
739 _updateToggleTimelineButton: function(toggled) | 754 _updateToggleTimelineButton: function(toggled) |
740 { | 755 { |
| 756 var isAcquiredInSomeTarget = WebInspector.targetManager.targets().some(f
unction(target) { return target.profilingLock.isAcquired(); }); |
741 this.toggleTimelineButton.toggled = toggled; | 757 this.toggleTimelineButton.toggled = toggled; |
742 if (toggled) { | 758 if (toggled) { |
743 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); | 759 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); |
744 this.toggleTimelineButton.setEnabled(true); | 760 this.toggleTimelineButton.setEnabled(true); |
745 } else if (this._stopPending) { | 761 } else if (this._stopPending) { |
746 this.toggleTimelineButton.title = WebInspector.UIString("Stop pendin
g"); | 762 this.toggleTimelineButton.title = WebInspector.UIString("Stop pendin
g"); |
747 this.toggleTimelineButton.setEnabled(false); | 763 this.toggleTimelineButton.setEnabled(false); |
748 } else if (this._model.target().profilingLock.isAcquired()) { | 764 } else if (isAcquiredInSomeTarget) { |
749 this.toggleTimelineButton.title = WebInspector.anotherProfilerActive
Label(); | 765 this.toggleTimelineButton.title = WebInspector.anotherProfilerActive
Label(); |
750 this.toggleTimelineButton.setEnabled(false); | 766 this.toggleTimelineButton.setEnabled(false); |
751 } else { | 767 } else { |
752 this.toggleTimelineButton.title = WebInspector.UIString("Record"); | 768 this.toggleTimelineButton.title = WebInspector.UIString("Record"); |
753 this.toggleTimelineButton.setEnabled(true); | 769 this.toggleTimelineButton.setEnabled(true); |
754 } | 770 } |
755 }, | 771 }, |
756 | 772 |
757 /** | 773 /** |
758 * @return {boolean} | 774 * @return {boolean} |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 if (this._tracingTimelineModel) { | 1049 if (this._tracingTimelineModel) { |
1034 var event = record.traceEvent(); | 1050 var event = record.traceEvent(); |
1035 this._uiUtils.generateDetailsContent(record, this._model, this._
detailsLinkifier, this._appendDetailsTabsForTraceEventAndShowDetails.bind(this,
event), this._model.loadedFromFile()); | 1051 this._uiUtils.generateDetailsContent(record, this._model, this._
detailsLinkifier, this._appendDetailsTabsForTraceEventAndShowDetails.bind(this,
event), this._model.loadedFromFile()); |
1036 break; | 1052 break; |
1037 } | 1053 } |
1038 var title = this._uiUtils.titleForRecord(record); | 1054 var title = this._uiUtils.titleForRecord(record); |
1039 this._uiUtils.generateDetailsContent(record, this._model, this._deta
ilsLinkifier, this.showInDetails.bind(this, title), this._model.loadedFromFile()
); | 1055 this._uiUtils.generateDetailsContent(record, this._model, this._deta
ilsLinkifier, this.showInDetails.bind(this, title), this._model.loadedFromFile()
); |
1040 break; | 1056 break; |
1041 case WebInspector.TimelineSelection.Type.TraceEvent: | 1057 case WebInspector.TimelineSelection.Type.TraceEvent: |
1042 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._s
election.object()); | 1058 var event = /** @type {!WebInspector.TracingModel.Event} */ (this._s
election.object()); |
1043 WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(event, th
is._tracingTimelineModel, this._detailsLinkifier, this._appendDetailsTabsForTrac
eEventAndShowDetails.bind(this, event), false, this._model.target()); | 1059 WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(event, th
is._tracingTimelineModel, this._detailsLinkifier, this._appendDetailsTabsForTrac
eEventAndShowDetails.bind(this, event), false); |
1044 break; | 1060 break; |
1045 case WebInspector.TimelineSelection.Type.Frame: | 1061 case WebInspector.TimelineSelection.Type.Frame: |
1046 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._select
ion.object()); | 1062 var frame = /** @type {!WebInspector.TimelineFrame} */ (this._select
ion.object()); |
1047 this.showInDetails(WebInspector.UIString("Frame Statistics"), WebIns
pector.TimelineUIUtils.generateDetailsContentForFrame(this._lazyFrameModel, fram
e)); | 1063 this.showInDetails(WebInspector.UIString("Frame Statistics"), WebIns
pector.TimelineUIUtils.generateDetailsContentForFrame(this._lazyFrameModel, fram
e)); |
1048 if (frame.layerTree) { | 1064 if (frame.layerTree) { |
1049 var layersView = this._layersView(); | 1065 var layersView = this._layersView(); |
1050 layersView.showLayerTree(frame.layerTree, frame.paints); | 1066 layersView.showLayerTree(frame.layerTree, frame.paints); |
1051 this._detailsView.appendTab("layers", WebInspector.UIString("Lay
ers"), layersView); | 1067 this._detailsView.appendTab("layers", WebInspector.UIString("Lay
ers"), layersView); |
1052 } | 1068 } |
1053 break; | 1069 break; |
1054 } | 1070 } |
1055 }, | 1071 }, |
1056 | 1072 |
1057 /** | 1073 /** |
1058 * @param {!WebInspector.TracingModel.Event} event | 1074 * @param {!WebInspector.TracingModel.Event} event |
1059 * @param {!Node} content | 1075 * @param {!Node} content |
1060 */ | 1076 */ |
1061 _appendDetailsTabsForTraceEventAndShowDetails: function(event, content) | 1077 _appendDetailsTabsForTraceEventAndShowDetails: function(event, content) |
1062 { | 1078 { |
1063 var title = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event
.name).title; | 1079 var title = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event
.name).title; |
1064 this.showInDetails(title, content); | 1080 this.showInDetails(title, content); |
1065 if (event.picture) { | 1081 if (event.picture) { |
1066 var paintProfilerView = this._paintProfilerView(); | 1082 var paintProfilerView = this._paintProfilerView(); |
1067 paintProfilerView.setPicture(this._model.target().weakReference(), e
vent.picture); | 1083 paintProfilerView.setPicture(event.thread.target(), event.picture); |
1068 this._detailsView.appendTab("paintProfiler", WebInspector.UIString("
Paint Profiler"), paintProfilerView); | 1084 this._detailsView.appendTab("paintProfiler", WebInspector.UIString("
Paint Profiler"), paintProfilerView); |
1069 } | 1085 } |
1070 }, | 1086 }, |
1071 | 1087 |
1072 _updateSelectedRangeStats: function() | 1088 _updateSelectedRangeStats: function() |
1073 { | 1089 { |
1074 if (this._selection) | 1090 if (this._selection) |
1075 return; | 1091 return; |
1076 | 1092 |
1077 var startTime = this._windowStartTime; | 1093 var startTime = this._windowStartTime; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 * @param {!WebInspector.TimelineModel.Record} record | 1493 * @param {!WebInspector.TimelineModel.Record} record |
1478 * @return {boolean} | 1494 * @return {boolean} |
1479 */ | 1495 */ |
1480 accept: function(record) | 1496 accept: function(record) |
1481 { | 1497 { |
1482 return !this._regex || this._uiUtils.testContentMatching(record, this._r
egex); | 1498 return !this._regex || this._uiUtils.testContentMatching(record, this._r
egex); |
1483 }, | 1499 }, |
1484 | 1500 |
1485 __proto__: WebInspector.TimelineModel.Filter.prototype | 1501 __proto__: WebInspector.TimelineModel.Filter.prototype |
1486 } | 1502 } |
OLD | NEW |