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

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

Issue 2243043002: DevTools: Do not remove custom CPU throttling value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 this.registerRequiredCSS("timeline/timelinePanel.css"); 42 this.registerRequiredCSS("timeline/timelinePanel.css");
43 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse); 43 this.element.addEventListener("contextmenu", this._contextMenu.bind(this), f alse);
44 this._dropTarget = new WebInspector.DropTarget(this.element, [WebInspector.D ropTarget.Types.Files, WebInspector.DropTarget.Types.URIList], WebInspector.UISt ring("Drop timeline file or URL here"), this._handleDrop.bind(this)); 44 this._dropTarget = new WebInspector.DropTarget(this.element, [WebInspector.D ropTarget.Types.Files, WebInspector.DropTarget.Types.URIList], WebInspector.UISt ring("Drop timeline file or URL here"), this._handleDrop.bind(this));
45 45
46 this._state = WebInspector.TimelinePanel.State.Idle; 46 this._state = WebInspector.TimelinePanel.State.Idle;
47 this._detailsLinkifier = new WebInspector.Linkifier(); 47 this._detailsLinkifier = new WebInspector.Linkifier();
48 this._windowStartTime = 0; 48 this._windowStartTime = 0;
49 this._windowEndTime = Infinity; 49 this._windowEndTime = Infinity;
50 this._millisecondsToRecordAfterLoadEvent = 3000; 50 this._millisecondsToRecordAfterLoadEvent = 3000;
51 this._toggleRecordAction = /** @type {!WebInspector.Action }*/ (WebInspector .actionRegistry.action("timeline.toggle-recording")); 51 this._toggleRecordAction = /** @type {!WebInspector.Action }*/ (WebInspector .actionRegistry.action("timeline.toggle-recording"));
52 this._customCPUThrottlingRate = 0;
52 53
53 /** @type {!Array<!WebInspector.TimelineModel.Filter>} */ 54 /** @type {!Array<!WebInspector.TimelineModel.Filter>} */
54 this._filters = []; 55 this._filters = [];
55 if (!Runtime.experiments.isEnabled("timelineShowAllEvents")) { 56 if (!Runtime.experiments.isEnabled("timelineShowAllEvents")) {
56 this._filters.push(WebInspector.TimelineUIUtils.visibleEventsFilter()); 57 this._filters.push(WebInspector.TimelineUIUtils.visibleEventsFilter());
57 this._filters.push(new WebInspector.ExcludeTopLevelFilter()); 58 this._filters.push(new WebInspector.ExcludeTopLevelFilter());
58 } 59 }
59 60
60 // Create models. 61 // Create models.
61 this._tracingModelBackingStorage = new WebInspector.TempFileBackingStorage(" tracing"); 62 this._tracingModelBackingStorage = new WebInspector.TempFileBackingStorage(" tracing");
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 cpuThrottlingCombobox.select(option); 431 cpuThrottlingCombobox.select(option);
431 hasSelection = true; 432 hasSelection = true;
432 } 433 }
433 var predefinedRates = new Map([ 434 var predefinedRates = new Map([
434 [1, WebInspector.UIString("No CPU throttling")], 435 [1, WebInspector.UIString("No CPU throttling")],
435 [2, WebInspector.UIString("High end device (2\xD7 slowdown)")], 436 [2, WebInspector.UIString("High end device (2\xD7 slowdown)")],
436 [5, WebInspector.UIString("Low end device (5\xD7 slowdown)")] 437 [5, WebInspector.UIString("Low end device (5\xD7 slowdown)")]
437 ]); 438 ]);
438 for (var rate of predefinedRates) 439 for (var rate of predefinedRates)
439 addGroupingOption(rate[1], rate[0]); 440 addGroupingOption(rate[1], rate[0]);
440 var customRateText = predefinedRates.has(currentRate) 441 if (this._customCPUThrottlingRate && !predefinedRates.has(this._customCP UThrottlingRate))
441 ? WebInspector.UIString("Custom rate\u2026") 442 addGroupingOption(WebInspector.UIString("Custom rate (%d\xD7 slowdow n)", this._customCPUThrottlingRate), this._customCPUThrottlingRate);
442 : WebInspector.UIString("Custom rate (%d\xD7 slowdown)", currentRate ); 443 addGroupingOption(WebInspector.UIString("Set custom rate\u2026"), 0);
443 addGroupingOption(customRateText, 0);
444 }, 444 },
445 445
446 _prepareToLoadTimeline: function() 446 _prepareToLoadTimeline: function()
447 { 447 {
448 console.assert(this._state === WebInspector.TimelinePanel.State.Idle); 448 console.assert(this._state === WebInspector.TimelinePanel.State.Idle);
449 this._setState(WebInspector.TimelinePanel.State.Loading); 449 this._setState(WebInspector.TimelinePanel.State.Loading);
450 }, 450 },
451 451
452 _createFileSelector: function() 452 _createFileSelector: function()
453 { 453 {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 return; 578 return;
579 var value = this._cpuThrottlingCombobox.selectedOption().value; 579 var value = this._cpuThrottlingCombobox.selectedOption().value;
580 var isLastOption = this._cpuThrottlingCombobox.selectedIndex() === this. _cpuThrottlingCombobox.size() - 1; 580 var isLastOption = this._cpuThrottlingCombobox.selectedIndex() === this. _cpuThrottlingCombobox.size() - 1;
581 this._populateCPUThrottingCombobox(); 581 this._populateCPUThrottingCombobox();
582 var resultPromise = isLastOption 582 var resultPromise = isLastOption
583 ? WebInspector.TimelinePanel.CustomCPUThrottlingRateDialog.show(this ._cpuThrottlingCombobox.element) 583 ? WebInspector.TimelinePanel.CustomCPUThrottlingRateDialog.show(this ._cpuThrottlingCombobox.element)
584 : Promise.resolve(value); 584 : Promise.resolve(value);
585 resultPromise.then(text => { 585 resultPromise.then(text => {
586 var value = Number.parseFloat(text); 586 var value = Number.parseFloat(text);
587 if (value >= 1) { 587 if (value >= 1) {
588 if (isLastOption)
589 this._customCPUThrottlingRate = value;
588 this._cpuThrottlingManager.setRate(value); 590 this._cpuThrottlingManager.setRate(value);
589 this._populateCPUThrottingCombobox(); 591 this._populateCPUThrottingCombobox();
590 } 592 }
591 }); 593 });
592 }, 594 },
593 595
594 /** 596 /**
595 * @param {boolean} enabled 597 * @param {boolean} enabled
596 */ 598 */
597 _setUIControlsEnabled: function(enabled) 599 _setUIControlsEnabled: function(enabled)
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
2117 _onKeyDown: function(event) 2119 _onKeyDown: function(event)
2118 { 2120 {
2119 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code) { 2121 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Enter.code) {
2120 event.preventDefault(); 2122 event.preventDefault();
2121 this._apply(); 2123 this._apply();
2122 } 2124 }
2123 }, 2125 },
2124 2126
2125 __proto__: WebInspector.HBox.prototype 2127 __proto__: WebInspector.HBox.prototype
2126 } 2128 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698