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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 | 399 |
398 /** | 400 /** |
399 * @return {?WebInspector.ProgressIndicator} | 401 * @return {?WebInspector.ProgressIndicator} |
400 */ | 402 */ |
401 _prepareToLoadTimeline: function() | 403 _prepareToLoadTimeline: function() |
402 { | 404 { |
403 if (this._operationInProgress) | 405 if (this._operationInProgress) |
404 return null; | 406 return null; |
405 if (this.toggleTimelineButton.toggled) { | 407 if (this.toggleTimelineButton.toggled) { |
406 this.toggleTimelineButton.toggled = false; | 408 this.toggleTimelineButton.toggled = false; |
407 this._model.stopRecord(); | 409 this._model.stopRecording(); |
408 } | 410 } |
409 var progressIndicator = new WebInspector.ProgressIndicator(); | 411 var progressIndicator = new WebInspector.ProgressIndicator(); |
410 progressIndicator.addEventListener(WebInspector.ProgressIndicator.Events
.Done, this._setOperationInProgress.bind(this, null)); | 412 progressIndicator.addEventListener(WebInspector.ProgressIndicator.Events
.Done, this._setOperationInProgress.bind(this, null)); |
411 this._setOperationInProgress(progressIndicator); | 413 this._setOperationInProgress(progressIndicator); |
412 return progressIndicator; | 414 return progressIndicator; |
413 }, | 415 }, |
414 | 416 |
415 _rootRecord: function() | 417 _rootRecord: function() |
416 { | 418 { |
417 return this._presentationModel.rootRecord(); | 419 return this._presentationModel.rootRecord(); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 }, | 563 }, |
562 | 564 |
563 /** | 565 /** |
564 * @return {boolean} | 566 * @return {boolean} |
565 */ | 567 */ |
566 _toggleTimelineButtonClicked: function() | 568 _toggleTimelineButtonClicked: function() |
567 { | 569 { |
568 if (this._operationInProgress) | 570 if (this._operationInProgress) |
569 return true; | 571 return true; |
570 if (this.toggleTimelineButton.toggled) { | 572 if (this.toggleTimelineButton.toggled) { |
571 this._model.stopRecord(); | 573 this._model.stopRecording(); |
572 this.toggleTimelineButton.title = WebInspector.UIString("Record"); | |
573 } else { | 574 } else { |
574 this._model.startRecord(this._includeDomCounters); | 575 this._model.startRecording(this._includeDomCounters); |
575 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); | |
576 WebInspector.userMetrics.TimelineStarted.record(); | 576 WebInspector.userMetrics.TimelineStarted.record(); |
577 } | 577 } |
578 this.toggleTimelineButton.toggled = !this.toggleTimelineButton.toggled; | |
579 return true; | 578 return true; |
580 }, | 579 }, |
581 | 580 |
582 _durationFilterChanged: function() | 581 _durationFilterChanged: function() |
583 { | 582 { |
584 var option = this._durationFilterSelector.selectedOption(); | 583 var option = this._durationFilterSelector.selectedOption(); |
585 var minimumRecordDuration = +option._durationMs / 1000.0; | 584 var minimumRecordDuration = +option._durationMs / 1000.0; |
586 this._durationFilter.setMinimumRecordDuration(minimumRecordDuration); | 585 this._durationFilter.setMinimumRecordDuration(minimumRecordDuration); |
587 this._durationFilterSelector.element.title = option.title; | 586 this._durationFilterSelector.element.title = option.title; |
588 this._invalidateAndScheduleRefresh(true, true); | 587 this._invalidateAndScheduleRefresh(true, true); |
(...skipping 18 matching lines...) Expand all Loading... |
607 this._resetPanel(); | 606 this._resetPanel(); |
608 this._automaticallySizeWindow = false; | 607 this._automaticallySizeWindow = false; |
609 var records = this._model.records; | 608 var records = this._model.records; |
610 for (var i = 0; i < records.length; ++i) | 609 for (var i = 0; i < records.length; ++i) |
611 this._innerAddRecordToTimeline(records[i]); | 610 this._innerAddRecordToTimeline(records[i]); |
612 this._invalidateAndScheduleRefresh(false, false); | 611 this._invalidateAndScheduleRefresh(false, false); |
613 }, | 612 }, |
614 | 613 |
615 _onTimelineEventRecorded: function(event) | 614 _onTimelineEventRecorded: function(event) |
616 { | 615 { |
617 if (this._innerAddRecordToTimeline(event.data)) | 616 if (this._innerAddRecordToTimeline(/** @type {TimelineAgent.TimelineEven
t} */(event.data))) |
618 this._invalidateAndScheduleRefresh(false, false); | 617 this._invalidateAndScheduleRefresh(false, false); |
619 }, | 618 }, |
620 | 619 |
| 620 /** |
| 621 * @param {TimelineAgent.TimelineEvent} record |
| 622 */ |
621 _innerAddRecordToTimeline: function(record) | 623 _innerAddRecordToTimeline: function(record) |
622 { | 624 { |
623 if (record.type === WebInspector.TimelineModel.RecordType.Program) { | 625 if (record.type === WebInspector.TimelineModel.RecordType.Program) { |
624 this._mainThreadTasks.push({ | 626 this._mainThreadTasks.push({ |
625 startTime: WebInspector.TimelineModel.startTimeInSeconds(record)
, | 627 startTime: WebInspector.TimelineModel.startTimeInSeconds(record)
, |
626 endTime: WebInspector.TimelineModel.endTimeInSeconds(record) | 628 endTime: WebInspector.TimelineModel.endTimeInSeconds(record) |
627 }); | 629 }); |
628 } | 630 } |
629 | 631 |
630 var records = this._presentationModel.addRecord(record); | 632 var records = this._presentationModel.addRecord(record); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 { | 680 { |
679 this._model.reset(); | 681 this._model.reset(); |
680 }, | 682 }, |
681 | 683 |
682 _onRecordsCleared: function() | 684 _onRecordsCleared: function() |
683 { | 685 { |
684 this._resetPanel(); | 686 this._resetPanel(); |
685 this._invalidateAndScheduleRefresh(true, true); | 687 this._invalidateAndScheduleRefresh(true, true); |
686 }, | 688 }, |
687 | 689 |
| 690 _onRecordingStarted: function() |
| 691 { |
| 692 this.toggleTimelineButton.title = WebInspector.UIString("Stop"); |
| 693 this.toggleTimelineButton.toggled = true; |
| 694 }, |
| 695 |
| 696 _onRecordingStopped: function() |
| 697 { |
| 698 this.toggleTimelineButton.title = WebInspector.UIString("Record"); |
| 699 this.toggleTimelineButton.toggled = false; |
| 700 }, |
| 701 |
688 _resetPanel: function() | 702 _resetPanel: function() |
689 { | 703 { |
690 this._presentationModel.reset(); | 704 this._presentationModel.reset(); |
691 this._boundariesAreValid = false; | 705 this._boundariesAreValid = false; |
692 this._adjustScrollPosition(0); | 706 this._adjustScrollPosition(0); |
693 this._closeRecordDetails(); | 707 this._closeRecordDetails(); |
694 this._allRecordsCount = 0; | 708 this._allRecordsCount = 0; |
695 this._automaticallySizeWindow = true; | 709 this._automaticallySizeWindow = true; |
696 this._mainThreadTasks = []; | 710 this._mainThreadTasks = []; |
697 }, | 711 }, |
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1604 | 1618 |
1605 /** | 1619 /** |
1606 * @param {!WebInspector.TimelinePresentationModel.Record} record | 1620 * @param {!WebInspector.TimelinePresentationModel.Record} record |
1607 * @return {boolean} | 1621 * @return {boolean} |
1608 */ | 1622 */ |
1609 accept: function(record) | 1623 accept: function(record) |
1610 { | 1624 { |
1611 return WebInspector.TimelineRecordListRow.testContentMatching(record, th
is._regExp); | 1625 return WebInspector.TimelineRecordListRow.testContentMatching(record, th
is._regExp); |
1612 } | 1626 } |
1613 } | 1627 } |
OLD | NEW |