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 25 matching lines...) Expand all Loading... | |
36 importScript("TimelineOverviewPane.js"); | 36 importScript("TimelineOverviewPane.js"); |
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("TimelinePowerOverview.js"); | 42 importScript("TimelinePowerOverview.js"); |
43 importScript("TimelineFlameChart.js"); | 43 importScript("TimelineFlameChart.js"); |
44 importScript("TimelineUIUtils.js"); | 44 importScript("TimelineUIUtils.js"); |
45 importScript("TimelineView.js"); | 45 importScript("TimelineView.js"); |
46 importScript("TimelineTraceView.js"); | |
46 | 47 |
47 /** | 48 /** |
48 * @constructor | 49 * @constructor |
49 * @extends {WebInspector.Panel} | 50 * @extends {WebInspector.Panel} |
50 * @implements {WebInspector.TimelineModeViewDelegate} | 51 * @implements {WebInspector.TimelineModeViewDelegate} |
51 * @implements {WebInspector.Searchable} | 52 * @implements {WebInspector.Searchable} |
52 */ | 53 */ |
53 WebInspector.TimelinePanel = function() | 54 WebInspector.TimelinePanel = function() |
54 { | 55 { |
55 WebInspector.Panel.call(this, "timeline"); | 56 WebInspector.Panel.call(this, "timeline"); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 | 124 |
124 this._selectPresentationMode(this._presentationModeSetting.get()); | 125 this._selectPresentationMode(this._presentationModeSetting.get()); |
125 this._detailsSplitView.show(this.element); | 126 this._detailsSplitView.show(this.element); |
126 } | 127 } |
127 | 128 |
128 WebInspector.TimelinePanel.Mode = { | 129 WebInspector.TimelinePanel.Mode = { |
129 Events: "Events", | 130 Events: "Events", |
130 Frames: "Frames", | 131 Frames: "Frames", |
131 Memory: "Memory", | 132 Memory: "Memory", |
132 FlameChart: "FlameChart", | 133 FlameChart: "FlameChart", |
133 Power: "Power" | 134 Power: "Power", |
135 Tracing: "Tracing" | |
134 }; | 136 }; |
135 | 137 |
136 // Define row and header height, should be in sync with styles for timeline grap hs. | 138 // Define row and header height, should be in sync with styles for timeline grap hs. |
137 WebInspector.TimelinePanel.rowHeight = 18; | 139 WebInspector.TimelinePanel.rowHeight = 18; |
138 WebInspector.TimelinePanel.headerHeight = 20; | 140 WebInspector.TimelinePanel.headerHeight = 20; |
139 | 141 |
140 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; | 142 WebInspector.TimelinePanel.durationFilterPresetsMs = [0, 1, 15]; |
141 | 143 |
142 WebInspector.TimelinePanel.prototype = { | 144 WebInspector.TimelinePanel.prototype = { |
143 wasShown: function() | 145 wasShown: function() |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 * @return {!WebInspector.TimelineFrameModel} | 226 * @return {!WebInspector.TimelineFrameModel} |
225 */ | 227 */ |
226 _frameModel: function() | 228 _frameModel: function() |
227 { | 229 { |
228 if (!this._lazyFrameModel) | 230 if (!this._lazyFrameModel) |
229 this._lazyFrameModel = new WebInspector.TimelineFrameModel(this._mod el); | 231 this._lazyFrameModel = new WebInspector.TimelineFrameModel(this._mod el); |
230 return this._lazyFrameModel; | 232 return this._lazyFrameModel; |
231 }, | 233 }, |
232 | 234 |
233 /** | 235 /** |
236 * @return {!WebInspector.TracingModel} | |
237 */ | |
238 _tracingModel: function() | |
239 { | |
240 if (!this._lazyTracingModel) | |
pfeldman
2014/03/26 18:32:09
We need to figure out the instrumentation vs curre
| |
241 this._lazyTracingModel = new WebInspector.TracingModel(); | |
242 return this._lazyTracingModel; | |
243 }, | |
244 | |
245 /** | |
246 * @return {!WebInspector.TimelineTraceView} | |
247 */ | |
248 _traceView: function() | |
249 { | |
250 if (!this._lazyTraceView) | |
251 this._lazyTraceView = new WebInspector.TimelineTraceView(this, this. _tracingModel()); | |
252 return this._lazyTraceView; | |
253 }, | |
254 | |
255 /** | |
234 * @return {!WebInspector.TimelineView} | 256 * @return {!WebInspector.TimelineView} |
235 */ | 257 */ |
236 _timelineView: function() | 258 _timelineView: function() |
237 { | 259 { |
238 if (!this._lazyTimelineView) | 260 if (!this._lazyTimelineView) |
239 this._lazyTimelineView = new WebInspector.TimelineView(this, this._m odel); | 261 this._lazyTimelineView = new WebInspector.TimelineView(this, this._m odel); |
240 return this._lazyTimelineView; | 262 return this._lazyTimelineView; |
241 }, | 263 }, |
242 | 264 |
243 /** | 265 /** |
(...skipping 18 matching lines...) Expand all Loading... | |
262 views.overviewView = new WebInspector.TimelineMemoryOverview(thi s._model); | 284 views.overviewView = new WebInspector.TimelineMemoryOverview(thi s._model); |
263 views.mainViews = [this._timelineView(), new WebInspector.Memory CountersGraph(this, this._model)]; | 285 views.mainViews = [this._timelineView(), new WebInspector.Memory CountersGraph(this, this._model)]; |
264 break; | 286 break; |
265 case WebInspector.TimelinePanel.Mode.FlameChart: | 287 case WebInspector.TimelinePanel.Mode.FlameChart: |
266 views.overviewView = new WebInspector.TimelineFrameOverview(this ._model, this._frameModel()); | 288 views.overviewView = new WebInspector.TimelineFrameOverview(this ._model, this._frameModel()); |
267 views.mainViews = [new WebInspector.TimelineFlameChart(this, thi s._model, this._frameModel())]; | 289 views.mainViews = [new WebInspector.TimelineFlameChart(this, thi s._model, this._frameModel())]; |
268 break; | 290 break; |
269 case WebInspector.TimelinePanel.Mode.Power: | 291 case WebInspector.TimelinePanel.Mode.Power: |
270 views.overviewView = new WebInspector.TimelinePowerOverview(this ._model); | 292 views.overviewView = new WebInspector.TimelinePowerOverview(this ._model); |
271 views.mainViews = [this._timelineView()]; | 293 views.mainViews = [this._timelineView()]; |
294 case WebInspector.TimelinePanel.Mode.Tracing: | |
295 views.overviewView = new WebInspector.TimelineFrameOverview(this ._model, this._frameModel()); | |
296 views.mainViews = [this._traceView()]; | |
272 break; | 297 break; |
273 default: | 298 default: |
274 console.assert(false, "Unknown mode: " + mode); | 299 console.assert(false, "Unknown mode: " + mode); |
275 } | 300 } |
276 for (var i = 0; i < views.mainViews.length; ++i) | 301 for (var i = 0; i < views.mainViews.length; ++i) |
277 views.mainViews[i].addEventListener(WebInspector.SplitView.Event s.SidebarSizeChanged, this._sidebarResized, this); | 302 views.mainViews[i].addEventListener(WebInspector.SplitView.Event s.SidebarSizeChanged, this._sidebarResized, this); |
278 this._viewsMap[mode] = views; | 303 this._viewsMap[mode] = views; |
279 } | 304 } |
280 | 305 |
281 this._timelineView().setFrameModel(mode === WebInspector.TimelinePanel.M ode.Frames ? this._frameModel() : null); | 306 this._timelineView().setFrameModel(mode === WebInspector.TimelinePanel.M ode.Frames ? this._frameModel() : null); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
560 */ | 585 */ |
561 _startRecording: function(userInitiated) | 586 _startRecording: function(userInitiated) |
562 { | 587 { |
563 this._userInitiatedRecording = userInitiated; | 588 this._userInitiatedRecording = userInitiated; |
564 this._model.startRecording(true); | 589 this._model.startRecording(true); |
565 for (var mode in WebInspector.TimelinePanel.Mode) | 590 for (var mode in WebInspector.TimelinePanel.Mode) |
566 this._viewsForMode(mode).overviewView.timelineStarted(); | 591 this._viewsForMode(mode).overviewView.timelineStarted(); |
567 | 592 |
568 if (userInitiated) | 593 if (userInitiated) |
569 WebInspector.userMetrics.TimelineStarted.record(); | 594 WebInspector.userMetrics.TimelineStarted.record(); |
595 if (this._presentationModeSetting.get() === WebInspector.TimelinePanel.M ode.Tracing) { | |
596 if (!this._boundTraceEventListener) | |
597 this._boundTraceEventListener = this._onTraceEventsCollected.bin d(this); | |
598 this._recordingTrace = true; | |
599 WebInspector.tracingAgent.addEventListener(WebInspector.TracingAgent .Events.EventsCollected, this._boundTraceEventListener); | |
600 WebInspector.tracingAgent.start("", ""); | |
pfeldman
2014/03/26 18:32:09
For better modularity, you should introduce record
caseq
2014/03/28 17:13:41
Done, though I named it timelineStarted/Stopped si
| |
601 } | |
570 }, | 602 }, |
571 | 603 |
572 _stopRecording: function() | 604 _stopRecording: function() |
573 { | 605 { |
574 this._userInitiatedRecording = false; | 606 this._userInitiatedRecording = false; |
575 this._model.stopRecording(); | 607 this._model.stopRecording(); |
576 for (var mode in WebInspector.TimelinePanel.Mode) | 608 for (var mode in WebInspector.TimelinePanel.Mode) |
577 this._viewsForMode(mode).overviewView.timelineStopped(); | 609 this._viewsForMode(mode).overviewView.timelineStopped(); |
610 | |
611 /** | |
612 * @this {WebInspector.TimelinePanel} | |
613 */ | |
614 function onTraceDataComplete() | |
615 { | |
616 WebInspector.tracingAgent.removeEventListener(WebInspector.TracingAg ent.Events.EventsCollected, this._boundTraceEventListener); | |
617 this._traceView().refreshRecords(this._textFilter._regex); | |
618 } | |
619 if (this._recordingTrace) { | |
620 WebInspector.tracingAgent.stop(onTraceDataComplete.bind(this)); | |
621 this._recordingTrace = false; | |
622 } | |
578 }, | 623 }, |
579 | 624 |
580 /** | 625 /** |
581 * @return {boolean} | 626 * @return {boolean} |
582 */ | 627 */ |
583 _toggleTimelineButtonClicked: function() | 628 _toggleTimelineButtonClicked: function() |
584 { | 629 { |
585 if (this._operationInProgress) | 630 if (this._operationInProgress) |
586 return true; | 631 return true; |
587 if (this._recordingInProgress()) | 632 if (this._recordingInProgress()) |
(...skipping 12 matching lines...) Expand all Loading... | |
600 { | 645 { |
601 this._model.reset(); | 646 this._model.reset(); |
602 }, | 647 }, |
603 | 648 |
604 _onRecordsCleared: function() | 649 _onRecordsCleared: function() |
605 { | 650 { |
606 this.requestWindowTimes(0, Infinity); | 651 this.requestWindowTimes(0, Infinity); |
607 delete this._selectedRecord; | 652 delete this._selectedRecord; |
608 if (this._lazyFrameModel) | 653 if (this._lazyFrameModel) |
609 this._lazyFrameModel.reset(); | 654 this._lazyFrameModel.reset(); |
655 if (this._lazyTraceModel) | |
656 this._lazyTraceModel.reset(); | |
610 for (var i = 0; i < this._currentViews.length; ++i) | 657 for (var i = 0; i < this._currentViews.length; ++i) |
611 this._currentViews[i].reset(); | 658 this._currentViews[i].reset(); |
612 this._overviewControl.reset(); | 659 this._overviewControl.reset(); |
613 this._updateSelectionDetails(); | 660 this._updateSelectionDetails(); |
614 }, | 661 }, |
615 | 662 |
616 _onRecordingStarted: function() | 663 _onRecordingStarted: function() |
617 { | 664 { |
618 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); | 665 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); |
619 this.toggleTimelineButton.toggled = true; | 666 this.toggleTimelineButton.toggled = true; |
(...skipping 22 matching lines...) Expand all Loading... | |
642 { | 689 { |
643 if (this._lazyFrameModel) | 690 if (this._lazyFrameModel) |
644 this._lazyFrameModel.addRecord(record); | 691 this._lazyFrameModel.addRecord(record); |
645 for (var i = 0; i < this._currentViews.length; ++i) | 692 for (var i = 0; i < this._currentViews.length; ++i) |
646 this._currentViews[i].addRecord(record); | 693 this._currentViews[i].addRecord(record); |
647 this._overviewPane.addRecord(record); | 694 this._overviewPane.addRecord(record); |
648 this._updateSearchHighlight(false, true); | 695 this._updateSearchHighlight(false, true); |
649 }, | 696 }, |
650 | 697 |
651 /** | 698 /** |
699 * @param {!WebInspector.Event} event | |
700 */ | |
701 _onTraceEventsCollected: function(event) | |
702 { | |
703 var events = /** @type {!Array.<!WebInspector.TracingAgent.Event>} */ (e vent.data); | |
704 if (this._lazyTracingModel) | |
705 this._lazyTracingModel.addEvents(events); | |
706 }, | |
707 | |
708 /** | |
652 * @param {!WebInspector.Event} event | 709 * @param {!WebInspector.Event} event |
653 */ | 710 */ |
654 _willReloadPage: function(event) | 711 _willReloadPage: function(event) |
655 { | 712 { |
656 if (this._operationInProgress || this._userInitiatedRecording || !this.i sShowing()) | 713 if (this._operationInProgress || this._userInitiatedRecording || !this.i sShowing()) |
657 return; | 714 return; |
658 this._startRecording(false); | 715 this._startRecording(false); |
659 }, | 716 }, |
660 | 717 |
661 /** | 718 /** |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1122 * @param {!WebInspector.TimelineModel.Record} record | 1179 * @param {!WebInspector.TimelineModel.Record} record |
1123 * @return {boolean} | 1180 * @return {boolean} |
1124 */ | 1181 */ |
1125 accept: function(record) | 1182 accept: function(record) |
1126 { | 1183 { |
1127 return !this._hiddenRecords[record.type]; | 1184 return !this._hiddenRecords[record.type]; |
1128 }, | 1185 }, |
1129 | 1186 |
1130 __proto__: WebInspector.TimelineModel.Filter.prototype | 1187 __proto__: WebInspector.TimelineModel.Filter.prototype |
1131 } | 1188 } |
OLD | NEW |