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

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

Issue 2553043003: [DevTools] Remove methods on Common.Event. (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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 _recreateToolbarItems() { 275 _recreateToolbarItems() {
276 this._panelToolbar.removeToolbarItems(); 276 this._panelToolbar.removeToolbarItems();
277 277
278 var perspectiveSetting = 278 var perspectiveSetting =
279 Common.settings.createSetting('timelinePerspective', Timeline.TimelinePa nel.Perspectives.Load); 279 Common.settings.createSetting('timelinePerspective', Timeline.TimelinePa nel.Perspectives.Load);
280 280
281 // Record 281 // Record
282 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives') && 282 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives') &&
283 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Load) { 283 perspectiveSetting.get() === Timeline.TimelinePanel.Perspectives.Load) {
284 this._reloadButton = new UI.ToolbarButton(Common.UIString('Record & Reload '), 'largeicon-refresh'); 284 this._reloadButton = new UI.ToolbarButton(Common.UIString('Record & Reload '), 'largeicon-refresh');
285 this._reloadButton.addEventListener('click', () => SDK.targetManager.reloa dPage()); 285 this._reloadButton.addEventListener(UI.ToolbarButton.Events.Click, () => S DK.targetManager.reloadPage());
286 this._panelToolbar.appendToolbarItem(this._reloadButton); 286 this._panelToolbar.appendToolbarItem(this._reloadButton);
287 } else { 287 } else {
288 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t oggleRecordAction)); 288 this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._t oggleRecordAction));
289 } 289 }
290 290
291 // Clear 291 // Clear
292 var clearButton = new UI.ToolbarButton(Common.UIString('Clear recording'), ' largeicon-clear'); 292 var clearButton = new UI.ToolbarButton(Common.UIString('Clear recording'), ' largeicon-clear');
293 clearButton.addEventListener('click', this._clear, this); 293 clearButton.addEventListener(UI.ToolbarButton.Events.Click, this._clear, thi s);
294 this._panelToolbar.appendToolbarItem(clearButton); 294 this._panelToolbar.appendToolbarItem(clearButton);
295 295
296 this._panelToolbar.appendSeparator(); 296 this._panelToolbar.appendSeparator();
297 297
298 // Combo 298 // Combo
299 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives')) { 299 if (Runtime.experiments.isEnabled('timelineRecordingPerspectives')) {
300 /** 300 /**
301 * @this {!Timeline.TimelinePanel} 301 * @this {!Timeline.TimelinePanel}
302 */ 302 */
303 function onPerspectiveChanged() { 303 function onPerspectiveChanged() {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 this._panelToolbar.appendToolbarItem(screenshotCheckbox); 378 this._panelToolbar.appendToolbarItem(screenshotCheckbox);
379 } 379 }
380 380
381 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) { 381 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording')) {
382 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox( 382 this._panelToolbar.appendToolbarItem(this._createSettingCheckbox(
383 Common.UIString('CSS coverage'), this._markUnusedCSS, Common.UIString( 'Mark unused CSS in souces.'))); 383 Common.UIString('CSS coverage'), this._markUnusedCSS, Common.UIString( 'Mark unused CSS in souces.')));
384 } 384 }
385 385
386 this._panelToolbar.appendSeparator(); 386 this._panelToolbar.appendSeparator();
387 var garbageCollectButton = new UI.ToolbarButton(Common.UIString('Collect gar bage'), 'largeicon-trash-bin'); 387 var garbageCollectButton = new UI.ToolbarButton(Common.UIString('Collect gar bage'), 'largeicon-trash-bin');
388 garbageCollectButton.addEventListener('click', this._garbageCollectButtonCli cked, this); 388 garbageCollectButton.addEventListener(UI.ToolbarButton.Events.Click, this._g arbageCollectButtonClicked, this);
389 this._panelToolbar.appendToolbarItem(garbageCollectButton); 389 this._panelToolbar.appendToolbarItem(garbageCollectButton);
390 390
391 this._panelToolbar.appendSeparator(); 391 this._panelToolbar.appendSeparator();
392 this._cpuThrottlingCombobox = new UI.ToolbarComboBox(this._onCPUThrottlingCh anged.bind(this)); 392 this._cpuThrottlingCombobox = new UI.ToolbarComboBox(this._onCPUThrottlingCh anged.bind(this));
393 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect()); 393 this._panelToolbar.appendToolbarItem(this._createNetworkConditionsSelect());
394 this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox); 394 this._panelToolbar.appendToolbarItem(this._cpuThrottlingCombobox);
395 this._populateCPUThrottingCombobox(); 395 this._populateCPUThrottingCombobox();
396 this._updateTimelineControls(); 396 this._updateTimelineControls();
397 } 397 }
398 398
(...skipping 18 matching lines...) Expand all
417 */ 417 */
418 function addGroupingOption(name, value) { 418 function addGroupingOption(name, value) {
419 var option = cpuThrottlingCombobox.createOption(name, '', String(value)); 419 var option = cpuThrottlingCombobox.createOption(name, '', String(value));
420 cpuThrottlingCombobox.addOption(option); 420 cpuThrottlingCombobox.addOption(option);
421 if (hasSelection || (value && value !== currentRate)) 421 if (hasSelection || (value && value !== currentRate))
422 return; 422 return;
423 cpuThrottlingCombobox.select(option); 423 cpuThrottlingCombobox.select(option);
424 hasSelection = true; 424 hasSelection = true;
425 } 425 }
426 var predefinedRates = new Map([ 426 var predefinedRates = new Map([
427 [1, Common.UIString('No CPU throttling')], 427 [1, Common.UIString('No CPU throttling')], [2, Common.UIString('2\xD7 slow down')],
428 [2, Common.UIString('2\xD7 slowdown')], 428 [5, Common.UIString('5\xD7 slowdown')], [10, Common.UIString('10\xD7 slowd own')],
429 [5, Common.UIString('5\xD7 slowdown')],
430 [10, Common.UIString('10\xD7 slowdown')],
431 [20, Common.UIString('20\xD7 slowdown')] 429 [20, Common.UIString('20\xD7 slowdown')]
432 ]); 430 ]);
433 for (var rate of predefinedRates) 431 for (var rate of predefinedRates)
434 addGroupingOption(rate[1], rate[0]); 432 addGroupingOption(rate[1], rate[0]);
435 } 433 }
436 434
437 _prepareToLoadTimeline() { 435 _prepareToLoadTimeline() {
438 console.assert(this._state === Timeline.TimelinePanel.State.Idle); 436 console.assert(this._state === Timeline.TimelinePanel.State.Idle);
439 this._setState(Timeline.TimelinePanel.State.Loading); 437 this._setState(Timeline.TimelinePanel.State.Loading);
440 } 438 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 this._dropTarget.setEnabled(this._state === state.Idle); 630 this._dropTarget.setEnabled(this._state === state.Idle);
633 } 631 }
634 632
635 _toggleRecording() { 633 _toggleRecording() {
636 if (this._state === Timeline.TimelinePanel.State.Idle) 634 if (this._state === Timeline.TimelinePanel.State.Idle)
637 this._startRecording(true); 635 this._startRecording(true);
638 else if (this._state === Timeline.TimelinePanel.State.Recording) 636 else if (this._state === Timeline.TimelinePanel.State.Recording)
639 this._stopRecording(); 637 this._stopRecording();
640 } 638 }
641 639
642 _garbageCollectButtonClicked() { 640 /**
641 * @param {!Common.Event} event
642 */
643 _garbageCollectButtonClicked(event) {
643 var targets = SDK.targetManager.targets(); 644 var targets = SDK.targetManager.targets();
644 for (var i = 0; i < targets.length; ++i) 645 for (var i = 0; i < targets.length; ++i)
645 targets[i].heapProfilerAgent().collectGarbage(); 646 targets[i].heapProfilerAgent().collectGarbage();
646 } 647 }
647 648
648 _clear() { 649 _clear() {
649 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar kUnusedCSS.get()) 650 if (Runtime.experiments.isEnabled('timelineRuleUsageRecording') && this._mar kUnusedCSS.get())
650 Components.CoverageProfile.instance().reset(); 651 Components.CoverageProfile.instance().reset();
651 652
652 Components.LineLevelProfile.instance().reset(); 653 Components.LineLevelProfile.instance().reset();
(...skipping 1304 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 } 1958 }
1958 1959
1959 /** 1960 /**
1960 * @override 1961 * @override
1961 * @param {!SDK.Target} target 1962 * @param {!SDK.Target} target
1962 */ 1963 */
1963 targetRemoved(target) { 1964 targetRemoved(target) {
1964 this._targets.remove(target, true); 1965 this._targets.remove(target, true);
1965 } 1966 }
1966 }; 1967 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698