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 26 matching lines...) Expand all Loading... |
37 importScript("TimelinePresentationModel.js"); | 37 importScript("TimelinePresentationModel.js"); |
38 importScript("TimelineFrameModel.js"); | 38 importScript("TimelineFrameModel.js"); |
39 importScript("TimelineEventOverview.js"); | 39 importScript("TimelineEventOverview.js"); |
40 importScript("TimelineFrameOverview.js"); | 40 importScript("TimelineFrameOverview.js"); |
41 importScript("TimelineMemoryOverview.js"); | 41 importScript("TimelineMemoryOverview.js"); |
42 importScript("TimelinePowerGraph.js"); | 42 importScript("TimelinePowerGraph.js"); |
43 importScript("TimelinePowerOverview.js"); | 43 importScript("TimelinePowerOverview.js"); |
44 importScript("TimelineFlameChart.js"); | 44 importScript("TimelineFlameChart.js"); |
45 importScript("TimelineUIUtils.js"); | 45 importScript("TimelineUIUtils.js"); |
46 importScript("TimelineView.js"); | 46 importScript("TimelineView.js"); |
| 47 importScript("TimelineTracingView.js"); |
47 | 48 |
48 /** | 49 /** |
49 * @constructor | 50 * @constructor |
50 * @extends {WebInspector.Panel} | 51 * @extends {WebInspector.Panel} |
51 * @implements {WebInspector.TimelineModeViewDelegate} | 52 * @implements {WebInspector.TimelineModeViewDelegate} |
52 * @implements {WebInspector.Searchable} | 53 * @implements {WebInspector.Searchable} |
53 */ | 54 */ |
54 WebInspector.TimelinePanel = function() | 55 WebInspector.TimelinePanel = function() |
55 { | 56 { |
56 WebInspector.Panel.call(this, "timeline"); | 57 WebInspector.Panel.call(this, "timeline"); |
(...skipping 25 matching lines...) Expand all Loading... |
82 | 83 |
83 this._presentationModes = [ | 84 this._presentationModes = [ |
84 WebInspector.TimelinePanel.Mode.Events, | 85 WebInspector.TimelinePanel.Mode.Events, |
85 WebInspector.TimelinePanel.Mode.Frames, | 86 WebInspector.TimelinePanel.Mode.Frames, |
86 WebInspector.TimelinePanel.Mode.Memory | 87 WebInspector.TimelinePanel.Mode.Memory |
87 ]; | 88 ]; |
88 if (WebInspector.experimentsSettings.timelineFlameChart.isEnabled()) | 89 if (WebInspector.experimentsSettings.timelineFlameChart.isEnabled()) |
89 this._presentationModes.push(WebInspector.TimelinePanel.Mode.FlameChart)
; | 90 this._presentationModes.push(WebInspector.TimelinePanel.Mode.FlameChart)
; |
90 if (Capabilities.canProfilePower) | 91 if (Capabilities.canProfilePower) |
91 this._presentationModes.push(WebInspector.TimelinePanel.Mode.Power); | 92 this._presentationModes.push(WebInspector.TimelinePanel.Mode.Power); |
| 93 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) |
| 94 this._presentationModes.push(WebInspector.TimelinePanel.Mode.Tracing); |
92 | 95 |
93 this._presentationModeSetting = WebInspector.settings.createSetting("timelin
eOverviewMode", WebInspector.TimelinePanel.Mode.Events); | 96 this._presentationModeSetting = WebInspector.settings.createSetting("timelin
eOverviewMode", WebInspector.TimelinePanel.Mode.Events); |
94 | 97 |
95 this._createStatusBarItems(); | 98 this._createStatusBarItems(); |
96 | 99 |
97 this._topPane = new WebInspector.SplitView(true, false); | 100 this._topPane = new WebInspector.SplitView(true, false); |
98 this._topPane.element.id = "timeline-overview-panel"; | 101 this._topPane.element.id = "timeline-overview-panel"; |
99 this._topPane.show(this.element); | 102 this._topPane.show(this.element); |
100 this._topPane.addEventListener(WebInspector.SplitView.Events.SidebarSizeChan
ged, this._sidebarResized, this); | 103 this._topPane.addEventListener(WebInspector.SplitView.Events.SidebarSizeChan
ged, this._sidebarResized, this); |
101 this._topPane.setResizable(false); | 104 this._topPane.setResizable(false); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 138 |
136 this._selectPresentationMode(this._presentationModeSetting.get()); | 139 this._selectPresentationMode(this._presentationModeSetting.get()); |
137 this._detailsSplitView.show(this.element); | 140 this._detailsSplitView.show(this.element); |
138 } | 141 } |
139 | 142 |
140 WebInspector.TimelinePanel.Mode = { | 143 WebInspector.TimelinePanel.Mode = { |
141 Events: "Events", | 144 Events: "Events", |
142 Frames: "Frames", | 145 Frames: "Frames", |
143 Memory: "Memory", | 146 Memory: "Memory", |
144 FlameChart: "FlameChart", | 147 FlameChart: "FlameChart", |
145 Power: "Power" | 148 Power: "Power", |
| 149 Tracing: "Tracing" |
146 }; | 150 }; |
147 | 151 |
148 // Define row and header height, should be in sync with styles for timeline grap
hs. | 152 // Define row and header height, should be in sync with styles for timeline grap
hs. |
149 WebInspector.TimelinePanel.rowHeight = 18; | 153 WebInspector.TimelinePanel.rowHeight = 18; |
150 WebInspector.TimelinePanel.headerHeight = 20; | 154 WebInspector.TimelinePanel.headerHeight = 20; |
151 | 155 |
152 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; | 156 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; |
153 | 157 |
154 WebInspector.TimelinePanel.prototype = { | 158 WebInspector.TimelinePanel.prototype = { |
155 wasShown: function() | 159 wasShown: function() |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 * @return {!WebInspector.TimelineFrameModel} | 240 * @return {!WebInspector.TimelineFrameModel} |
237 */ | 241 */ |
238 _frameModel: function() | 242 _frameModel: function() |
239 { | 243 { |
240 if (!this._lazyFrameModel) | 244 if (!this._lazyFrameModel) |
241 this._lazyFrameModel = new WebInspector.TimelineFrameModel(this._mod
el); | 245 this._lazyFrameModel = new WebInspector.TimelineFrameModel(this._mod
el); |
242 return this._lazyFrameModel; | 246 return this._lazyFrameModel; |
243 }, | 247 }, |
244 | 248 |
245 /** | 249 /** |
| 250 * @return {!WebInspector.TimelineTracingView} |
| 251 */ |
| 252 _tracingView: function() |
| 253 { |
| 254 if (!this._lazyTracingView) |
| 255 this._lazyTracingView = new WebInspector.TimelineTracingView(this); |
| 256 return this._lazyTracingView; |
| 257 }, |
| 258 |
| 259 /** |
246 * @return {!WebInspector.TimelineView} | 260 * @return {!WebInspector.TimelineView} |
247 */ | 261 */ |
248 _timelineView: function() | 262 _timelineView: function() |
249 { | 263 { |
250 if (!this._lazyTimelineView) | 264 if (!this._lazyTimelineView) |
251 this._lazyTimelineView = new WebInspector.TimelineView(this, this._m
odel); | 265 this._lazyTimelineView = new WebInspector.TimelineView(this, this._m
odel); |
252 return this._lazyTimelineView; | 266 return this._lazyTimelineView; |
253 }, | 267 }, |
254 | 268 |
255 /** | 269 /** |
(...skipping 19 matching lines...) Expand all Loading... |
275 views.mainViews = [this._timelineView(), new WebInspector.Memory
CountersGraph(this, this._model)]; | 289 views.mainViews = [this._timelineView(), new WebInspector.Memory
CountersGraph(this, this._model)]; |
276 break; | 290 break; |
277 case WebInspector.TimelinePanel.Mode.FlameChart: | 291 case WebInspector.TimelinePanel.Mode.FlameChart: |
278 views.overviewView = new WebInspector.TimelineFrameOverview(this
._model, this._frameModel()); | 292 views.overviewView = new WebInspector.TimelineFrameOverview(this
._model, this._frameModel()); |
279 views.mainViews = [new WebInspector.TimelineFlameChart(this, thi
s._model, this._frameModel())]; | 293 views.mainViews = [new WebInspector.TimelineFlameChart(this, thi
s._model, this._frameModel())]; |
280 break; | 294 break; |
281 case WebInspector.TimelinePanel.Mode.Power: | 295 case WebInspector.TimelinePanel.Mode.Power: |
282 views.overviewView = new WebInspector.TimelinePowerOverview(this
._model); | 296 views.overviewView = new WebInspector.TimelinePowerOverview(this
._model); |
283 views.mainViews = [this._timelineView(), new WebInspector.Timeli
nePowerGraph(this, this._model)]; | 297 views.mainViews = [this._timelineView(), new WebInspector.Timeli
nePowerGraph(this, this._model)]; |
284 break; | 298 break; |
| 299 case WebInspector.TimelinePanel.Mode.Tracing: |
| 300 views.overviewView = new WebInspector.TimelineFrameOverview(this
._model, this._frameModel()); |
| 301 views.mainViews = [this._tracingView()]; |
| 302 break; |
285 default: | 303 default: |
286 console.assert(false, "Unknown mode: " + mode); | 304 console.assert(false, "Unknown mode: " + mode); |
287 } | 305 } |
288 for (var i = 0; i < views.mainViews.length; ++i) | 306 for (var i = 0; i < views.mainViews.length; ++i) |
289 views.mainViews[i].addEventListener(WebInspector.SplitView.Event
s.SidebarSizeChanged, this._sidebarResized, this); | 307 views.mainViews[i].addEventListener(WebInspector.SplitView.Event
s.SidebarSizeChanged, this._sidebarResized, this); |
290 this._viewsMap[mode] = views; | 308 this._viewsMap[mode] = views; |
291 } | 309 } |
292 | 310 |
293 this._timelineView().setFrameModel(mode === WebInspector.TimelinePanel.M
ode.Frames ? this._frameModel() : null); | 311 this._timelineView().setFrameModel(mode === WebInspector.TimelinePanel.M
ode.Frames ? this._frameModel() : null); |
294 return views; | 312 return views; |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 this._updateSelectionDetails(); | 578 this._updateSelectionDetails(); |
561 }, | 579 }, |
562 | 580 |
563 /** | 581 /** |
564 * @param {boolean} userInitiated | 582 * @param {boolean} userInitiated |
565 */ | 583 */ |
566 _startRecording: function(userInitiated) | 584 _startRecording: function(userInitiated) |
567 { | 585 { |
568 this._userInitiatedRecording = userInitiated; | 586 this._userInitiatedRecording = userInitiated; |
569 this._model.startRecording(); | 587 this._model.startRecording(); |
570 for (var i = 0; i < this._presentationModes.length; ++i) | 588 for (var i = 0; i < this._presentationModes.length; ++i) { |
571 this._viewsForMode(this._presentationModes[i]).overviewView.timeline
Started(); | 589 var views = this._viewsForMode(this._presentationModes[i]); |
572 | 590 views.overviewView.timelineStarted(); |
| 591 for (var j = 0; j < views.mainViews.length; ++j) |
| 592 views.mainViews[j].timelineStarted(); |
| 593 } |
573 if (userInitiated) | 594 if (userInitiated) |
574 WebInspector.userMetrics.TimelineStarted.record(); | 595 WebInspector.userMetrics.TimelineStarted.record(); |
575 }, | 596 }, |
576 | 597 |
577 _stopRecording: function() | 598 _stopRecording: function() |
578 { | 599 { |
579 this._userInitiatedRecording = false; | 600 this._userInitiatedRecording = false; |
580 this._model.stopRecording(); | 601 this._model.stopRecording(); |
581 for (var i = 0; i < this._presentationModes.length; ++i) | 602 for (var i = 0; i < this._presentationModes.length; ++i) { |
582 this._viewsForMode(this._presentationModes[i]).overviewView.timeline
Stopped(); | 603 var views = this._viewsForMode(this._presentationModes[i]); |
| 604 views.overviewView.timelineStopped(); |
| 605 for (var j = 0; j < views.mainViews.length; ++j) |
| 606 views.mainViews[j].timelineStopped(); |
| 607 } |
583 }, | 608 }, |
584 | 609 |
585 /** | 610 /** |
586 * @return {boolean} | 611 * @return {boolean} |
587 */ | 612 */ |
588 _toggleTimelineButtonClicked: function() | 613 _toggleTimelineButtonClicked: function() |
589 { | 614 { |
590 if (this._operationInProgress) | 615 if (this._operationInProgress) |
591 return true; | 616 return true; |
592 if (this._recordingInProgress()) | 617 if (this._recordingInProgress()) |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 setWindowTimes: function(startTime, endTime) {}, | 1022 setWindowTimes: function(startTime, endTime) {}, |
998 | 1023 |
999 /** | 1024 /** |
1000 * @param {number} width | 1025 * @param {number} width |
1001 */ | 1026 */ |
1002 setSidebarSize: function(width) {}, | 1027 setSidebarSize: function(width) {}, |
1003 | 1028 |
1004 /** | 1029 /** |
1005 * @param {?WebInspector.TimelineModel.Record} record | 1030 * @param {?WebInspector.TimelineModel.Record} record |
1006 */ | 1031 */ |
1007 setSelectedRecord: function(record) {} | 1032 setSelectedRecord: function(record) {}, |
| 1033 |
| 1034 timelineStarted: function() {}, |
| 1035 |
| 1036 timelineStopped: function() {}, |
1008 } | 1037 } |
1009 | 1038 |
1010 /** | 1039 /** |
1011 * @interface | 1040 * @interface |
1012 */ | 1041 */ |
1013 WebInspector.TimelineModeViewDelegate = function() {} | 1042 WebInspector.TimelineModeViewDelegate = function() {} |
1014 | 1043 |
1015 WebInspector.TimelineModeViewDelegate.prototype = { | 1044 WebInspector.TimelineModeViewDelegate.prototype = { |
1016 /** | 1045 /** |
1017 * @param {number} startTime | 1046 * @param {number} startTime |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 * @param {!WebInspector.TimelineModel.Record} record | 1185 * @param {!WebInspector.TimelineModel.Record} record |
1157 * @return {boolean} | 1186 * @return {boolean} |
1158 */ | 1187 */ |
1159 accept: function(record) | 1188 accept: function(record) |
1160 { | 1189 { |
1161 return !this._hiddenRecords[record.type]; | 1190 return !this._hiddenRecords[record.type]; |
1162 }, | 1191 }, |
1163 | 1192 |
1164 __proto__: WebInspector.TimelineModel.Filter.prototype | 1193 __proto__: WebInspector.TimelineModel.Filter.prototype |
1165 } | 1194 } |
OLD | NEW |