Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js

Issue 2637443004: DevTools: bring back old landing page in timeline/performance. (Closed)
Patch Set: review comments addressed Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 new TimelineModel.TimelineFrameModel(event => Timeline.TimelineUIUtils.e ventStyle(event).category.name); 69 new TimelineModel.TimelineFrameModel(event => Timeline.TimelineUIUtils.e ventStyle(event).category.name);
70 this._filmStripModel = new SDK.FilmStripModel(this._tracingModel); 70 this._filmStripModel = new SDK.FilmStripModel(this._tracingModel);
71 this._irModel = new TimelineModel.TimelineIRModel(); 71 this._irModel = new TimelineModel.TimelineIRModel();
72 /** @type {!Array<!{title: string, model: !SDK.TracingModel}>} */ 72 /** @type {!Array<!{title: string, model: !SDK.TracingModel}>} */
73 this._extensionTracingModels = []; 73 this._extensionTracingModels = [];
74 this._cpuThrottlingManager = new Components.CPUThrottlingManager(); 74 this._cpuThrottlingManager = new Components.CPUThrottlingManager();
75 75
76 /** @type {!Array<!Timeline.TimelineModeView>} */ 76 /** @type {!Array<!Timeline.TimelineModeView>} */
77 this._currentViews = []; 77 this._currentViews = [];
78 78
79 this._captureJSProfileSetting = Common.settings.createSetting('timelineEnabl eJSSampling', true); 79 this._disableCaptureJSProfileSetting = Common.settings.createSetting('timeli neDisableJSSampling', false);
80 this._captureLayersAndPicturesSetting = Common.settings.createSetting('timel ineCaptureLayersAndPictures', false); 80 this._captureLayersAndPicturesSetting = Common.settings.createSetting('timel ineCaptureLayersAndPictures', false);
81 this._captureFilmStripSetting = Common.settings.createSetting('timelineCaptu reFilmStrip', false);
82 81
83 this._showScreenshotsSetting = Common.settings.createLocalSetting('timelineS howScreenshots', false); 82 this._showScreenshotsSetting = Common.settings.createLocalSetting('timelineS howScreenshots', true);
84 this._showScreenshotsSetting.addChangeListener(this._onModeChanged, this); 83 this._showScreenshotsSetting.addChangeListener(this._onModeChanged, this);
85 this._showMemorySetting = Common.settings.createLocalSetting('timelineShowMe mory', false); 84 this._showMemorySetting = Common.settings.createLocalSetting('timelineShowMe mory', false);
86 this._showMemorySetting.addChangeListener(this._onModeChanged, this); 85 this._showMemorySetting.addChangeListener(this._onModeChanged, this);
87 86
88 this._panelToolbar = new UI.Toolbar('', this.element); 87 this._panelToolbar = new UI.Toolbar('', this.element);
88 this._createSettingsPane();
89 this._updateShowSettingsToolbarButton();
89 90
90 this._timelinePane = new UI.VBox(); 91 this._timelinePane = new UI.VBox();
91 this._timelinePane.show(this.element); 92 this._timelinePane.show(this.element);
92 var topPaneElement = this._timelinePane.element.createChild('div', 'hbox'); 93 var topPaneElement = this._timelinePane.element.createChild('div', 'hbox');
93 topPaneElement.id = 'timeline-overview-panel'; 94 topPaneElement.id = 'timeline-overview-panel';
94 95
95 // Create top overview component. 96 // Create top overview component.
96 this._overviewPane = new PerfUI.TimelineOverviewPane('timeline'); 97 this._overviewPane = new PerfUI.TimelineOverviewPane('timeline');
97 this._overviewPane.addEventListener( 98 this._overviewPane.addEventListener(
98 PerfUI.TimelineOverviewPane.Events.WindowChanged, this._onWindowChanged. bind(this)); 99 PerfUI.TimelineOverviewPane.Events.WindowChanged, this._onWindowChanged. bind(this));
99 this._overviewPane.show(topPaneElement); 100 this._overviewPane.show(topPaneElement);
100 this._statusPaneContainer = this._timelinePane.element.createChild('div', 's tatus-pane-container fill'); 101 this._statusPaneContainer = this._timelinePane.element.createChild('div', 's tatus-pane-container fill');
101 102
102 this._createFileSelector(); 103 this._createFileSelector();
103 104
104 SDK.targetManager.addEventListener(SDK.TargetManager.Events.PageReloadReques ted, this._pageReloadRequested, this); 105 SDK.targetManager.addEventListener(SDK.TargetManager.Events.PageReloadReques ted, this._pageReloadRequested, this);
105 SDK.targetManager.addEventListener(SDK.TargetManager.Events.Load, this._load EventFired, this); 106 SDK.targetManager.addEventListener(SDK.TargetManager.Events.Load, this._load EventFired, this);
106 107
107 this._landingPage = new Timeline.TimelineLandingPage();
108
109 // Create top level properties splitter. 108 // Create top level properties splitter.
110 this._detailsSplitWidget = new UI.SplitWidget(false, true, 'timelinePanelDet ailsSplitViewState'); 109 this._detailsSplitWidget = new UI.SplitWidget(false, true, 'timelinePanelDet ailsSplitViewState');
111 this._detailsSplitWidget.element.classList.add('timeline-details-split'); 110 this._detailsSplitWidget.element.classList.add('timeline-details-split');
112 this._detailsView = new Timeline.TimelineDetailsView(this._model, this._filt ers, this); 111 this._detailsView = new Timeline.TimelineDetailsView(this._model, this._filt ers, this);
113 this._detailsSplitWidget.installResizer(this._detailsView.headerElement()); 112 this._detailsSplitWidget.installResizer(this._detailsView.headerElement());
114 this._detailsSplitWidget.setSidebarWidget(this._detailsView); 113 this._detailsSplitWidget.setSidebarWidget(this._detailsView);
115 114
116 this._searchableView = new UI.SearchableView(this); 115 this._searchableView = new UI.SearchableView(this);
117 this._searchableView.setMinimumSize(0, 100); 116 this._searchableView.setMinimumSize(0, 100);
118 this._searchableView.element.classList.add('searchable-view'); 117 this._searchableView.element.classList.add('searchable-view');
119 this._detailsSplitWidget.setMainWidget(this._searchableView); 118 this._detailsSplitWidget.setMainWidget(this._searchableView);
120 119
121 this._stackView = new UI.StackView(false); 120 this._stackView = new UI.StackView(false);
122 this._stackView.element.classList.add('timeline-view-stack'); 121 this._stackView.element.classList.add('timeline-view-stack');
123 122
124 this._stackView.show(this._searchableView.element); 123 this._stackView.show(this._searchableView.element);
125 this._onModeChanged(); 124 this._onModeChanged();
126 125
127 this._configureThrottlingSetting = Common.settings.createSetting('timelineCo nfigureThrottling', false); 126 this._populateToolbar();
128 this._configureThrottlingButton = new UI.ToolbarSettingToggle(
129 this._configureThrottlingSetting, 'largeicon-settings-gear', Common.UISt ring('Configure throttling'));
130 SDK.multitargetNetworkManager.addEventListener(
131 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._updateConf igureThrottlingButton.bind(this));
132 this._cpuThrottlingManager.addEventListener(
133 Components.CPUThrottlingManager.Events.RateChanged, this._updateConfigur eThrottlingButton.bind(this));
134 this._throttlingToolbar = new UI.Toolbar('', this.element);
135 this._throttlingToolbar.appendText(Common.UIString('Network:'));
136 this._throttlingToolbar.appendToolbarItem(this._createNetworkConditionsSelec t());
137 this._throttlingToolbar.appendSeparator();
138 this._throttlingToolbar.appendText(Common.UIString('CPU:'));
139 this._throttlingToolbar.appendToolbarItem(this._cpuThrottlingManager.createC ontrol());
140 this._throttlingToolbar.appendToolbarItem(new UI.ToolbarSeparator(true));
141 var hideToolbarItem = new UI.ToolbarButton(Common.UIString('Close'), 'largei con-delete');
142 hideToolbarItem.addEventListener(UI.ToolbarButton.Events.Click, () => this._ configureThrottlingSetting.set(false));
143 this._throttlingToolbar.appendToolbarItem(hideToolbarItem);
144 this._configureThrottlingSetting.addChangeListener(this._updateThrottlingToo lbarVisibility.bind(this));
145 this._updateThrottlingToolbarVisibility();
146
147 this._showLandingPage(); 127 this._showLandingPage();
148 this._recreateToolbarItems();
149 128
150 Extensions.extensionServer.addEventListener( 129 Extensions.extensionServer.addEventListener(
151 Extensions.ExtensionServer.Events.TraceProviderAdded, this._recreateTool barItems, this); 130 Extensions.ExtensionServer.Events.TraceProviderAdded, this._appendExtens ionsToToolbar, this);
152
153 this._captureFilmStripSetting.addChangeListener(this._onModeChanged, this);
154 131
155 this._detailsSplitWidget.show(this._timelinePane.element); 132 this._detailsSplitWidget.show(this._timelinePane.element);
156 this._detailsSplitWidget.hideSidebar(); 133 this._detailsSplitWidget.hideSidebar();
157 SDK.targetManager.addEventListener(SDK.TargetManager.Events.SuspendStateChan ged, this._onSuspendStateChanged, this); 134 SDK.targetManager.addEventListener(SDK.TargetManager.Events.SuspendStateChan ged, this._onSuspendStateChanged, this);
158 135
159 /** @type {!SDK.TracingModel.Event}|undefined */ 136 /** @type {!SDK.TracingModel.Event}|undefined */
160 this._selectedSearchResult; 137 this._selectedSearchResult;
161 /** @type {!Array<!SDK.TracingModel.Event>}|undefined */ 138 /** @type {!Array<!SDK.TracingModel.Event>}|undefined */
162 this._searchResults; 139 this._searchResults;
163 /** @type {?symbol} */ 140 /** @type {?symbol} */
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 * @param {!Common.Setting} setting 273 * @param {!Common.Setting} setting
297 * @param {string} tooltip 274 * @param {string} tooltip
298 * @return {!UI.ToolbarItem} 275 * @return {!UI.ToolbarItem}
299 */ 276 */
300 _createSettingCheckbox(name, setting, tooltip) { 277 _createSettingCheckbox(name, setting, tooltip) {
301 const checkboxItem = new UI.ToolbarCheckbox(name, tooltip, setting); 278 const checkboxItem = new UI.ToolbarCheckbox(name, tooltip, setting);
302 this._recordingOptionUIControls.push(checkboxItem); 279 this._recordingOptionUIControls.push(checkboxItem);
303 return checkboxItem; 280 return checkboxItem;
304 } 281 }
305 282
306 _recreateToolbarItems() { 283 _populateToolbar() {
307 this._panelToolbar.removeToolbarItems();
308
309 // Close
310 if (!this._model.isEmpty()) {
311 const clearButton = new UI.ToolbarButton(Common.UIString('Close profile'), 'largeicon-delete');
312 clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, t his);
313 this._panelToolbar.appendToolbarItem(clearButton);
314 this._panelToolbar.appendSeparator();
315 }
316
317 // Record 284 // Record
318 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog gleRecordAction)); 285 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._tog gleRecordAction));
319 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('mai n.reload')); 286 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('mai n.reload'));
287 var clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeicon- clear');
288 clearButton.addEventListener(UI.ToolbarButton.Events.Click, () => this._clea r());
289 this._panelToolbar.appendToolbarItem(clearButton);
320 this._panelToolbar.appendSeparator(); 290 this._panelToolbar.appendSeparator();
321 this._panelToolbar.appendToolbarItem(this._configureThrottlingButton); 291
292 // View
293 this._panelToolbar.appendSeparator();
294 this._showScreenshotsToolbarCheckbox = this._createSettingCheckbox(
295 Common.UIString('Screenshots'), this._showScreenshotsSetting, Common.UIS tring('Capture screenshots'));
296 this._panelToolbar.appendToolbarItem(this._showScreenshotsToolbarCheckbox);
297
298 this._showMemoryToolbarCheckbox = this._createSettingCheckbox(
299 Common.UIString('Memory'), this._showMemorySetting, Common.UIString('Sho w memory timeline.'));
300 this._panelToolbar.appendToolbarItem(this._showMemoryToolbarCheckbox);
301
302 // Settings
303 this._panelToolbar.appendToolbarItem(this._showSettingsPaneButton);
304
305 // GC
322 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com ponents.collect-garbage')); 306 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com ponents.collect-garbage'));
307 }
323 308
324 // Checkboxes 309 _createSettingsPane() {
325 if (!this._model.isEmpty()) { 310 this._showSettingsPaneSetting = Common.settings.createSetting('timelineShowS ettingsToolbar', false);
326 this._panelToolbar.appendSeparator(); 311 this._showSettingsPaneButton = new UI.ToolbarSettingToggle(
327 this._panelToolbar.appendText(Common.UIString('View:')); 312 this._showSettingsPaneSetting, 'largeicon-settings-gear', Common.UIStrin g('Capture settings'));
328 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 313 SDK.multitargetNetworkManager.addEventListener(
329 Common.UIString('Memory'), this._showMemorySetting, Common.UIString('S how memory timeline.'))); 314 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._updateShow SettingsToolbarButton, this);
330 if (this._filmStripModel.frames().length) { 315 this._cpuThrottlingManager.addEventListener(
331 this._showScreenshotsSetting.set(true); 316 Components.CPUThrottlingManager.Events.RateChanged, this._updateShowSett ingsToolbarButton, this);
332 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 317 this._disableCaptureJSProfileSetting.addChangeListener(this._updateShowSetti ngsToolbarButton, this);
333 Common.UIString('Screenshots'), this._showScreenshotsSetting, 318 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this);
334 Common.UIString('Show captured screenshots.')));
335 }
336 }
337 319
338 const traceProviders = Extensions.extensionServer.traceProviders(); 320 this._settingsPane = new UI.HBox();
339 if (traceProviders.length) { 321 this._settingsPane.element.classList.add('timeline-settings-pane');
340 this._panelToolbar.appendSeparator(); 322 this._settingsPane.show(this.element);
341 for (let provider of traceProviders) {
342 const setting = Timeline.TimelinePanel._settingForTraceProvider(provider );
343 const checkbox = this._createSettingCheckbox(provider.shortDisplayName() , setting, provider.longDisplayName());
344 this._panelToolbar.appendToolbarItem(checkbox);
345 }
346 }
347 323
348 this._updateTimelineControls(); 324 var captureToolbar = new UI.Toolbar('', this._settingsPane.element);
325 captureToolbar.element.classList.add('flex-auto');
326 captureToolbar.makeVertical();
327 captureToolbar.appendToolbarItem(this._createSettingCheckbox(
328 Common.UIString('Disable JavaScript Samples'), this._disableCaptureJSPro fileSetting,
329 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices')));
330 captureToolbar.appendToolbarItem(this._createSettingCheckbox(
331 Common.UIString('Enable advanced paint instrumentation (slow)'), this._c aptureLayersAndPicturesSetting,
332 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead')));
333
334 var throttlingPane = new UI.VBox();
335 throttlingPane.element.classList.add('flex-auto');
336 throttlingPane.show(this._settingsPane.element);
337
338 var throttlingToolbar1 = new UI.Toolbar('', throttlingPane.element);
339 throttlingToolbar1.appendText(Common.UIString('Network:'));
340 throttlingToolbar1.appendToolbarItem(this._createNetworkConditionsSelect());
341 var throttlingToolbar2 = new UI.Toolbar('', throttlingPane.element);
342 throttlingToolbar2.appendText(Common.UIString('CPU:'));
343 throttlingToolbar2.appendToolbarItem(this._cpuThrottlingManager.createContro l());
344
345 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this));
346 this._updateSettingsPaneVisibility();
349 } 347 }
350 348
351 /** 349 /**
350 * @param {!Common.Event} event
351 */
352 _appendExtensionsToToolbar(event) {
353 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data );
354 const setting = Timeline.TimelinePanel._settingForTraceProvider(provider);
355 const checkbox = this._createSettingCheckbox(provider.shortDisplayName(), se tting, provider.longDisplayName());
356 this._panelToolbar.appendToolbarItem(checkbox);
357 }
358
359 /**
352 * @param {!Extensions.ExtensionTraceProvider} traceProvider 360 * @param {!Extensions.ExtensionTraceProvider} traceProvider
353 * @return {!Common.Setting<boolean>} 361 * @return {!Common.Setting<boolean>}
354 */ 362 */
355 static _settingForTraceProvider(traceProvider) { 363 static _settingForTraceProvider(traceProvider) {
356 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb ol]; 364 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb ol];
357 if (!setting) { 365 if (!setting) {
358 var providerId = traceProvider.persistentIdentifier(); 366 var providerId = traceProvider.persistentIdentifier();
359 setting = Common.settings.createSetting(providerId, false); 367 setting = Common.settings.createSetting(providerId, false);
360 traceProvider[Timeline.TimelinePanel._traceProviderSettingSymbol] = settin g; 368 traceProvider[Timeline.TimelinePanel._traceProviderSettingSymbol] = settin g;
361 } 369 }
(...skipping 12 matching lines...) Expand all
374 382
375 _prepareToLoadTimeline() { 383 _prepareToLoadTimeline() {
376 console.assert(this._state === Timeline.TimelinePanel.State.Idle); 384 console.assert(this._state === Timeline.TimelinePanel.State.Idle);
377 this._setState(Timeline.TimelinePanel.State.Loading); 385 this._setState(Timeline.TimelinePanel.State.Loading);
378 } 386 }
379 387
380 _createFileSelector() { 388 _createFileSelector() {
381 if (this._fileSelectorElement) 389 if (this._fileSelectorElement)
382 this._fileSelectorElement.remove(); 390 this._fileSelectorElement.remove();
383 this._fileSelectorElement = UI.createFileSelectorElement(this._loadFromFile. bind(this)); 391 this._fileSelectorElement = UI.createFileSelectorElement(this._loadFromFile. bind(this));
384 this.element.appendChild(this._fileSelectorElement); 392 this._timelinePane.element.appendChild(this._fileSelectorElement);
385 } 393 }
386 394
387 /** 395 /**
388 * @param {!Event} event 396 * @param {!Event} event
389 */ 397 */
390 _contextMenu(event) { 398 _contextMenu(event) {
391 var contextMenu = new UI.ContextMenu(event); 399 var contextMenu = new UI.ContextMenu(event);
392 contextMenu.appendItemsAtLocation('timelineMenu'); 400 contextMenu.appendItemsAtLocation('timelineMenu');
393 contextMenu.show(); 401 contextMenu.show();
394 } 402 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 this._loader = Timeline.TimelineLoader.loadFromURL(this._tracingModel, url, this); 457 this._loader = Timeline.TimelineLoader.loadFromURL(this._tracingModel, url, this);
450 } 458 }
451 459
452 _refreshViews() { 460 _refreshViews() {
453 this._currentViews.forEach(view => view.refreshRecords()); 461 this._currentViews.forEach(view => view.refreshRecords());
454 this._updateSelectionDetails(); 462 this._updateSelectionDetails();
455 } 463 }
456 464
457 _onModeChanged() { 465 _onModeChanged() {
458 const showMemory = this._showMemorySetting.get(); 466 const showMemory = this._showMemorySetting.get();
459 const showScreenshots = this._showScreenshotsSetting.get() && this._filmStri pModel.frames().length; 467 const showScreenshots = this._showScreenshotsSetting.get();
460 // Set up overview controls. 468 // Set up overview controls.
461 this._overviewControls = []; 469 this._overviewControls = [];
462 this._overviewControls.push(new Timeline.TimelineEventOverviewResponsiveness (this._model, this._frameModel)); 470 this._overviewControls.push(new Timeline.TimelineEventOverviewResponsiveness (this._model, this._frameModel));
463 if (Runtime.experiments.isEnabled('inputEventsOnTimelineOverview')) 471 if (Runtime.experiments.isEnabled('inputEventsOnTimelineOverview'))
464 this._overviewControls.push(new Timeline.TimelineEventOverviewInput(this._ model)); 472 this._overviewControls.push(new Timeline.TimelineEventOverviewInput(this._ model));
465 this._overviewControls.push(new Timeline.TimelineEventOverviewFrames(this._m odel, this._frameModel)); 473 this._overviewControls.push(new Timeline.TimelineEventOverviewFrames(this._m odel, this._frameModel));
466 this._overviewControls.push(new Timeline.TimelineEventOverviewCPUActivity(th is._model)); 474 this._overviewControls.push(new Timeline.TimelineEventOverviewCPUActivity(th is._model));
467 this._overviewControls.push(new Timeline.TimelineEventOverviewNetwork(this._ model)); 475 this._overviewControls.push(new Timeline.TimelineEventOverviewNetwork(this._ model));
468 if (showScreenshots) 476 if (showScreenshots)
469 this._overviewControls.push(new Timeline.TimelineFilmStripOverview(this._m odel, this._filmStripModel)); 477 this._overviewControls.push(new Timeline.TimelineFilmStripOverview(this._m odel, this._filmStripModel));
470 if (showMemory) 478 if (showMemory)
471 this._overviewControls.push(new Timeline.TimelineEventOverviewMemory(this. _model)); 479 this._overviewControls.push(new Timeline.TimelineEventOverviewMemory(this. _model));
472 this._overviewPane.setOverviewControls(this._overviewControls); 480 this._overviewPane.setOverviewControls(this._overviewControls);
473 481
474 // Set up the main view. 482 // Set up the main view.
475 this._removeAllModeViews(); 483 this._removeAllModeViews();
476 this._flameChart = new Timeline.TimelineFlameChartView( 484 this._flameChart = new Timeline.TimelineFlameChartView(
477 this, this._model, this._frameModel, this._irModel, this._extensionTraci ngModels, this._filters); 485 this, this._model, this._frameModel, this._irModel, this._extensionTraci ngModels, this._filters);
478 this._addModeView(this._flameChart); 486 this._addModeView(this._flameChart);
479 487
480 if (showMemory) { 488 if (showMemory) {
481 this._addModeView( 489 this._addModeView(
482 new Timeline.MemoryCountersGraph(this, this._model, [Timeline.Timeline UIUtils.visibleEventsFilter()])); 490 new Timeline.MemoryCountersGraph(this, this._model, [Timeline.Timeline UIUtils.visibleEventsFilter()]));
483 } 491 }
484 492
485 this.doResize(); 493 this.doResize();
486 this.select(null); 494 this.select(null);
487 } 495 }
488 496
489 _updateThrottlingToolbarVisibility() { 497 _updateSettingsPaneVisibility() {
490 this._throttlingToolbar.element.classList.toggle('hidden', !this._configureT hrottlingSetting.get()); 498 if (this._showSettingsPaneSetting.get())
499 this._settingsPane.showWidget();
500 else
501 this._settingsPane.hideWidget();
491 } 502 }
492 503
493 _updateConfigureThrottlingButton() { 504 _updateShowSettingsToolbarButton() {
494 var makeRed = this._cpuThrottlingManager.rate() !== 1 || SDK.multitargetNetw orkManager.isThrottling(); 505 var messages = [];
495 this._configureThrottlingButton.setDefaultWithRedColor(makeRed); 506 if (this._cpuThrottlingManager.rate() !== 1)
496 this._configureThrottlingButton.setToggleWithRedColor(makeRed); 507 messages.push(Common.UIString('- CPU throttling is enabled'));
508 if (SDK.multitargetNetworkManager.isThrottling())
509 messages.push(Common.UIString('- Network throttling is enabled'));
510 if (this._captureLayersAndPicturesSetting.get())
511 messages.push(Common.UIString('- Significant overhead due to paint instrum entation'));
512 if (this._disableCaptureJSProfileSetting.get())
513 messages.push(Common.UIString('- JavaScript sampling is disabled'));
514
515 this._showSettingsPaneButton.setDefaultWithRedColor(messages.length);
516 this._showSettingsPaneButton.setToggleWithRedColor(messages.length);
517
518 if (messages.length) {
519 var tooltipElement = createElement('div');
520 messages.forEach(message => {
521 tooltipElement.createChild('div').textContent = message;
522 });
523 this._showSettingsPaneButton.setTitle(tooltipElement);
524 } else {
525 this._showSettingsPaneButton.setTitle(Common.UIString('Capture settings')) ;
526 }
497 } 527 }
498 528
499 /** 529 /**
500 * @param {boolean} enabled 530 * @param {boolean} enabled
501 */ 531 */
502 _setUIControlsEnabled(enabled) { 532 _setUIControlsEnabled(enabled) {
503 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable d)); 533 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable d));
504 } 534 }
505 535
506 /** 536 /**
507 * @param {boolean} userInitiated 537 * @param {boolean} userInitiated
508 */ 538 */
509 _startRecording(userInitiated) { 539 _startRecording(userInitiated) {
510 console.assert(!this._statusPane, 'Status pane is already opened.'); 540 console.assert(!this._statusPane, 'Status pane is already opened.');
511 var mainTarget = SDK.targetManager.mainTarget(); 541 var mainTarget = SDK.targetManager.mainTarget();
512 if (!mainTarget) 542 if (!mainTarget)
513 return; 543 return;
514 this._setState(Timeline.TimelinePanel.State.StartPending); 544 this._setState(Timeline.TimelinePanel.State.StartPending);
515 this._showRecordingStarted(); 545 this._showRecordingStarted();
516 546
517 this._sessionGeneration = Symbol('timelineSessionGeneration'); 547 this._sessionGeneration = Symbol('timelineSessionGeneration');
518 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); 548 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation');
519 var enabledTraceProviders = Extensions.extensionServer.traceProviders().filt er( 549 var enabledTraceProviders = Extensions.extensionServer.traceProviders().filt er(
520 provider => Timeline.TimelinePanel._settingForTraceProvider(provider).ge t()); 550 provider => Timeline.TimelinePanel._settingForTraceProvider(provider).ge t());
521 551
522 const recordingOptions = this._landingPage.recordingOptions(); 552 const recordingOptions = {
553 enableJSSampling: !this._disableCaptureJSProfileSetting.get(),
554 capturePictures: this._captureLayersAndPicturesSetting.get(),
555 captureFilmStrip: this._showScreenshotsSetting.get()
556 };
557
523 this._controller = new Timeline.TimelineController(mainTarget, this, this._t racingModel); 558 this._controller = new Timeline.TimelineController(mainTarget, this, this._t racingModel);
524 this._controller.startRecording(recordingOptions, enabledTraceProviders); 559 this._controller.startRecording(recordingOptions, enabledTraceProviders);
525 this._recordingStartTime = Date.now(); 560 this._recordingStartTime = Date.now();
526 561
527 for (var i = 0; i < this._overviewControls.length; ++i) 562 for (var i = 0; i < this._overviewControls.length; ++i)
528 this._overviewControls[i].timelineStarted(); 563 this._overviewControls[i].timelineStarted();
529 564
530 Host.userMetrics.actionTaken( 565 Host.userMetrics.actionTaken(
531 userInitiated ? Host.UserMetrics.Action.TimelineStarted : Host.UserMetri cs.Action.TimelinePageReloadStarted); 566 userInitiated ? Host.UserMetrics.Action.TimelineStarted : Host.UserMetri cs.Action.TimelinePageReloadStarted);
532 this._setUIControlsEnabled(false); 567 this._setUIControlsEnabled(false);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 else if (this._state === Timeline.TimelinePanel.State.Recording) 599 else if (this._state === Timeline.TimelinePanel.State.Recording)
565 this._stopRecording(); 600 this._stopRecording();
566 } 601 }
567 602
568 _clear() { 603 _clear() {
569 this._showLandingPage(); 604 this._showLandingPage();
570 this._detailsSplitWidget.hideSidebar(); 605 this._detailsSplitWidget.hideSidebar();
571 this._sessionGeneration = null; 606 this._sessionGeneration = null;
572 this._recordingStartTime = 0; 607 this._recordingStartTime = 0;
573 this._reset(); 608 this._reset();
574 this._recreateToolbarItems();
575 } 609 }
576 610
577 _reset() { 611 _reset() {
578 PerfUI.LineLevelProfile.instance().reset(); 612 PerfUI.LineLevelProfile.instance().reset();
579 this._tracingModel.reset(); 613 this._tracingModel.reset();
580 this._model.reset(); 614 this._model.reset();
581 for (let extensionEntry of this._extensionTracingModels) 615 for (let extensionEntry of this._extensionTracingModels)
582 extensionEntry.model.reset(); 616 extensionEntry.model.reset();
583 this._extensionTracingModels.splice(0); 617 this._extensionTracingModels.splice(0);
584 618
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 664
631 /** 665 /**
632 * @override 666 * @override
633 * @return {?symbol} 667 * @return {?symbol}
634 */ 668 */
635 sessionGeneration() { 669 sessionGeneration() {
636 return this._sessionGeneration; 670 return this._sessionGeneration;
637 } 671 }
638 672
639 _showLandingPage() { 673 _showLandingPage() {
640 this._timelinePane.detach(); 674 if (this._landingPage) {
641 this._landingPage.show(this.element); 675 this._landingPage.show(this._statusPaneContainer);
676 return;
677 }
678
679 /**
680 * @param {string} tagName
681 * @param {string} contents
682 */
683 function encloseWithTag(tagName, contents) {
684 var e = createElement(tagName);
685 e.textContent = contents;
686 return e;
687 }
688
689 var learnMoreNode = UI.createExternalLink(
690 'https://developers.google.com/web/tools/chrome-devtools/evaluate-perfor mance/', Common.UIString('Learn more'));
691 var recordNode =
692 encloseWithTag('b', UI.shortcutRegistry.shortcutDescriptorsForAction('ti meline.toggle-recording')[0].name);
693 var reloadNode = encloseWithTag('b', UI.shortcutRegistry.shortcutDescriptors ForAction('main.reload')[0].name);
694 var navigateNode = encloseWithTag('b', Common.UIString('WASD'));
695
696 this._landingPage = new UI.VBox();
697 this._landingPage.contentElement.classList.add('timeline-landing-page', 'fil l');
698 var centered = this._landingPage.contentElement.createChild('div');
699
700 var p = centered.createChild('p');
701 p.createTextChild(Common.UIString(
702 'The Performance panel lets you record what the browser does during page load and user interaction. The timeline it generates can help you determine why certain parts of your page are slow.'));
703
704 p = centered.createChild('p');
705 p.appendChild(UI.formatLocalized(
706 'To capture a new recording, click the record toolbar button or hit %s. To evaluate page load performance, hit %s to record the reload.',
707 [recordNode, reloadNode]));
708
709 p = centered.createChild('p');
710 p.appendChild(UI.formatLocalized(
711 'After recording, select an area of interest in the overview by dragging . Then, zoom and pan the timeline with the mousewheel or %s keys.',
712 [navigateNode]));
713
714 p = centered.createChild('p');
715 p.appendChild(learnMoreNode);
716
717 this._landingPage.show(this._statusPaneContainer);
642 } 718 }
643 719
644 _hideLandingPage() { 720 _hideLandingPage() {
645 this._landingPage.detach(); 721 this._landingPage.detach();
646 this._timelinePane.show(this.element);
647 } 722 }
648 723
649 /** 724 /**
650 * @override 725 * @override
651 */ 726 */
652 loadingStarted() { 727 loadingStarted() {
653 this._hideLandingPage(); 728 this._hideLandingPage();
654 729
655 if (this._statusPane) 730 if (this._statusPane)
656 this._statusPane.hide(); 731 this._statusPane.hide();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 var asyncEventsByGroup = this._model.mainThreadAsyncEvents(); 774 var asyncEventsByGroup = this._model.mainThreadAsyncEvents();
700 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEventsByGr oup.get(groups.animation)); 775 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEventsByGr oup.get(groups.animation));
701 this._model.cpuProfiles().forEach(profile => PerfUI.LineLevelProfile.instanc e().appendCPUProfile(profile)); 776 this._model.cpuProfiles().forEach(profile => PerfUI.LineLevelProfile.instanc e().appendCPUProfile(profile));
702 if (this._statusPane) 777 if (this._statusPane)
703 this._statusPane.hide(); 778 this._statusPane.hide();
704 delete this._statusPane; 779 delete this._statusPane;
705 780
706 for (let entry of this._extensionTracingModels) 781 for (let entry of this._extensionTracingModels)
707 entry.model.adjustTime(this._model.minimumRecordTime() + (entry.timeOffset / 1000) - this._recordingStartTime); 782 entry.model.adjustTime(this._model.minimumRecordTime() + (entry.timeOffset / 1000) - this._recordingStartTime);
708 783
709 this._recreateToolbarItems();
710 this._flameChart.resizeToPreferredHeights(); 784 this._flameChart.resizeToPreferredHeights();
711 this._overviewPane.reset(); 785 this._overviewPane.reset();
712 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._model.ma ximumRecordTime()); 786 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._model.ma ximumRecordTime());
713 this._setAutoWindowTimes(); 787 this._setAutoWindowTimes();
714 this._refreshViews(); 788 this._refreshViews();
715 for (var i = 0; i < this._overviewControls.length; ++i) 789 for (var i = 0; i < this._overviewControls.length; ++i)
716 this._overviewControls[i].timelineStopped(); 790 this._overviewControls[i].timelineStopped();
717 this._setMarkers(); 791 this._setMarkers();
718 this._overviewPane.scheduleUpdate(); 792 this._overviewPane.scheduleUpdate();
719 this._updateSearchHighlight(false, true); 793 this._updateSearchHighlight(false, true);
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 }; 1918 };
1845 1919
1846 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g'); 1920 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g');
1847 1921
1848 /** @enum {symbol} */ 1922 /** @enum {symbol} */
1849 Timeline.TimelineFilters.Events = { 1923 Timeline.TimelineFilters.Events = {
1850 FilterChanged: Symbol('FilterChanged') 1924 FilterChanged: Symbol('FilterChanged')
1851 }; 1925 };
1852 1926
1853 Timeline.TimelineFilters._durationFilterPresetsMs = [0, 1, 15]; 1927 Timeline.TimelineFilters._durationFilterPresetsMs = [0, 1, 15];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698