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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 128 |
129 this._mainThreadTasks = /** @type {!Array.<{startTime: number, endTime: numb
er}>} */ ([]); | 129 this._mainThreadTasks = /** @type {!Array.<{startTime: number, endTime: numb
er}>} */ ([]); |
130 this._cpuBarsElement = this._timelineGrid.gridHeaderElement.createChild("div
", "timeline-cpu-bars"); | 130 this._cpuBarsElement = this._timelineGrid.gridHeaderElement.createChild("div
", "timeline-cpu-bars"); |
131 this._mainThreadMonitoringEnabled = WebInspector.settings.showCpuOnTimelineR
uler.get(); | 131 this._mainThreadMonitoringEnabled = WebInspector.settings.showCpuOnTimelineR
uler.get(); |
132 WebInspector.settings.showCpuOnTimelineRuler.addChangeListener(this._showCpu
OnTimelineRulerChanged, this); | 132 WebInspector.settings.showCpuOnTimelineRuler.addChangeListener(this._showCpu
OnTimelineRulerChanged, this); |
133 | 133 |
134 this._createFileSelector(); | 134 this._createFileSelector(); |
135 | 135 |
136 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded,
this._onTimelineEventRecorded, this); | 136 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordAdded,
this._onTimelineEventRecorded, this); |
137 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare
d, this._onRecordsCleared, this); | 137 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordsCleare
d, this._onRecordsCleared, this); |
| 138 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStar
ted, this._onRecordingStarted, this); |
| 139 this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStop
ped, this._onRecordingStopped, this); |
138 | 140 |
139 this._registerShortcuts(); | 141 this._registerShortcuts(); |
140 | 142 |
141 this._allRecordsCount = 0; | 143 this._allRecordsCount = 0; |
142 | 144 |
143 this._presentationModel.addFilter(new WebInspector.TimelineWindowFilter(this
._overviewPane)); | 145 this._presentationModel.addFilter(new WebInspector.TimelineWindowFilter(this
._overviewPane)); |
144 this._presentationModel.addFilter(new WebInspector.TimelineCategoryFilter())
; | 146 this._presentationModel.addFilter(new WebInspector.TimelineCategoryFilter())
; |
145 this._presentationModel.addFilter(this._durationFilter); | 147 this._presentationModel.addFilter(this._durationFilter); |
146 } | 148 } |
147 | 149 |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 | 408 |
407 /** | 409 /** |
408 * @return {?WebInspector.ProgressIndicator} | 410 * @return {?WebInspector.ProgressIndicator} |
409 */ | 411 */ |
410 _prepareToLoadTimeline: function() | 412 _prepareToLoadTimeline: function() |
411 { | 413 { |
412 if (this._operationInProgress) | 414 if (this._operationInProgress) |
413 return null; | 415 return null; |
414 if (this.toggleTimelineButton.toggled) { | 416 if (this.toggleTimelineButton.toggled) { |
415 this.toggleTimelineButton.toggled = false; | 417 this.toggleTimelineButton.toggled = false; |
416 this._model.stopRecord(); | 418 this._model.stopRecording(); |
417 } | 419 } |
418 var progressIndicator = new WebInspector.ProgressIndicator(); | 420 var progressIndicator = new WebInspector.ProgressIndicator(); |
419 progressIndicator.addEventListener(WebInspector.ProgressIndicator.Events
.Done, this._setOperationInProgress.bind(this, null)); | 421 progressIndicator.addEventListener(WebInspector.ProgressIndicator.Events
.Done, this._setOperationInProgress.bind(this, null)); |
420 this._setOperationInProgress(progressIndicator); | 422 this._setOperationInProgress(progressIndicator); |
421 return progressIndicator; | 423 return progressIndicator; |
422 }, | 424 }, |
423 | 425 |
424 _rootRecord: function() | 426 _rootRecord: function() |
425 { | 427 { |
426 return this._presentationModel.rootRecord(); | 428 return this._presentationModel.rootRecord(); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 }, | 572 }, |
571 | 573 |
572 /** | 574 /** |
573 * @return {boolean} | 575 * @return {boolean} |
574 */ | 576 */ |
575 _toggleTimelineButtonClicked: function() | 577 _toggleTimelineButtonClicked: function() |
576 { | 578 { |
577 if (this._operationInProgress) | 579 if (this._operationInProgress) |
578 return true; | 580 return true; |
579 if (this.toggleTimelineButton.toggled) { | 581 if (this.toggleTimelineButton.toggled) { |
580 this._model.stopRecord(); | 582 this._model.stopRecording(); |
581 this.toggleTimelineButton.title = WebInspector.UIString("Record"); | |
582 } else { | 583 } else { |
583 this._model.startRecord(this._includeDomCounters); | 584 this._model.startRecording(this._includeDomCounters); |
584 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); | |
585 WebInspector.userMetrics.TimelineStarted.record(); | 585 WebInspector.userMetrics.TimelineStarted.record(); |
586 } | 586 } |
587 this.toggleTimelineButton.toggled = !this.toggleTimelineButton.toggled; | |
588 return true; | 587 return true; |
589 }, | 588 }, |
590 | 589 |
591 _durationFilterChanged: function() | 590 _durationFilterChanged: function() |
592 { | 591 { |
593 var option = this._durationFilterSelector.selectedOption(); | 592 var option = this._durationFilterSelector.selectedOption(); |
594 var minimumRecordDuration = +option._durationMs / 1000.0; | 593 var minimumRecordDuration = +option._durationMs / 1000.0; |
595 this._durationFilter.setMinimumRecordDuration(minimumRecordDuration); | 594 this._durationFilter.setMinimumRecordDuration(minimumRecordDuration); |
596 this._durationFilterSelector.element.title = option.title; | 595 this._durationFilterSelector.element.title = option.title; |
597 this._invalidateAndScheduleRefresh(true, true); | 596 this._invalidateAndScheduleRefresh(true, true); |
(...skipping 18 matching lines...) Expand all Loading... |
616 this._resetPanel(); | 615 this._resetPanel(); |
617 this._automaticallySizeWindow = false; | 616 this._automaticallySizeWindow = false; |
618 var records = this._model.records; | 617 var records = this._model.records; |
619 for (var i = 0; i < records.length; ++i) | 618 for (var i = 0; i < records.length; ++i) |
620 this._innerAddRecordToTimeline(records[i]); | 619 this._innerAddRecordToTimeline(records[i]); |
621 this._invalidateAndScheduleRefresh(false, false); | 620 this._invalidateAndScheduleRefresh(false, false); |
622 }, | 621 }, |
623 | 622 |
624 _onTimelineEventRecorded: function(event) | 623 _onTimelineEventRecorded: function(event) |
625 { | 624 { |
626 if (this._innerAddRecordToTimeline(event.data)) | 625 if (this._innerAddRecordToTimeline(/** @type {TimelineAgent.TimelineEven
t} */(event.data))) |
627 this._invalidateAndScheduleRefresh(false, false); | 626 this._invalidateAndScheduleRefresh(false, false); |
628 }, | 627 }, |
629 | 628 |
| 629 /** |
| 630 * @param {TimelineAgent.TimelineEvent} record |
| 631 */ |
630 _innerAddRecordToTimeline: function(record) | 632 _innerAddRecordToTimeline: function(record) |
631 { | 633 { |
632 if (record.type === WebInspector.TimelineModel.RecordType.Program) { | 634 if (record.type === WebInspector.TimelineModel.RecordType.Program) { |
633 this._mainThreadTasks.push({ | 635 this._mainThreadTasks.push({ |
634 startTime: WebInspector.TimelineModel.startTimeInSeconds(record)
, | 636 startTime: WebInspector.TimelineModel.startTimeInSeconds(record)
, |
635 endTime: WebInspector.TimelineModel.endTimeInSeconds(record) | 637 endTime: WebInspector.TimelineModel.endTimeInSeconds(record) |
636 }); | 638 }); |
637 } | 639 } |
638 | 640 |
639 var records = this._presentationModel.addRecord(record); | 641 var records = this._presentationModel.addRecord(record); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 { | 689 { |
688 this._model.reset(); | 690 this._model.reset(); |
689 }, | 691 }, |
690 | 692 |
691 _onRecordsCleared: function() | 693 _onRecordsCleared: function() |
692 { | 694 { |
693 this._resetPanel(); | 695 this._resetPanel(); |
694 this._invalidateAndScheduleRefresh(true, true); | 696 this._invalidateAndScheduleRefresh(true, true); |
695 }, | 697 }, |
696 | 698 |
| 699 _onRecordingStarted: function() |
| 700 { |
| 701 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); |
| 702 this.toggleTimelineButton.toggled = true; |
| 703 }, |
| 704 |
| 705 _onRecordingStopped: function() |
| 706 { |
| 707 this.toggleTimelineButton.title = WebInspector.UIString("Record"); |
| 708 this.toggleTimelineButton.toggled = false; |
| 709 }, |
| 710 |
697 _resetPanel: function() | 711 _resetPanel: function() |
698 { | 712 { |
699 this._presentationModel.reset(); | 713 this._presentationModel.reset(); |
700 this._boundariesAreValid = false; | 714 this._boundariesAreValid = false; |
701 this._adjustScrollPosition(0); | 715 this._adjustScrollPosition(0); |
702 this._closeRecordDetails(); | 716 this._closeRecordDetails(); |
703 this._allRecordsCount = 0; | 717 this._allRecordsCount = 0; |
704 this._automaticallySizeWindow = true; | 718 this._automaticallySizeWindow = true; |
705 this._mainThreadTasks = []; | 719 this._mainThreadTasks = []; |
706 }, | 720 }, |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 | 1627 |
1614 /** | 1628 /** |
1615 * @param {!WebInspector.TimelinePresentationModel.Record} record | 1629 * @param {!WebInspector.TimelinePresentationModel.Record} record |
1616 * @return {boolean} | 1630 * @return {boolean} |
1617 */ | 1631 */ |
1618 accept: function(record) | 1632 accept: function(record) |
1619 { | 1633 { |
1620 return WebInspector.TimelineRecordListRow.testContentMatching(record, th
is._regExp); | 1634 return WebInspector.TimelineRecordListRow.testContentMatching(record, th
is._regExp); |
1621 } | 1635 } |
1622 } | 1636 } |
OLD | NEW |