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

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

Issue 361203002: [DevTools] Start/stop of timeline recording should set UI controls disabled/enabled respectively. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing! Created 6 years, 5 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 _removeAllModeViews: function() 318 _removeAllModeViews: function()
319 { 319 {
320 for (var i = 0; i < this._currentViews.length; ++i) { 320 for (var i = 0; i < this._currentViews.length; ++i) {
321 this._currentViews[i].removeEventListener(WebInspector.SplitView.Eve nts.SidebarSizeChanged, this._sidebarResized, this); 321 this._currentViews[i].removeEventListener(WebInspector.SplitView.Eve nts.SidebarSizeChanged, this._sidebarResized, this);
322 this._currentViews[i].dispose(); 322 this._currentViews[i].dispose();
323 } 323 }
324 this._currentViews = []; 324 this._currentViews = [];
325 this._stackView.detachChildViews(); 325 this._stackView.detachChildViews();
326 }, 326 },
327 327
328 /**
329 * @param {string} name
330 * @param {!WebInspector.Setting} setting
331 * @param {string=} tooltip
aandrey 2014/07/03 11:24:33 {string=} -> {string}
332 * @return {!Element}
333 */
334 _createSettingCheckbox: function(name, setting, tooltip)
335 {
336 if (!this._recordingOptionUIControls)
337 this._recordingOptionUIControls = [];
338
339 checkboxElement = document.createElement("input");
loislo 2014/07/03 11:33:38 var checkboxElement
340 labelElement = WebInspector.SettingsUI.createSettingCheckbox(name, setti ng, true, checkboxElement, tooltip);
341 this._recordingOptionUIControls.push({ "label": labelElement, "checkbox" : checkboxElement });
342 return labelElement;
343 },
344
328 _createRecordingOptions: function() 345 _createRecordingOptions: function()
329 { 346 {
330 var topPaneSidebarElement = this._topPane.sidebarElement(); 347 var topPaneSidebarElement = this._topPane.sidebarElement();
331 348
332 this._captureStacksSetting = WebInspector.settings.createSetting("timeli neCaptureStacks", true); 349 this._captureStacksSetting = WebInspector.settings.createSetting("timeli neCaptureStacks", true);
333 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingC heckbox(WebInspector.UIString("Capture stacks"), 350 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebInspect or.UIString("Capture stacks"),
334 this._captureStacksSetting, true, unde fined, 351 this._capt ureStacksSetting,
335 WebInspector.UIString("Capture JavaScr ipt stack on every timeline event"))); 352 WebInspect or.UIString("Capture JavaScript stack on every timeline event")));
336 353
337 this._captureMemorySetting = WebInspector.settings.createSetting("timeli neCaptureMemory", false); 354 this._captureMemorySetting = WebInspector.settings.createSetting("timeli neCaptureMemory", false);
338 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSettingC heckbox(WebInspector.UIString("Capture memory"), 355 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebInspect or.UIString("Capture memory"),
339 this._captureMemorySetting, true, unde fined, 356 this._capt ureMemorySetting,
340 WebInspector.UIString("Capture memory information on every timeline event"))); 357 WebInspect or.UIString("Capture memory information on every timeline event")));
341 this._captureMemorySetting.addChangeListener(this._onModeChanged, this); 358 this._captureMemorySetting.addChangeListener(this._onModeChanged, this);
342 359
343 if (Capabilities.canProfilePower) { 360 if (Capabilities.canProfilePower) {
344 this._capturePowerSetting = WebInspector.settings.createSetting("tim elineCapturePower", false); 361 this._capturePowerSetting = WebInspector.settings.createSetting("tim elineCapturePower", false);
345 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett ingCheckbox(WebInspector.UIString("Capture power"), 362 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebIns pector.UIString("Capture power"),
346 this._capturePowerSetting, true, u ndefined, 363 this._ capturePowerSetting,
347 WebInspector.UIString("Capture pow er information"))); 364 WebIns pector.UIString("Capture power information")));
348 this._capturePowerSetting.addChangeListener(this._onModeChanged, thi s); 365 this._capturePowerSetting.addChangeListener(this._onModeChanged, thi s);
349 } 366 }
350 367
351 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) { 368 if (WebInspector.experimentsSettings.timelineTracingMode.isEnabled()) {
352 this._captureTracingSetting = WebInspector.settings.createSetting("t imelineCaptureTracing", false); 369 this._captureTracingSetting = WebInspector.settings.createSetting("t imelineCaptureTracing", false);
353 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett ingCheckbox(WebInspector.UIString("Capture tracing"), 370 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebIns pector.UIString("Capture tracing"),
354 this._captureTracingSetting, true, undefined, 371 this._ captureTracingSetting,
355 WebInspector.UIString("Capture tra cing information"))); 372 WebIns pector.UIString("Capture tracing information")));
356 this._captureTracingSetting.addChangeListener(this._onModeChanged, t his); 373 this._captureTracingSetting.addChangeListener(this._onModeChanged, t his);
357 } else if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnab led()) { 374 } else if (WebInspector.experimentsSettings.timelineOnTraceEvents.isEnab led()) {
358 this._captureLayersAndPicturesSetting = WebInspector.settings.create Setting("timelineCaptureLayersAndPictures", false); 375 this._captureLayersAndPicturesSetting = WebInspector.settings.create Setting("timelineCaptureLayersAndPictures", false);
359 topPaneSidebarElement.appendChild(WebInspector.SettingsUI.createSett ingCheckbox(WebInspector.UIString("Capture pictures"), 376 topPaneSidebarElement.appendChild(this._createSettingCheckbox(WebIns pector.UIString("Capture pictures"),
360 this._captureLayersAndPicturesSett ing, true, undefined, 377 this._ captureLayersAndPicturesSetting,
361 WebInspector.UIString("Capture gra phics layer positions and painted pictures"))); 378 WebIns pector.UIString("Capture graphics layer positions and painted pictures")));
362 } 379 }
363 }, 380 },
364 381
365 _createStatusBarItems: function() 382 _createStatusBarItems: function()
366 { 383 {
367 var panelStatusBarElement = this.element.createChild("div", "panel-statu s-bar"); 384 var panelStatusBarElement = this.element.createChild("div", "panel-statu s-bar");
368 this._statusBarButtons = /** @type {!Array.<!WebInspector.StatusBarItem> } */ ([]); 385 this._statusBarButtons = /** @type {!Array.<!WebInspector.StatusBarItem> } */ ([]);
369 386
370 this.toggleTimelineButton = new WebInspector.StatusBarButton("", "record -profile-status-bar-item"); 387 this.toggleTimelineButton = new WebInspector.StatusBarButton("", "record -profile-status-bar-item");
371 this.toggleTimelineButton.addEventListener("click", this._toggleTimeline ButtonClicked, this); 388 this.toggleTimelineButton.addEventListener("click", this._toggleTimeline ButtonClicked, this);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 675
659 this._timelineView().setFrameModel(isFrameMode ? this._frameModel() : nu ll); 676 this._timelineView().setFrameModel(isFrameMode ? this._frameModel() : nu ll);
660 this._overviewPane.setOverviewControls(this._overviewControls); 677 this._overviewPane.setOverviewControls(this._overviewControls);
661 this.doResize(); 678 this.doResize();
662 this._updateSelectedRangeStats(); 679 this._updateSelectedRangeStats();
663 680
664 this._stackView.show(this._searchableView.element); 681 this._stackView.show(this._searchableView.element);
665 }, 682 },
666 683
667 /** 684 /**
685 * @param {boolean} disabled
686 */
687 _disableUIControls: function(disabled) {
688 this._recordingOptionUIControls.forEach(function(uiControl) {
aandrey 2014/07/03 11:24:33 we generally don't inline function callbacks. i.e.
689 uiControl.checkbox.disabled = disabled;
690 uiControl.label.classList.toggle("disabled-label", disabled);
aandrey 2014/07/03 11:24:33 nit: we already use "dimmed" class.
691 });
692 WebInspector.inspectorView.setCurrentPanelLocked(disabled);
693 },
694
695 /**
668 * @param {boolean} userInitiated 696 * @param {boolean} userInitiated
669 */ 697 */
670 _startRecording: function(userInitiated) 698 _startRecording: function(userInitiated)
671 { 699 {
672 this._userInitiatedRecording = userInitiated; 700 this._userInitiatedRecording = userInitiated;
673 this._model.startRecording(this._captureStacksSetting.get(), this._captu reMemorySetting.get(), this._captureLayersAndPicturesSetting && this._captureLay ersAndPicturesSetting.get()); 701 this._model.startRecording(this._captureStacksSetting.get(), this._captu reMemorySetting.get(), this._captureLayersAndPicturesSetting && this._captureLay ersAndPicturesSetting.get());
674 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel) 702 if (WebInspector.experimentsSettings.timelineNoLiveUpdate.isEnabled() && this._lazyFrameModel)
675 this._lazyFrameModel.setMergeRecords(false); 703 this._lazyFrameModel.setMergeRecords(false);
676 704
677 for (var i = 0; i < this._overviewControls.length; ++i) 705 for (var i = 0; i < this._overviewControls.length; ++i)
678 this._overviewControls[i].timelineStarted(); 706 this._overviewControls[i].timelineStarted();
679 707
680 if (userInitiated) 708 if (userInitiated)
681 WebInspector.userMetrics.TimelineStarted.record(); 709 WebInspector.userMetrics.TimelineStarted.record();
682 WebInspector.inspectorView.setCurrentPanelLocked(true); 710 this._disableUIControls(true);
683 }, 711 },
684 712
685 _stopRecording: function() 713 _stopRecording: function()
686 { 714 {
687 this._stopPending = true; 715 this._stopPending = true;
688 this._updateToggleTimelineButton(false); 716 this._updateToggleTimelineButton(false);
689 this._userInitiatedRecording = false; 717 this._userInitiatedRecording = false;
690 this._model.stopRecording(); 718 this._model.stopRecording();
691 if (this._progressElement) 719 if (this._progressElement)
692 this._updateProgress(WebInspector.UIString("Retrieving events\u2026" )); 720 this._updateProgress(WebInspector.UIString("Retrieving events\u2026" ));
693 721
694 for (var i = 0; i < this._overviewControls.length; ++i) 722 for (var i = 0; i < this._overviewControls.length; ++i)
695 this._overviewControls[i].timelineStopped(); 723 this._overviewControls[i].timelineStopped();
696 WebInspector.inspectorView.setCurrentPanelLocked(false); 724 this._disableUIControls(false);
697 }, 725 },
698 726
699 _onProfilingStateChanged: function() 727 _onProfilingStateChanged: function()
700 { 728 {
701 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled); 729 this._updateToggleTimelineButton(this.toggleTimelineButton.toggled);
702 }, 730 },
703 731
704 /** 732 /**
705 * @param {boolean} toggled 733 * @param {boolean} toggled
706 */ 734 */
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 * @param {!WebInspector.TimelineModel.Record} record 1473 * @param {!WebInspector.TimelineModel.Record} record
1446 * @return {boolean} 1474 * @return {boolean}
1447 */ 1475 */
1448 accept: function(record) 1476 accept: function(record)
1449 { 1477 {
1450 return !this._regex || this._uiUtils.testContentMatching(record, this._r egex); 1478 return !this._regex || this._uiUtils.testContentMatching(record, this._r egex);
1451 }, 1479 },
1452 1480
1453 __proto__: WebInspector.TimelineModel.Filter.prototype 1481 __proto__: WebInspector.TimelineModel.Filter.prototype
1454 } 1482 }
OLDNEW
« no previous file with comments | « no previous file | Source/devtools/front_end/timelinePanel.css » ('j') | Source/devtools/front_end/timelinePanel.css » ('J')

Powered by Google App Engine
This is Rietveld 408576698