| 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 | 533 |
| 534 /** | 534 /** |
| 535 * @param {boolean} enabled | 535 * @param {boolean} enabled |
| 536 */ | 536 */ |
| 537 _setUIControlsEnabled(enabled) { | 537 _setUIControlsEnabled(enabled) { |
| 538 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable
d)); | 538 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable
d)); |
| 539 } | 539 } |
| 540 | 540 |
| 541 /** | 541 /** |
| 542 * @param {boolean} userInitiated | 542 * @param {boolean} userInitiated |
| 543 * @return {!Promise} |
| 543 */ | 544 */ |
| 544 _startRecording(userInitiated) { | 545 _startRecording(userInitiated) { |
| 545 console.assert(!this._statusPane, 'Status pane is already opened.'); | 546 console.assert(!this._statusPane, 'Status pane is already opened.'); |
| 546 var mainTarget = SDK.targetManager.mainTarget(); | 547 var mainTarget = SDK.targetManager.mainTarget(); |
| 547 if (!mainTarget) | 548 if (!mainTarget) |
| 548 return; | 549 return Promise.resolve(); |
| 549 this._setState(Timeline.TimelinePanel.State.StartPending); | 550 this._setState(Timeline.TimelinePanel.State.StartPending); |
| 550 this._showRecordingStarted(); | 551 this._showRecordingStarted(); |
| 551 | 552 |
| 552 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); | 553 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); |
| 553 var enabledTraceProviders = Extensions.extensionServer.traceProviders().filt
er( | 554 var enabledTraceProviders = Extensions.extensionServer.traceProviders().filt
er( |
| 554 provider => Timeline.TimelinePanel._settingForTraceProvider(provider).ge
t()); | 555 provider => Timeline.TimelinePanel._settingForTraceProvider(provider).ge
t()); |
| 555 | 556 |
| 556 const recordingOptions = { | 557 const recordingOptions = { |
| 557 enableJSSampling: !this._disableCaptureJSProfileSetting.get(), | 558 enableJSSampling: !this._disableCaptureJSProfileSetting.get(), |
| 558 capturePictures: this._captureLayersAndPicturesSetting.get(), | 559 capturePictures: this._captureLayersAndPicturesSetting.get(), |
| 559 captureFilmStrip: this._showScreenshotsSetting.get() | 560 captureFilmStrip: this._showScreenshotsSetting.get() |
| 560 }; | 561 }; |
| 561 | 562 |
| 562 this._pendingPerformanceModel = new Timeline.PerformanceModel(); | 563 this._pendingPerformanceModel = new Timeline.PerformanceModel(); |
| 563 this._controller = new Timeline.TimelineController(mainTarget, this._pending
PerformanceModel, this); | 564 this._controller = new Timeline.TimelineController(mainTarget, this._pending
PerformanceModel, this); |
| 564 this._controller.startRecording(recordingOptions, enabledTraceProviders); | 565 var startPromise = this._controller.startRecording(recordingOptions, enabled
TraceProviders); |
| 565 | 566 |
| 566 Host.userMetrics.actionTaken( | 567 Host.userMetrics.actionTaken( |
| 567 userInitiated ? Host.UserMetrics.Action.TimelineStarted : Host.UserMetri
cs.Action.TimelinePageReloadStarted); | 568 userInitiated ? Host.UserMetrics.Action.TimelineStarted : Host.UserMetri
cs.Action.TimelinePageReloadStarted); |
| 568 this._setUIControlsEnabled(false); | 569 this._setUIControlsEnabled(false); |
| 569 this._hideLandingPage(); | 570 this._hideLandingPage(); |
| 571 return startPromise; |
| 570 } | 572 } |
| 571 | 573 |
| 572 _stopRecording() { | 574 _stopRecording() { |
| 573 if (this._statusPane) { | 575 if (this._statusPane) { |
| 574 this._statusPane.finish(); | 576 this._statusPane.finish(); |
| 575 this._statusPane.updateStatus(Common.UIString('Stopping timeline\u2026')); | 577 this._statusPane.updateStatus(Common.UIString('Stopping timeline\u2026')); |
| 576 this._statusPane.updateProgressBar(Common.UIString('Received'), 0); | 578 this._statusPane.updateProgressBar(Common.UIString('Received'), 0); |
| 577 } | 579 } |
| 578 this._setState(Timeline.TimelinePanel.State.StopPending); | 580 this._setState(Timeline.TimelinePanel.State.StopPending); |
| 579 this._autoRecordGeneration = null; | 581 this._autoRecordGeneration = null; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 * @param {string} tagName | 682 * @param {string} tagName |
| 681 * @param {string} contents | 683 * @param {string} contents |
| 682 */ | 684 */ |
| 683 function encloseWithTag(tagName, contents) { | 685 function encloseWithTag(tagName, contents) { |
| 684 var e = createElement(tagName); | 686 var e = createElement(tagName); |
| 685 e.textContent = contents; | 687 e.textContent = contents; |
| 686 return e; | 688 return e; |
| 687 } | 689 } |
| 688 | 690 |
| 689 var learnMoreNode = UI.createExternalLink( | 691 var learnMoreNode = UI.createExternalLink( |
| 690 'https://developers.google.com/web/tools/chrome-devtools/evaluate-perfor
mance/', Common.UIString('Learn\xa0more')); | 692 'https://developers.google.com/web/tools/chrome-devtools/evaluate-perfor
mance/', |
| 693 Common.UIString('Learn\xa0more')); |
| 691 var recordKey = | 694 var recordKey = |
| 692 encloseWithTag('b', UI.shortcutRegistry.shortcutDescriptorsForAction('ti
meline.toggle-recording')[0].name); | 695 encloseWithTag('b', UI.shortcutRegistry.shortcutDescriptorsForAction('ti
meline.toggle-recording')[0].name); |
| 693 var reloadKey = encloseWithTag('b', UI.shortcutRegistry.shortcutDescriptorsF
orAction('main.reload')[0].name); | 696 var reloadKey = encloseWithTag('b', UI.shortcutRegistry.shortcutDescriptorsF
orAction('main.reload')[0].name); |
| 694 var navigateNode = encloseWithTag('b', Common.UIString('WASD')); | 697 var navigateNode = encloseWithTag('b', Common.UIString('WASD')); |
| 695 | 698 |
| 696 this._landingPage = new UI.VBox(); | 699 this._landingPage = new UI.VBox(); |
| 697 this._landingPage.contentElement.classList.add('timeline-landing-page', 'fil
l'); | 700 this._landingPage.contentElement.classList.add('timeline-landing-page', 'fil
l'); |
| 698 var centered = this._landingPage.contentElement.createChild('div'); | 701 var centered = this._landingPage.contentElement.createChild('div'); |
| 699 | 702 |
| 700 var recordButton = UI.Toolbar.createActionButton(this._toggleRecordAction).e
lement; | 703 var recordButton = UI.Toolbar.createActionButton(this._toggleRecordAction).e
lement; |
| 701 var reloadButton = UI.Toolbar.createActionButtonForId('main.reload').element
; | 704 var reloadButton = UI.Toolbar.createActionButtonForId('main.reload').element
; |
| 702 | 705 |
| 703 centered.createChild('p').appendChild(UI.formatLocalized( | 706 centered.createChild('p').appendChild(UI.formatLocalized( |
| 704 'Click the record button %s or hit %s to capture a new recording.\n' + | 707 'Click the record button %s or hit %s to capture a new recording.\n' + |
| 705 'Click the reload button %s or hit %s to record and evaluate the page lo
ad.', | 708 'Click the reload button %s or hit %s to record and evaluate the pag
e load.', |
| 706 [recordButton, recordKey, reloadButton, reloadKey])); | 709 [recordButton, recordKey, reloadButton, reloadKey])); |
| 707 | 710 |
| 708 centered.createChild('p').appendChild(UI.formatLocalized( | 711 centered.createChild('p').appendChild(UI.formatLocalized( |
| 709 'After recording, select an area of interest in the overview by dragging
.\n' + | 712 'After recording, select an area of interest in the overview by dragging
.\n' + |
| 710 'Then, zoom and pan the timeline with the mousewheel or %s keys.\n%s', | 713 'Then, zoom and pan the timeline with the mousewheel or %s keys.\n%s
', |
| 711 [navigateNode, learnMoreNode])); | 714 [navigateNode, learnMoreNode])); |
| 712 | 715 |
| 713 var cpuProfilerHintSetting = Common.settings.createSetting('timelineShowProf
ilerHint', true); | 716 var cpuProfilerHintSetting = Common.settings.createSetting('timelineShowProf
ilerHint', true); |
| 714 if (cpuProfilerHintSetting.get()) { | 717 if (cpuProfilerHintSetting.get()) { |
| 715 var warning = centered.createChild('p', 'timeline-landing-warning'); | 718 var warning = centered.createChild('p', 'timeline-landing-warning'); |
| 716 var closeButton = warning.createChild('div', 'timeline-landing-warning-clo
se', 'dt-close-button'); | 719 var closeButton = warning.createChild('div', 'timeline-landing-warning-clo
se', 'dt-close-button'); |
| 717 closeButton.addEventListener('click', () => { | 720 closeButton.addEventListener('click', () => { |
| 718 warning.style.visibility = 'hidden'; | 721 warning.style.visibility = 'hidden'; |
| 719 cpuProfilerHintSetting.set(false); | 722 cpuProfilerHintSetting.set(false); |
| 720 }, false); | 723 }, false); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 } | 826 } |
| 824 this._overviewPane.setMarkers(markers); | 827 this._overviewPane.setMarkers(markers); |
| 825 } | 828 } |
| 826 | 829 |
| 827 /** | 830 /** |
| 828 * @param {!Common.Event} event | 831 * @param {!Common.Event} event |
| 829 */ | 832 */ |
| 830 _pageReloadRequested(event) { | 833 _pageReloadRequested(event) { |
| 831 if (this._state !== Timeline.TimelinePanel.State.Idle || !this.isShowing()) | 834 if (this._state !== Timeline.TimelinePanel.State.Idle || !this.isShowing()) |
| 832 return; | 835 return; |
| 833 this._startRecording(false); | 836 var resourceTreeModel = /** @type {!SDK.ResourceTreeModel} */ (event.data); |
| 837 resourceTreeModel.suspendReload(); |
| 838 this._startRecording(false).then(() => resourceTreeModel.resumeReload()); |
| 834 } | 839 } |
| 835 | 840 |
| 836 /** | 841 /** |
| 837 * @param {!Common.Event} event | 842 * @param {!Common.Event} event |
| 838 */ | 843 */ |
| 839 _loadEventFired(event) { | 844 _loadEventFired(event) { |
| 840 if (this._state !== Timeline.TimelinePanel.State.Recording || !this._autoRec
ordGeneration) | 845 if (this._state !== Timeline.TimelinePanel.State.Recording || !this._autoRec
ordGeneration) |
| 841 return; | 846 return; |
| 842 setTimeout(stopRecordingOnReload.bind(this, this._autoRecordGeneration), thi
s._millisecondsToRecordAfterLoadEvent); | 847 setTimeout(stopRecordingOnReload.bind(this, this._autoRecordGeneration), thi
s._millisecondsToRecordAfterLoadEvent); |
| 843 | 848 |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 return true; | 1343 return true; |
| 1339 case 'timeline.jump-to-next-frame': | 1344 case 'timeline.jump-to-next-frame': |
| 1340 panel._jumpToFrame(1); | 1345 panel._jumpToFrame(1); |
| 1341 return true; | 1346 return true; |
| 1342 } | 1347 } |
| 1343 return false; | 1348 return false; |
| 1344 } | 1349 } |
| 1345 }; | 1350 }; |
| 1346 | 1351 |
| 1347 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin
g'); | 1352 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin
g'); |
| OLD | NEW |