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

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

Issue 2580903003: DevTools: Rearrange Timeline toolbar for landing page mode (Closed)
Patch Set: Created 4 years 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 /** @type {!Array<!Timeline.TimelineModeView>} */ 74 /** @type {!Array<!Timeline.TimelineModeView>} */
75 this._currentViews = []; 75 this._currentViews = [];
76 76
77 this._captureNetworkSetting = Common.settings.createSetting('timelineCapture Network', false); 77 this._captureNetworkSetting = Common.settings.createSetting('timelineCapture Network', false);
78 this._captureJSProfileSetting = Common.settings.createSetting('timelineEnabl eJSSampling', true); 78 this._captureJSProfileSetting = Common.settings.createSetting('timelineEnabl eJSSampling', true);
79 this._captureMemorySetting = Common.settings.createSetting('timelineCaptureM emory', false); 79 this._captureMemorySetting = Common.settings.createSetting('timelineCaptureM emory', 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); 81 this._captureFilmStripSetting = Common.settings.createSetting('timelineCaptu reFilmStrip', false);
82 82
83 this._showScreenshotsSetting = Common.settings.createLocalSetting('timelineS howScreenshots', false);
84 this._showScreenshotsSetting.addChangeListener(this._onModeChanged, this);
85 this._showMemorySetting = Common.settings.createLocalSetting('timelineShowMe mory', false);
86 this._showMemorySetting.addChangeListener(this._onModeChanged, this);
87
83 this._markUnusedCSS = Common.settings.createSetting('timelineMarkUnusedCSS', false); 88 this._markUnusedCSS = Common.settings.createSetting('timelineMarkUnusedCSS', false);
84 89
85 this._panelToolbar = new UI.Toolbar('', this.element); 90 this._panelToolbar = new UI.Toolbar('', this.element);
86 91
87 this._timelinePane = new UI.VBox(); 92 this._timelinePane = new UI.VBox();
88 this._timelinePane.show(this.element); 93 this._timelinePane.show(this.element);
89 var topPaneElement = this._timelinePane.element.createChild('div', 'hbox'); 94 var topPaneElement = this._timelinePane.element.createChild('div', 'hbox');
90 topPaneElement.id = 'timeline-overview-panel'; 95 topPaneElement.id = 'timeline-overview-panel';
91 96
92 // Create top overview component. 97 // Create top overview component.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 this._updateTimelineControls(); 271 this._updateTimelineControls();
267 } 272 }
268 273
269 /** 274 /**
270 * @param {string} name 275 * @param {string} name
271 * @param {!Common.Setting} setting 276 * @param {!Common.Setting} setting
272 * @param {string} tooltip 277 * @param {string} tooltip
273 * @return {!UI.ToolbarItem} 278 * @return {!UI.ToolbarItem}
274 */ 279 */
275 _createSettingCheckbox(name, setting, tooltip) { 280 _createSettingCheckbox(name, setting, tooltip) {
276 if (!this._recordingOptionUIControls)
277 this._recordingOptionUIControls = [];
278 var checkboxItem = new UI.ToolbarCheckbox(name, tooltip, setting); 281 var checkboxItem = new UI.ToolbarCheckbox(name, tooltip, setting);
279 this._recordingOptionUIControls.push(checkboxItem); 282 this._recordingOptionUIControls.push(checkboxItem);
280 return checkboxItem; 283 return checkboxItem;
281 } 284 }
282 285
283 _recreateToolbarItems() { 286 _recreateToolbarItems() {
284 this._panelToolbar.removeToolbarItems(); 287 this._panelToolbar.removeToolbarItems();
285 288
286 var perspectiveSetting = 289 var perspectiveSetting =
287 Common.settings.createSetting('timelinePerspective', Timeline.TimelinePa nel.Perspectives.Load); 290 Common.settings.createSetting('timelinePerspective', Timeline.TimelinePa nel.Perspectives.Load);
288 291
289 // Record 292 // Record
290 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives') && 293 if (Runtime.experiments.isEnabled('timelineLandingPage')) {
294 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t oggleRecordAction));
295 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButtonForId('m ain.reload'));
296 } else if (Runtime.experiments.isEnabled('timelineRecordingPerspectives') &&
291 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Load) { 297 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Load) {
292 this._reloadButton = new UI.ToolbarButton(Common.UIString('Record & Reload '), 'largeicon-refresh'); 298 const reloadButton = new UI.ToolbarButton(Common.UIString('Record & Reload '), 'largeicon-refresh');
293 this._reloadButton.addEventListener(UI.ToolbarButton.Events.Click, () => S DK.targetManager.reloadPage()); 299 reloadButton.addEventListener(UI.ToolbarButton.Events.Click, () => SDK.tar getManager.reloadPage());
294 this._panelToolbar.appendToolbarItem(this._reloadButton); 300 this._panelToolbar.appendToolbarItem(reloadButton);
295 } else { 301 } else {
296 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t oggleRecordAction)); 302 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t oggleRecordAction));
297 } 303 }
298 304
299 // Clear 305 // Clear
300 var clearButton = new UI.ToolbarButton(Common.UIString('Clear recording'), ' largeicon-clear'); 306 var clearButton = new UI.ToolbarButton(Common.UIString('Clear recording'), ' largeicon-clear');
301 clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, thi s); 307 clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, thi s);
302 this._panelToolbar.appendToolbarItem(clearButton); 308 this._panelToolbar.appendToolbarItem(clearButton);
303 309
304 this._panelToolbar.appendSeparator(); 310 this._panelToolbar.appendSeparator();
305 311
306 // Combo 312 // Combo
307 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives')) { 313 if (!Runtime.experiments.isEnabled('timelineLandingPage') &&
314 Runtime.experiments.isEnabled('timelineRecordingPerspectives')) {
308 /** 315 /**
309 * @this {!Timeline.TimelinePanel} 316 * @this {!Timeline.TimelinePanel}
310 */ 317 */
311 function onPerspectiveChanged() { 318 function onPerspectiveChanged() {
312 perspectiveSetting.set(perspectiveCombobox.selectElement().value); 319 perspectiveSetting.set(perspectiveCombobox.selectElement().value);
313 this._recreateToolbarItems(); 320 this._recreateToolbarItems();
314 } 321 }
315 322
316 /** 323 /**
317 * @param {string} id 324 * @param {string} id
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 this._captureLayersAndPicturesSetting.set(false); 362 this._captureLayersAndPicturesSetting.set(false);
356 this._captureFilmStripSetting.set(false); 363 this._captureFilmStripSetting.set(false);
357 this._detailsView.selectTab(Timeline.TimelinePanel.DetailsTab.BottomUp , false); 364 this._detailsView.selectTab(Timeline.TimelinePanel.DetailsTab.BottomUp , false);
358 break; 365 break;
359 } 366 }
360 367
361 this._bulkUpdate = false; 368 this._bulkUpdate = false;
362 this._onModeChanged(); 369 this._onModeChanged();
363 } 370 }
364 371
365 var screenshotCheckbox = this._createSettingCheckbox( 372 if (!this._recordingOptionUIControls)
366 Common.UIString('Screenshots'), this._captureFilmStripSetting, 373 this._recordingOptionUIControls = [];
caseq 2016/12/16 01:47:40 Let's move to constructor.
alph 2016/12/16 01:59:55 Done.
367 Common.UIString('Capture screenshots while recording. (Has small perform ance overhead)'));
368 374
369 if (!Runtime.experiments.isEnabled('timelineRecordingPerspectives') || 375 if (Runtime.experiments.isEnabled('timelineLandingPage')) {
370 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Custom) { 376 if (!this._model.isEmpty()) {
371 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 377 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(Common. UIString('Memory'),
372 Common.UIString('Network'), this._captureNetworkSetting, 378 this._showMemorySetting, Common.UIString('Show memory timeline.')));
373 Common.UIString('Show network requests information'))); 379 if (this._filmStripModel.frames().length) {
374 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 380 this._showScreenshotsSetting.set(true);
375 Common.UIString('JS Profile'), this._captureJSProfileSetting, 381 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(Commo n.UIString('Screenshots'),
376 Common.UIString('Capture JavaScript stacks with sampling profiler. (Ha s small performance overhead)'))); 382 this._showScreenshotsSetting, Common.UIString('Show captured scree nshots.')));
377 this._panelToolbar.appendToolbarItem(screenshotCheckbox); 383 }
378 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 384 }
379 Common.UIString('Memory'), this._captureMemorySetting,
380 Common.UIString('Capture memory information on every timeline event.') ));
381 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
382 Common.UIString('Paint'), this._captureLayersAndPicturesSetting,
383 Common.UIString(
384 'Capture graphics layer positions and rasterization draw calls. (H as large performance overhead)')));
385 } else { 385 } else {
386 this._panelToolbar.appendToolbarItem(screenshotCheckbox); 386 const screenshotCheckbox = this._createSettingCheckbox(
387 Common.UIString('Screenshots'), this._captureFilmStripSetting,
388 Common.UIString('Capture screenshots while recording. (Has small perfo rmance overhead)'));
389
390 if (!Runtime.experiments.isEnabled('timelineRecordingPerspectives') ||
391 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Custo m) {
392 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
393 Common.UIString('Network'), this._captureNetworkSetting,
394 Common.UIString('Show network requests information')));
395 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
396 Common.UIString('JS Profile'), this._captureJSProfileSetting,
397 Common.UIString('Capture JavaScript stacks with sampling profiler. ( Has small performance overhead)')));
398 this._panelToolbar.appendToolbarItem(screenshotCheckbox);
399 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
400 Common.UIString('Memory'), this._captureMemorySetting,
401 Common.UIString('Capture memory information on every timeline event. ')));
402 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
403 Common.UIString('Paint'), this._captureLayersAndPicturesSetting,
404 Common.UIString(
405 'Capture graphics layer positions and rasterization draw calls. (Has large performance overhead)')));
406 } else {
407 this._panelToolbar.appendToolbarItem(screenshotCheckbox);
408 }
387 } 409 }
388 410
389 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) { 411 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) {
390 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 412 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
391 Common.UIString('CSS coverage'), this._markUnusedCSS, Common.UIString( 'Mark unused CSS in souces.'))); 413 Common.UIString('CSS coverage'), this._markUnusedCSS, Common.UIString( 'Mark unused CSS in souces.')));
392 } 414 }
393 415
394 const traceProviders = Extensions.extensionServer.traceProviders(); 416 const traceProviders = Extensions.extensionServer.traceProviders();
395 if (traceProviders.length) { 417 if (traceProviders.length) {
396 this._panelToolbar.appendSeparator(); 418 this._panelToolbar.appendSeparator();
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 * @param {string} url 550 * @param {string} url
529 */ 551 */
530 _loadFromURL(url) { 552 _loadFromURL(url) {
531 if (this._state !== Timeline.TimelinePanel.State.Idle) 553 if (this._state !== Timeline.TimelinePanel.State.Idle)
532 return; 554 return;
533 this._prepareToLoadTimeline(); 555 this._prepareToLoadTimeline();
534 this._loader = Timeline.TimelineLoader.loadFromURL(this._tracingModel, url, this); 556 this._loader = Timeline.TimelineLoader.loadFromURL(this._tracingModel, url, this);
535 } 557 }
536 558
537 _refreshViews() { 559 _refreshViews() {
538 for (var i = 0; i < this._currentViews.length; ++i) { 560 this._currentViews.forEach(view => view.refreshRecords());
539 var view = this._currentViews[i];
540 view.refreshRecords();
541 }
542 this._updateSelectionDetails(); 561 this._updateSelectionDetails();
543 } 562 }
544 563
545 _onModeChanged() { 564 _onModeChanged() {
546 if (this._bulkUpdate) 565 if (this._bulkUpdate)
547 return; 566 return;
567 const showMemory = Runtime.experiments.isEnabled('timelineLandingPage')
568 ? this._showMemorySetting.get() : this._captureMemorySetting.get();
569 const showScreenshots = Runtime.experiments.isEnabled('timelineLandingPage')
570 ? this._showScreenshotsSetting.get() && this._filmStripModel.frames().le ngth
571 : this._captureFilmStripSetting.get();
548 // Set up overview controls. 572 // Set up overview controls.
549 this._overviewControls = []; 573 this._overviewControls = [];
550 this._overviewControls.push(new Timeline.TimelineEventOverviewResponsiveness (this._model, this._frameModel)); 574 this._overviewControls.push(new Timeline.TimelineEventOverviewResponsiveness (this._model, this._frameModel));
551 if (Runtime.experiments.isEnabled('inputEventsOnTimelineOverview')) 575 if (Runtime.experiments.isEnabled('inputEventsOnTimelineOverview'))
552 this._overviewControls.push(new Timeline.TimelineEventOverviewInput(this._ model)); 576 this._overviewControls.push(new Timeline.TimelineEventOverviewInput(this._ model));
553 this._overviewControls.push(new Timeline.TimelineEventOverviewFrames(this._m odel, this._frameModel)); 577 this._overviewControls.push(new Timeline.TimelineEventOverviewFrames(this._m odel, this._frameModel));
554 this._overviewControls.push(new Timeline.TimelineEventOverviewCPUActivity(th is._model)); 578 this._overviewControls.push(new Timeline.TimelineEventOverviewCPUActivity(th is._model));
555 this._overviewControls.push(new Timeline.TimelineEventOverviewNetwork(this._ model)); 579 this._overviewControls.push(new Timeline.TimelineEventOverviewNetwork(this._ model));
556 if (this._captureFilmStripSetting.get()) 580 if (showScreenshots)
557 this._overviewControls.push(new Timeline.TimelineFilmStripOverview(this._m odel, this._filmStripModel)); 581 this._overviewControls.push(new Timeline.TimelineFilmStripOverview(this._m odel, this._filmStripModel));
558 if (this._captureMemorySetting.get()) 582 if (showMemory)
559 this._overviewControls.push(new Timeline.TimelineEventOverviewMemory(this. _model)); 583 this._overviewControls.push(new Timeline.TimelineEventOverviewMemory(this. _model));
560 this._overviewPane.setOverviewControls(this._overviewControls); 584 this._overviewPane.setOverviewControls(this._overviewControls);
561 585
562 // Set up the main view. 586 // Set up the main view.
563 this._removeAllModeViews(); 587 this._removeAllModeViews();
564 this._flameChart = new Timeline.TimelineFlameChartView( 588 this._flameChart = new Timeline.TimelineFlameChartView(
565 this, this._model, this._frameModel, this._irModel, this._extensionTraci ngModels, this._filters); 589 this, this._model, this._frameModel, this._irModel, this._extensionTraci ngModels, this._filters);
566 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get()); 590 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get());
567 this._addModeView(this._flameChart); 591 this._addModeView(this._flameChart);
568 592
569 if (this._captureMemorySetting.get()) { 593 if (showMemory) {
570 this._addModeView( 594 this._addModeView(new Timeline.MemoryCountersGraph(
571 new Timeline.MemoryCountersGraph(this, this._model, [Timeline.Timeline UIUtils.visibleEventsFilter()])); 595 this, this._model, [Timeline.TimelineUIUtils.visibleEventsFilter()]));
572 } 596 }
597 if (Runtime.experiments.isEnabled('timelineLandingPage'))
598 this._flameChart.enableNetworkPane(true);
573 599
574 this.doResize(); 600 this.doResize();
575 this.select(null); 601 this.select(null);
576 } 602 }
577 603
578 _onNetworkChanged() { 604 _onNetworkChanged() {
579 if (this._flameChart) 605 if (this._flameChart)
580 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get(), true ); 606 this._flameChart.enableNetworkPane(this._captureNetworkSetting.get(), true );
581 } 607 }
582 608
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 else if (this._state === Timeline.TimelinePanel.State.Recording) 697 else if (this._state === Timeline.TimelinePanel.State.Recording)
672 this._stopRecording(); 698 this._stopRecording();
673 } 699 }
674 700
675 _clear() { 701 _clear() {
676 this._showRecordingHelpMessage(); 702 this._showRecordingHelpMessage();
677 this._detailsSplitWidget.hideSidebar(); 703 this._detailsSplitWidget.hideSidebar();
678 this._sessionGeneration = null; 704 this._sessionGeneration = null;
679 this._recordingStartTime = 0; 705 this._recordingStartTime = 0;
680 this._reset(); 706 this._reset();
707 this._recreateToolbarItems();
681 } 708 }
682 709
683 _reset() { 710 _reset() {
684 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar kUnusedCSS.get()) 711 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar kUnusedCSS.get())
685 Components.CoverageProfile.instance().reset(); 712 Components.CoverageProfile.instance().reset();
686 713
687 Components.LineLevelProfile.instance().reset(); 714 Components.LineLevelProfile.instance().reset();
688 this._tracingModel.reset(); 715 this._tracingModel.reset();
689 this._model.reset(); 716 this._model.reset();
690 for (let extensionEntry of this._extensionTracingModels) 717 for (let extensionEntry of this._extensionTracingModels)
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 var asyncEventsByGroup = this._model.mainThreadAsyncEvents(); 890 var asyncEventsByGroup = this._model.mainThreadAsyncEvents();
864 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEventsByGr oup.get(groups.animation)); 891 this._irModel.populate(asyncEventsByGroup.get(groups.input), asyncEventsByGr oup.get(groups.animation));
865 this._model.cpuProfiles().forEach(profile => Components.LineLevelProfile.ins tance().appendCPUProfile(profile)); 892 this._model.cpuProfiles().forEach(profile => Components.LineLevelProfile.ins tance().appendCPUProfile(profile));
866 if (this._statusPane) 893 if (this._statusPane)
867 this._statusPane.hide(); 894 this._statusPane.hide();
868 delete this._statusPane; 895 delete this._statusPane;
869 896
870 for (let entry of this._extensionTracingModels) 897 for (let entry of this._extensionTracingModels)
871 entry.model.adjustTime(this._model.minimumRecordTime() + (entry.timeOffset / 1000) - this._recordingStartTime); 898 entry.model.adjustTime(this._model.minimumRecordTime() + (entry.timeOffset / 1000) - this._recordingStartTime);
872 899
900 this._recreateToolbarItems();
901 this._onModeChanged();
caseq 2016/12/16 01:47:40 Why is this added?
alph 2016/12/16 01:59:55 accidentally.
873 this._flameChart.resizeToPreferredHeights(); 902 this._flameChart.resizeToPreferredHeights();
874 this._overviewPane.reset(); 903 this._overviewPane.reset();
875 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._model.ma ximumRecordTime()); 904 this._overviewPane.setBounds(this._model.minimumRecordTime(), this._model.ma ximumRecordTime());
876 this._setAutoWindowTimes(); 905 this._setAutoWindowTimes();
877 this._refreshViews(); 906 this._refreshViews();
878 for (var i = 0; i < this._overviewControls.length; ++i) 907 for (var i = 0; i < this._overviewControls.length; ++i)
879 this._overviewControls[i].timelineStopped(); 908 this._overviewControls[i].timelineStopped();
880 this._setMarkers(); 909 this._setMarkers();
881 this._overviewPane.scheduleUpdate(); 910 this._overviewPane.scheduleUpdate();
882 this._updateSearchHighlight(false, true); 911 this._updateSearchHighlight(false, true);
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2065 } 2094 }
2066 2095
2067 /** 2096 /**
2068 * @override 2097 * @override
2069 * @param {!SDK.Target} target 2098 * @param {!SDK.Target} target
2070 */ 2099 */
2071 targetRemoved(target) { 2100 targetRemoved(target) {
2072 this._targets.remove(target, true); 2101 this._targets.remove(target, true);
2073 } 2102 }
2074 }; 2103 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698