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

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: 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('Show captured screenshots.'));
alph 2017/01/14 02:33:51 Capture/Show 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 // Throttling
alph 2017/01/14 02:33:51 remove
303 this._panelToolbar.appendSeparator();
304
305 // Settings
306 this._panelToolbar.appendToolbarItem(this._showSettingsPaneButton);
307
308 // GC
322 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com ponents.collect-garbage')); 309 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('com ponents.collect-garbage'));
310 }
323 311
324 // Checkboxes 312 _createSettingsPane() {
325 if (!this._model.isEmpty()) { 313 this._showSettingsPaneSetting = Common.settings.createSetting('timelineShowS ettingsToolbar', false);
326 this._panelToolbar.appendSeparator(); 314 this._showSettingsPaneButton = new UI.ToolbarSettingToggle(
327 this._panelToolbar.appendText(Common.UIString('View:')); 315 this._showSettingsPaneSetting, 'largeicon-settings-gear', Common.UIStrin g('Capture settings'));
328 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 316 SDK.multitargetNetworkManager.addEventListener(
329 Common.UIString('Memory'), this._showMemorySetting, Common.UIString('S how memory timeline.'))); 317 SDK.MultitargetNetworkManager.Events.ConditionsChanged, this._updateShow SettingsToolbarButton, this);
330 if (this._filmStripModel.frames().length) { 318 this._cpuThrottlingManager.addEventListener(
331 this._showScreenshotsSetting.set(true); 319 Components.CPUThrottlingManager.Events.RateChanged, this._updateShowSett ingsToolbarButton, this);
332 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 320 this._disableCaptureJSProfileSetting.addChangeListener(this._updateShowSetti ngsToolbarButton, this);
333 Common.UIString('Screenshots'), this._showScreenshotsSetting, 321 this._captureLayersAndPicturesSetting.addChangeListener(this._updateShowSett ingsToolbarButton, this);
334 Common.UIString('Show captured screenshots.')));
335 }
336 }
337 322
338 const traceProviders = Extensions.extensionServer.traceProviders(); 323 this._settingsPane = new UI.HBox();
339 if (traceProviders.length) { 324 this._settingsPane.element.classList.add('timeline-settings-pane');
340 this._panelToolbar.appendSeparator(); 325 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 326
348 this._updateTimelineControls(); 327 var captureToolbar = new UI.Toolbar('', this._settingsPane.element);
328 captureToolbar.element.classList.add('flex-auto');
329 captureToolbar.makeVertical();
330 captureToolbar.appendToolbarItem(this._createSettingCheckbox(
331 Common.UIString('Disable JavaScript Samples'), this._disableCaptureJSPro fileSetting,
332 Common.UIString('Disables JavaScript sampling, reduces overhead when run ning against mobile devices')));
alph 2017/01/14 02:33:51 add .
333 captureToolbar.appendToolbarItem(this._createSettingCheckbox(
334 Common.UIString('Enable advanced paint instrumentation (slow)'), this._c aptureLayersAndPicturesSetting,
335 Common.UIString('Captures advanced paint instrumentation, introduces sig nificant performance overhead.')));
336
337 var throttlingPane = new UI.VBox();
338 throttlingPane.element.classList.add('flex-auto');
339 throttlingPane.show(this._settingsPane.element);
340
341 var throttlingToolbar1 = new UI.Toolbar('', throttlingPane.element);
342 throttlingToolbar1.appendText(Common.UIString('Network:'));
343 throttlingToolbar1.appendToolbarItem(this._createNetworkConditionsSelect());
344 var throttlingToolbar2 = new UI.Toolbar('', throttlingPane.element);
345 throttlingToolbar2.appendText(Common.UIString('CPU:'));
346 throttlingToolbar2.appendToolbarItem(this._cpuThrottlingManager.createContro l());
347
348 this._showSettingsPaneSetting.addChangeListener(this._updateSettingsPaneVisi bility.bind(this));
349 this._updateSettingsPaneVisibility();
349 } 350 }
350 351
351 /** 352 /**
353 * @param {!Common.Event} event
354 */
355 _appendExtensionsToToolbar(event) {
356 var provider = /** @type {!Extensions.ExtensionTraceProvider} */ (event.data );
357 const setting = Timeline.TimelinePanel._settingForTraceProvider(provider);
358 const checkbox = this._createSettingCheckbox(provider.shortDisplayName(), se tting, provider.longDisplayName());
359 this._panelToolbar.appendToolbarItem(checkbox);
360 }
361
362 /**
352 * @param {!Extensions.ExtensionTraceProvider} traceProvider 363 * @param {!Extensions.ExtensionTraceProvider} traceProvider
353 * @return {!Common.Setting<boolean>} 364 * @return {!Common.Setting<boolean>}
354 */ 365 */
355 static _settingForTraceProvider(traceProvider) { 366 static _settingForTraceProvider(traceProvider) {
356 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb ol]; 367 var setting = traceProvider[Timeline.TimelinePanel._traceProviderSettingSymb ol];
357 if (!setting) { 368 if (!setting) {
358 var providerId = traceProvider.persistentIdentifier(); 369 var providerId = traceProvider.persistentIdentifier();
359 setting = Common.settings.createSetting(providerId, false); 370 setting = Common.settings.createSetting(providerId, false);
360 traceProvider[Timeline.TimelinePanel._traceProviderSettingSymbol] = settin g; 371 traceProvider[Timeline.TimelinePanel._traceProviderSettingSymbol] = settin g;
361 } 372 }
(...skipping 12 matching lines...) Expand all
374 385
375 _prepareToLoadTimeline() { 386 _prepareToLoadTimeline() {
376 console.assert(this._state === Timeline.TimelinePanel.State.Idle); 387 console.assert(this._state === Timeline.TimelinePanel.State.Idle);
377 this._setState(Timeline.TimelinePanel.State.Loading); 388 this._setState(Timeline.TimelinePanel.State.Loading);
378 } 389 }
379 390
380 _createFileSelector() { 391 _createFileSelector() {
381 if (this._fileSelectorElement) 392 if (this._fileSelectorElement)
382 this._fileSelectorElement.remove(); 393 this._fileSelectorElement.remove();
383 this._fileSelectorElement = UI.createFileSelectorElement(this._loadFromFile. bind(this)); 394 this._fileSelectorElement = UI.createFileSelectorElement(this._loadFromFile. bind(this));
384 this.element.appendChild(this._fileSelectorElement); 395 this._timelinePane.element.appendChild(this._fileSelectorElement);
385 } 396 }
386 397
387 /** 398 /**
388 * @param {!Event} event 399 * @param {!Event} event
389 */ 400 */
390 _contextMenu(event) { 401 _contextMenu(event) {
391 var contextMenu = new UI.ContextMenu(event); 402 var contextMenu = new UI.ContextMenu(event);
392 contextMenu.appendItemsAtLocation('timelineMenu'); 403 contextMenu.appendItemsAtLocation('timelineMenu');
393 contextMenu.show(); 404 contextMenu.show();
394 } 405 }
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 this._loader = Timeline.TimelineLoader.loadFromURL(this._tracingModel, url, this); 460 this._loader = Timeline.TimelineLoader.loadFromURL(this._tracingModel, url, this);
450 } 461 }
451 462
452 _refreshViews() { 463 _refreshViews() {
453 this._currentViews.forEach(view => view.refreshRecords()); 464 this._currentViews.forEach(view => view.refreshRecords());
454 this._updateSelectionDetails(); 465 this._updateSelectionDetails();
455 } 466 }
456 467
457 _onModeChanged() { 468 _onModeChanged() {
458 const showMemory = this._showMemorySetting.get(); 469 const showMemory = this._showMemorySetting.get();
459 const showScreenshots = this._showScreenshotsSetting.get() && this._filmStri pModel.frames().length; 470 const showScreenshots = this._showScreenshotsSetting.get();
alph 2017/01/14 02:33:51 you can just move both inline.
460 // Set up overview controls. 471 // Set up overview controls.
461 this._overviewControls = []; 472 this._overviewControls = [];
462 this._overviewControls.push(new Timeline.TimelineEventOverviewResponsiveness (this._model, this._frameModel)); 473 this._overviewControls.push(new Timeline.TimelineEventOverviewResponsiveness (this._model, this._frameModel));
463 if (Runtime.experiments.isEnabled('inputEventsOnTimelineOverview')) 474 if (Runtime.experiments.isEnabled('inputEventsOnTimelineOverview'))
464 this._overviewControls.push(new Timeline.TimelineEventOverviewInput(this._ model)); 475 this._overviewControls.push(new Timeline.TimelineEventOverviewInput(this._ model));
465 this._overviewControls.push(new Timeline.TimelineEventOverviewFrames(this._m odel, this._frameModel)); 476 this._overviewControls.push(new Timeline.TimelineEventOverviewFrames(this._m odel, this._frameModel));
466 this._overviewControls.push(new Timeline.TimelineEventOverviewCPUActivity(th is._model)); 477 this._overviewControls.push(new Timeline.TimelineEventOverviewCPUActivity(th is._model));
467 this._overviewControls.push(new Timeline.TimelineEventOverviewNetwork(this._ model)); 478 this._overviewControls.push(new Timeline.TimelineEventOverviewNetwork(this._ model));
468 if (showScreenshots) 479 if (showScreenshots)
469 this._overviewControls.push(new Timeline.TimelineFilmStripOverview(this._m odel, this._filmStripModel)); 480 this._overviewControls.push(new Timeline.TimelineFilmStripOverview(this._m odel, this._filmStripModel));
470 if (showMemory) 481 if (showMemory)
471 this._overviewControls.push(new Timeline.TimelineEventOverviewMemory(this. _model)); 482 this._overviewControls.push(new Timeline.TimelineEventOverviewMemory(this. _model));
472 this._overviewPane.setOverviewControls(this._overviewControls); 483 this._overviewPane.setOverviewControls(this._overviewControls);
473 484
474 // Set up the main view. 485 // Set up the main view.
475 this._removeAllModeViews(); 486 this._removeAllModeViews();
476 this._flameChart = new Timeline.TimelineFlameChartView( 487 this._flameChart = new Timeline.TimelineFlameChartView(
477 this, this._model, this._frameModel, this._irModel, this._extensionTraci ngModels, this._filters); 488 this, this._model, this._frameModel, this._irModel, this._extensionTraci ngModels, this._filters);
478 this._addModeView(this._flameChart); 489 this._addModeView(this._flameChart);
479 490
480 if (showMemory) { 491 if (showMemory) {
481 this._addModeView( 492 this._addModeView(
482 new Timeline.MemoryCountersGraph(this, this._model, [Timeline.Timeline UIUtils.visibleEventsFilter()])); 493 new Timeline.MemoryCountersGraph(this, this._model, [Timeline.Timeline UIUtils.visibleEventsFilter()]));
483 } 494 }
484 495
485 this.doResize(); 496 this.doResize();
486 this.select(null); 497 this.select(null);
487 } 498 }
488 499
489 _updateThrottlingToolbarVisibility() { 500 _updateSettingsPaneVisibility() {
490 this._throttlingToolbar.element.classList.toggle('hidden', !this._configureT hrottlingSetting.get()); 501 if (this._showSettingsPaneSetting.get())
502 this._settingsPane.showWidget();
503 else
504 this._settingsPane.hideWidget();
491 } 505 }
492 506
493 _updateConfigureThrottlingButton() { 507 _updateShowSettingsToolbarButton() {
494 var makeRed = this._cpuThrottlingManager.rate() !== 1 || SDK.multitargetNetw orkManager.isThrottling(); 508 var messages = [];
495 this._configureThrottlingButton.setDefaultWithRedColor(makeRed); 509 if (this._cpuThrottlingManager.rate() !== 1)
496 this._configureThrottlingButton.setToggleWithRedColor(makeRed); 510 messages.push(Common.UIString('- CPU throttling is enabled'));
511 if (SDK.multitargetNetworkManager.isThrottling())
512 messages.push(Common.UIString('- Network throttling is enabled'));
513 if (this._captureLayersAndPicturesSetting.get())
514 messages.push(Common.UIString('- Significant overhead due to paint instrum entation'));
515 if (this._disableCaptureJSProfileSetting.get())
516 messages.push(Common.UIString('- JavaScript sampling is disabled'));
517
518 this._showSettingsPaneButton.setDefaultWithRedColor(messages.length);
519 this._showSettingsPaneButton.setToggleWithRedColor(messages.length);
520
521 if (messages.length) {
522 var tooltipElement = createElement('div');
523 messages.forEach(message => {
524 tooltipElement.createChild('div').textContent = message;
525 });
526 this._showSettingsPaneButton.setTitle(tooltipElement);
527 } else {
528 this._showSettingsPaneButton.setTitle(Common.UIString('Capture settings')) ;
529 }
497 } 530 }
498 531
499 /** 532 /**
500 * @param {boolean} enabled 533 * @param {boolean} enabled
501 */ 534 */
502 _setUIControlsEnabled(enabled) { 535 _setUIControlsEnabled(enabled) {
503 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable d)); 536 this._recordingOptionUIControls.forEach(control => control.setEnabled(enable d));
504 } 537 }
505 538
506 /** 539 /**
507 * @param {boolean} userInitiated 540 * @param {boolean} userInitiated
508 */ 541 */
509 _startRecording(userInitiated) { 542 _startRecording(userInitiated) {
510 console.assert(!this._statusPane, 'Status pane is already opened.'); 543 console.assert(!this._statusPane, 'Status pane is already opened.');
511 var mainTarget = SDK.targetManager.mainTarget(); 544 var mainTarget = SDK.targetManager.mainTarget();
512 if (!mainTarget) 545 if (!mainTarget)
513 return; 546 return;
514 this._setState(Timeline.TimelinePanel.State.StartPending); 547 this._setState(Timeline.TimelinePanel.State.StartPending);
515 this._showRecordingStarted(); 548 this._showRecordingStarted();
516 549
517 this._sessionGeneration = Symbol('timelineSessionGeneration'); 550 this._sessionGeneration = Symbol('timelineSessionGeneration');
518 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation'); 551 this._autoRecordGeneration = userInitiated ? null : Symbol('Generation');
519 var enabledTraceProviders = Extensions.extensionServer.traceProviders().filt er( 552 var enabledTraceProviders = Extensions.extensionServer.traceProviders().filt er(
520 provider => Timeline.TimelinePanel._settingForTraceProvider(provider).ge t()); 553 provider => Timeline.TimelinePanel._settingForTraceProvider(provider).ge t());
521 554
522 const recordingOptions = this._landingPage.recordingOptions(); 555 const recordingOptions = {
556 enableJSSampling: !this._disableCaptureJSProfileSetting.get(),
557 capturePictures: this._captureLayersAndPicturesSetting.get(),
558 captureFilmStrip: this._showScreenshotsSetting.get()
559 };
560
523 this._controller = new Timeline.TimelineController(mainTarget, this, this._t racingModel); 561 this._controller = new Timeline.TimelineController(mainTarget, this, this._t racingModel);
524 this._controller.startRecording(recordingOptions, enabledTraceProviders); 562 this._controller.startRecording(recordingOptions, enabledTraceProviders);
525 this._recordingStartTime = Date.now(); 563 this._recordingStartTime = Date.now();
526 564
527 for (var i = 0; i < this._overviewControls.length; ++i) 565 for (var i = 0; i < this._overviewControls.length; ++i)
528 this._overviewControls[i].timelineStarted(); 566 this._overviewControls[i].timelineStarted();
529 567
530 Host.userMetrics.actionTaken( 568 Host.userMetrics.actionTaken(
531 userInitiated ? Host.UserMetrics.Action.TimelineStarted : Host.UserMetri cs.Action.TimelinePageReloadStarted); 569 userInitiated ? Host.UserMetrics.Action.TimelineStarted : Host.UserMetri cs.Action.TimelinePageReloadStarted);
532 this._setUIControlsEnabled(false); 570 this._setUIControlsEnabled(false);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 else if (this._state === Timeline.TimelinePanel.State.Recording) 602 else if (this._state === Timeline.TimelinePanel.State.Recording)
565 this._stopRecording(); 603 this._stopRecording();
566 } 604 }
567 605
568 _clear() { 606 _clear() {
569 this._showLandingPage(); 607 this._showLandingPage();
570 this._detailsSplitWidget.hideSidebar(); 608 this._detailsSplitWidget.hideSidebar();
571 this._sessionGeneration = null; 609 this._sessionGeneration = null;
572 this._recordingStartTime = 0; 610 this._recordingStartTime = 0;
573 this._reset(); 611 this._reset();
574 this._recreateToolbarItems();
575 } 612 }
576 613
577 _reset() { 614 _reset() {
578 PerfUI.LineLevelProfile.instance().reset(); 615 PerfUI.LineLevelProfile.instance().reset();
579 this._tracingModel.reset(); 616 this._tracingModel.reset();
580 this._model.reset(); 617 this._model.reset();
581 for (let extensionEntry of this._extensionTracingModels) 618 for (let extensionEntry of this._extensionTracingModels)
582 extensionEntry.model.reset(); 619 extensionEntry.model.reset();
583 this._extensionTracingModels.splice(0); 620 this._extensionTracingModels.splice(0);
584 621
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 667
631 /** 668 /**
632 * @override 669 * @override
633 * @return {?symbol} 670 * @return {?symbol}
634 */ 671 */
635 sessionGeneration() { 672 sessionGeneration() {
636 return this._sessionGeneration; 673 return this._sessionGeneration;
637 } 674 }
638 675
639 _showLandingPage() { 676 _showLandingPage() {
640 this._timelinePane.detach(); 677 if (this._landingPage) {
641 this._landingPage.show(this.element); 678 this._landingPage.show(this._statusPaneContainer);
679 return;
680 }
681
682 /**
683 * @param {string} tagName
684 * @param {string} contents
685 */
686 function encloseWithTag(tagName, contents) {
687 var e = createElement(tagName);
688 e.textContent = contents;
689 return e;
690 }
691
692 var learnMoreNode = UI.createExternalLink(
693 'https://developers.google.com/web/tools/chrome-devtools/evaluate-perfor mance/', Common.UIString('Learn more'));
694 var recordNode =
695 encloseWithTag('b', UI.shortcutRegistry.shortcutDescriptorsForAction('ti meline.toggle-recording')[0].name);
696 var reloadNode = encloseWithTag('b', UI.shortcutRegistry.shortcutDescriptors ForAction('main.reload')[0].name);
697 var navigateNode = encloseWithTag('b', Common.UIString('WASD'));
698
699 this._landingPage = new UI.VBox();
700 this._landingPage.contentElement.classList.add('timeline-landing-page', 'fil l');
701 var centered = this._landingPage.contentElement.createChild('div');
702
703 var p = centered.createChild('p');
704 p.createTextChild(Common.UIString(
705 '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.'));
706
707 p = centered.createChild('p');
708 p.appendChild(UI.formatLocalized(
709 'To capture a new recording, click the record toolbar button or hit %s. To evaluate page load performance, hit %s to record the reload.',
710 [recordNode, reloadNode]));
711
712 p = centered.createChild('p');
713 p.appendChild(UI.formatLocalized(
714 'After recording, select an area of interest in the overview by dragging . Then, zoom and pan the timeline with the mousewheel or %s keys.',
715 [navigateNode]));
716
717 p = centered.createChild('p');
718 p.appendChild(learnMoreNode);
719
720 this._landingPage.show(this._statusPaneContainer);
642 } 721 }
643 722
644 _hideLandingPage() { 723 _hideLandingPage() {
645 this._landingPage.detach(); 724 this._landingPage.detach();
646 this._timelinePane.show(this.element);
647 } 725 }
648 726
649 /** 727 /**
650 * @override 728 * @override
651 */ 729 */
652 loadingStarted() { 730 loadingStarted() {
653 this._hideLandingPage(); 731 this._hideLandingPage();
654 732
655 if (this._statusPane) 733 if (this._statusPane)
656 this._statusPane.hide(); 734 this._statusPane.hide();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 var asyncEventsByGroup = this._model.mainThreadAsyncEvents(); 777 var asyncEventsByGroup = this._model.mainThreadAsyncEvents();
700 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEventsByGr oup.get(groups.animation)); 778 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEventsByGr oup.get(groups.animation));
701 this._model.cpuProfiles().forEach(profile => PerfUI.LineLevelProfile.instanc e().appendCPUProfile(profile)); 779 this._model.cpuProfiles().forEach(profile => PerfUI.LineLevelProfile.instanc e().appendCPUProfile(profile));
702 if (this._statusPane) 780 if (this._statusPane)
703 this._statusPane.hide(); 781 this._statusPane.hide();
704 delete this._statusPane; 782 delete this._statusPane;
705 783
706 for (let entry of this._extensionTracingModels) 784 for (let entry of this._extensionTracingModels)
707 entry.model.adjustTime(this._model.minimumRecordTime() + (entry.timeOffset / 1000) - this._recordingStartTime); 785 entry.model.adjustTime(this._model.minimumRecordTime() + (entry.timeOffset / 1000) - this._recordingStartTime);
708 786
709 this._recreateToolbarItems();
710 this._flameChart.resizeToPreferredHeights(); 787 this._flameChart.resizeToPreferredHeights();
711 this._overviewPane.reset(); 788 this._overviewPane.reset();
712 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._model.ma ximumRecordTime()); 789 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._model.ma ximumRecordTime());
713 this._setAutoWindowTimes(); 790 this._setAutoWindowTimes();
714 this._refreshViews(); 791 this._refreshViews();
715 for (var i = 0; i < this._overviewControls.length; ++i) 792 for (var i = 0; i < this._overviewControls.length; ++i)
716 this._overviewControls[i].timelineStopped(); 793 this._overviewControls[i].timelineStopped();
717 this._setMarkers(); 794 this._setMarkers();
718 this._overviewPane.scheduleUpdate(); 795 this._overviewPane.scheduleUpdate();
719 this._updateSearchHighlight(false, true); 796 this._updateSearchHighlight(false, true);
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1844 }; 1921 };
1845 1922
1846 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g'); 1923 Timeline.TimelinePanel._traceProviderSettingSymbol = Symbol('traceProviderSettin g');
1847 1924
1848 /** @enum {symbol} */ 1925 /** @enum {symbol} */
1849 Timeline.TimelineFilters.Events = { 1926 Timeline.TimelineFilters.Events = {
1850 FilterChanged: Symbol('FilterChanged') 1927 FilterChanged: Symbol('FilterChanged')
1851 }; 1928 };
1852 1929
1853 Timeline.TimelineFilters._durationFilterPresetsMs = [0, 1, 15]; 1930 Timeline.TimelineFilters._durationFilterPresetsMs = [0, 1, 15];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698