chrome-devtools-frontend 1.0.1515988 → 1.0.1518653

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/docs/checklist/README.md +2 -2
  2. package/docs/checklist/javascript.md +1 -1
  3. package/docs/contributing/README.md +1 -1
  4. package/docs/contributing/settings-experiments-features.md +9 -8
  5. package/docs/cookbook/devtools_on_devtools.md +2 -2
  6. package/docs/cookbook/localization.md +10 -10
  7. package/docs/devtools-protocol.md +9 -8
  8. package/docs/ecosystem/automatic_workspace_folders.md +3 -3
  9. package/docs/get_the_code.md +0 -2
  10. package/docs/styleguide/ux/components.md +166 -85
  11. package/docs/styleguide/ux/numbers.md +3 -4
  12. package/front_end/core/common/README.md +13 -12
  13. package/front_end/core/host/GdpClient.ts +16 -1
  14. package/front_end/core/host/UserMetrics.ts +8 -2
  15. package/front_end/core/root/Runtime.ts +13 -0
  16. package/front_end/core/sdk/CSSMatchedStyles.ts +5 -1
  17. package/front_end/entrypoints/main/MainImpl.ts +6 -3
  18. package/front_end/generated/InspectorBackendCommands.js +10 -7
  19. package/front_end/generated/SupportedCSSProperties.js +21 -7
  20. package/front_end/generated/protocol-mapping.d.ts +16 -1
  21. package/front_end/generated/protocol-proxy-api.d.ts +13 -1
  22. package/front_end/generated/protocol.ts +95 -0
  23. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +170 -54
  24. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +14 -181
  25. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +13 -315
  26. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +224 -50
  27. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +310 -11
  28. package/front_end/models/ai_assistance/performance/AIContext.ts +15 -2
  29. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +41 -19
  30. package/front_end/models/badges/Badge.ts +8 -3
  31. package/front_end/models/badges/CodeWhispererBadge.ts +2 -4
  32. package/front_end/models/badges/StarterBadge.ts +2 -2
  33. package/front_end/models/badges/UserBadges.ts +59 -6
  34. package/front_end/models/formatter/FormatterWorkerPool.ts +3 -3
  35. package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
  36. package/front_end/models/trace/README.md +28 -1
  37. package/front_end/models/trace/handlers/UserTimingsHandler.ts +1 -1
  38. package/front_end/models/trace/helpers/Trace.ts +99 -43
  39. package/front_end/models/trace/types/TraceEvents.ts +9 -0
  40. package/front_end/panels/accessibility/ARIAAttributesView.ts +113 -191
  41. package/front_end/panels/accessibility/AccessibilityNodeView.ts +9 -9
  42. package/front_end/panels/accessibility/AccessibilitySubPane.ts +6 -4
  43. package/front_end/panels/accessibility/accessibilityProperties.css +2 -0
  44. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +16 -2
  45. package/front_end/panels/ai_assistance/components/ChatView.ts +9 -10
  46. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +42 -0
  47. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +32 -9
  48. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +7 -1
  49. package/front_end/panels/common/BadgeNotification.ts +67 -15
  50. package/front_end/panels/common/GdpSignUpDialog.ts +18 -9
  51. package/front_end/panels/console/ConsolePrompt.ts +1 -1
  52. package/front_end/panels/console/ConsoleView.ts +6 -2
  53. package/front_end/panels/elements/ComputedStyleWidget.ts +1 -2
  54. package/front_end/panels/elements/ElementsPanel.ts +4 -0
  55. package/front_end/panels/elements/ElementsTreeElement.ts +18 -0
  56. package/front_end/panels/elements/ElementsTreeOutline.ts +13 -0
  57. package/front_end/panels/elements/LayoutPane.ts +1 -1
  58. package/front_end/panels/elements/StylePropertyTreeElement.ts +21 -6
  59. package/front_end/panels/media/TickingFlameChart.ts +1 -1
  60. package/front_end/panels/network/NetworkLogView.ts +5 -1
  61. package/front_end/panels/profiler/HeapSnapshotView.ts +34 -19
  62. package/front_end/panels/search/SearchResultsPane.ts +126 -145
  63. package/front_end/panels/search/SearchView.ts +43 -59
  64. package/front_end/panels/settings/components/SyncSection.ts +16 -8
  65. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +6 -1
  66. package/front_end/panels/sources/OutlineQuickOpen.ts +3 -1
  67. package/front_end/panels/sources/SourcesPanel.ts +3 -0
  68. package/front_end/panels/timeline/AppenderUtils.ts +2 -2
  69. package/front_end/panels/timeline/ExtensionTrackAppender.ts +13 -4
  70. package/front_end/panels/timeline/GPUTrackAppender.ts +2 -1
  71. package/front_end/panels/timeline/InteractionsTrackAppender.ts +5 -1
  72. package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +2 -1
  73. package/front_end/panels/timeline/ThreadAppender.ts +12 -3
  74. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +9 -4
  75. package/front_end/panels/timeline/TimelinePanel.ts +3 -2
  76. package/front_end/panels/timeline/TimelineUIUtils.ts +18 -12
  77. package/front_end/panels/timeline/TimingsTrackAppender.ts +6 -1
  78. package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +95 -82
  79. package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
  80. package/front_end/panels/timeline/components/cpuThrottlingSelector.css +17 -15
  81. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +3 -0
  82. package/front_end/third_party/chromium/README.chromium +1 -1
  83. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  84. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  85. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +6 -9
  86. package/front_end/third_party/codemirror.next/package.json +2 -1
  87. package/front_end/third_party/diff/README.chromium +1 -0
  88. package/front_end/third_party/puppeteer/README.chromium +2 -2
  89. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
  90. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js +0 -20
  91. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Accessibility.js.map +1 -1
  92. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
  93. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  95. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +1 -1
  97. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  98. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  99. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +2 -23
  100. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js +0 -20
  101. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Accessibility.js.map +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
  103. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
  104. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +1 -1
  105. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +1 -1
  106. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  107. package/front_end/third_party/puppeteer/package/package.json +1 -1
  108. package/front_end/third_party/puppeteer/package/src/cdp/Accessibility.ts +1 -21
  109. package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
  110. package/front_end/third_party/puppeteer/package/src/revisions.ts +1 -1
  111. package/front_end/ui/components/text_editor/config.ts +36 -8
  112. package/front_end/ui/components/tooltips/Tooltip.ts +71 -34
  113. package/front_end/ui/legacy/README.md +33 -24
  114. package/front_end/ui/legacy/SearchableView.ts +19 -26
  115. package/front_end/ui/legacy/TextPrompt.ts +166 -1
  116. package/front_end/ui/legacy/Treeoutline.ts +16 -2
  117. package/front_end/ui/legacy/UIUtils.ts +15 -2
  118. package/front_end/ui/legacy/XElement.ts +0 -43
  119. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +20 -4
  120. package/front_end/ui/visual_logging/KnownContextValues.ts +24 -6
  121. package/front_end/ui/visual_logging/README.md +43 -27
  122. package/package.json +1 -1
@@ -376,9 +376,10 @@ const UIStrings = {
376
376
  compositingFailedUnknownReason: 'Unknown Reason',
377
377
 
378
378
  /**
379
- * @description Text for the execution stack trace
379
+ * @description Text for the execution "stack trace". It is not technically a stack trace, because it points to the beginning of each function
380
+ * and not to each call site, so we call it a function stack instead to avoid confusion.
380
381
  */
381
- stackTrace: 'Stack trace',
382
+ functionStack: 'Function stack',
382
383
  /**
383
384
  * @description Text used to show any invalidations for a particular event that caused the browser to have to do more work to update the page.
384
385
  * @example {2} PH1
@@ -880,9 +881,9 @@ export class TimelineUIUtils {
880
881
  }
881
882
  }
882
883
 
883
- static maybeCreateLinkElement(url: string): HTMLElement|null {
884
- const protocol = URL.parse(url)?.protocol;
885
- if (!protocol || protocol.length === 0) {
884
+ static maybeCreateLinkElement(url: string): Element|null {
885
+ const parsedURL = new Common.ParsedURL.ParsedURL(url);
886
+ if (!parsedURL.scheme) {
886
887
  return null;
887
888
  }
888
889
 
@@ -890,11 +891,16 @@ export class TimelineUIUtils {
890
891
  if (!splitResult) {
891
892
  return null;
892
893
  }
893
- const {lineNumber, columnNumber} = splitResult;
894
- const options = {text: url, lineNumber, columnNumber} as LegacyComponents.Linkifier.LinkifyURLOptions;
895
- const linkElement =
896
- LegacyComponents.Linkifier.Linkifier.linkifyURL(url as Platform.DevToolsPath.UrlString, (options));
897
- return linkElement;
894
+ const {url: rawURL, lineNumber, columnNumber} = splitResult;
895
+
896
+ const options = {
897
+ lineNumber,
898
+ columnNumber,
899
+ showColumnNumber: true,
900
+ omitOrigin: true,
901
+ };
902
+
903
+ return LegacyComponents.Linkifier.Linkifier.linkifyURL(rawURL as Platform.DevToolsPath.UrlString, options);
898
904
  }
899
905
 
900
906
  /**
@@ -1706,10 +1712,10 @@ export class TimelineUIUtils {
1706
1712
  parsedTrace: Trace.TraceModel.ParsedTrace): Promise<void> {
1707
1713
  const {startTime} = Trace.Helpers.Timing.eventTimingsMilliSeconds(event);
1708
1714
  let initiatorStackLabel = i18nString(UIStrings.initiatorStackTrace);
1709
- let stackLabel = i18nString(UIStrings.stackTrace);
1715
+ let stackLabel = i18nString(UIStrings.functionStack);
1710
1716
  const stackTraceForEvent = Trace.Extras.StackTraceForEvent.get(event, parsedTrace.data);
1711
1717
  if (stackTraceForEvent?.callFrames.length || stackTraceForEvent?.description || stackTraceForEvent?.parent) {
1712
- contentHelper.addSection(i18nString(UIStrings.stackTrace));
1718
+ contentHelper.addSection(i18nString(UIStrings.functionStack));
1713
1719
  contentHelper.createChildStackTraceElement(stackTraceForEvent);
1714
1720
  // TODO(andoli): also build stack trace component for other events
1715
1721
  // that have a stack trace using the StackTraceForEvent helper.
@@ -4,6 +4,7 @@
4
4
  import type * as Common from '../../core/common/common.js';
5
5
  import * as i18n from '../../core/i18n/i18n.js';
6
6
  import * as Trace from '../../models/trace/trace.js';
7
+ import * as PerfUI from '../../ui/legacy/components/perf_ui/perf_ui.js';
7
8
 
8
9
  import {buildGroupStyle, buildTrackHeader, getDurationString} from './AppenderUtils.js';
9
10
  import {
@@ -103,7 +104,11 @@ export class TimingsTrackAppender implements TrackAppender {
103
104
  */
104
105
  #appendTrackHeaderAtLevel(currentLevel: number, expanded?: boolean): void {
105
106
  const trackIsCollapsible = this.#parsedTrace.data.UserTimings.performanceMeasures.length > 0;
106
- const style = buildGroupStyle({useFirstLineForOverview: true, collapsible: trackIsCollapsible});
107
+ const style = buildGroupStyle({
108
+ useFirstLineForOverview: true,
109
+ collapsible: trackIsCollapsible ? PerfUI.FlameChart.GroupCollapsibleState.IF_MULTI_ROW :
110
+ PerfUI.FlameChart.GroupCollapsibleState.NEVER,
111
+ });
107
112
  const group = buildTrackHeader(
108
113
  VisualLoggingTrackName.TIMINGS, currentLevel, i18nString(UIStrings.timings), style, /* selectable= */ true,
109
114
  expanded);
@@ -1,7 +1,6 @@
1
1
  // Copyright 2024 The Chromium Authors
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
- /* eslint-disable rulesdir/no-lit-render-outside-of-view */
5
4
 
6
5
  import '../../../ui/components/icon_button/icon_button.js';
7
6
  import '../../../ui/components/menus/menus.js';
@@ -9,15 +8,15 @@ import '../../../ui/components/menus/menus.js';
9
8
  import * as Common from '../../../core/common/common.js';
10
9
  import * as i18n from '../../../core/i18n/i18n.js';
11
10
  import * as SDK from '../../../core/sdk/sdk.js';
12
- import * as ComponentHelpers from '../../../ui/components/helpers/helpers.js';
13
11
  import type * as Menus from '../../../ui/components/menus/menus.js';
12
+ import * as UI from '../../../ui/legacy/legacy.js';
14
13
  import * as Lit from '../../../ui/lit/lit.js';
15
14
  import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
16
15
  import * as MobileThrottling from '../../mobile_throttling/mobile_throttling.js';
17
16
 
18
17
  import cpuThrottlingSelectorStyles from './cpuThrottlingSelector.css.js';
19
18
 
20
- const {html} = Lit;
19
+ const {render, html} = Lit;
21
20
 
22
21
  const UIStrings = {
23
22
  /**
@@ -62,37 +61,110 @@ interface CPUThrottlingGroup {
62
61
  showCustomAddOption?: boolean;
63
62
  }
64
63
 
65
- export class CPUThrottlingSelector extends HTMLElement {
66
- readonly #shadow = this.attachShadow({mode: 'open'});
64
+ interface ViewInput {
65
+ recommendedOption: SDK.CPUThrottlingManager.CPUThrottlingOption|null;
66
+ currentOption: SDK.CPUThrottlingManager.CPUThrottlingOption;
67
+ groups: CPUThrottlingGroup[];
68
+ throttling: SDK.CPUThrottlingManager.CalibratedCPUThrottling;
69
+ onMenuItemSelected: (event: Menus.SelectMenu.SelectMenuItemSelectedEvent) => void;
70
+ onCalibrateClick: () => void;
71
+ }
72
+
73
+ export const DEFAULT_VIEW = (input: ViewInput, _output: undefined, target: HTMLElement): void => {
74
+ let recommendedInfoEl;
75
+ if (input.recommendedOption && input.currentOption === SDK.CPUThrottlingManager.NoThrottlingOption) {
76
+ recommendedInfoEl = html`<devtools-icon
77
+ title=${i18nString(UIStrings.recommendedThrottlingReason)}
78
+ name=info></devtools-icon>`;
79
+ }
67
80
 
81
+ const selectionTitle = input.currentOption.title();
82
+ const hasCalibratedOnce = input.throttling.low || input.throttling.mid;
83
+ const calibrationLabel = hasCalibratedOnce ? i18nString(UIStrings.recalibrate) : i18nString(UIStrings.calibrate);
84
+
85
+ // clang-format off
86
+ /* eslint-disable rulesdir/no-deprecated-component-usages */
87
+ const template = html`
88
+ <style>${cpuThrottlingSelectorStyles}</style>
89
+ <devtools-select-menu
90
+ @selectmenuselected=${input.onMenuItemSelected}
91
+ .showDivider=${true}
92
+ .showArrow=${true}
93
+ .sideButton=${false}
94
+ .showSelectedItem=${true}
95
+ .jslogContext=${'cpu-throttling'}
96
+ .buttonTitle=${i18nString(UIStrings.cpu, {PH1: selectionTitle})}
97
+ .title=${i18nString(UIStrings.cpuThrottling, {PH1: selectionTitle})}
98
+ >
99
+ ${input.groups.map(group => {
100
+ return html`
101
+ <devtools-menu-group .name=${group.name} .title=${group.name}>
102
+ ${group.items.map(option => {
103
+ const title = option === input.recommendedOption ? i18nString(UIStrings.recommendedThrottling, {PH1: option.title()}) : option.title();
104
+ const rate = option.rate();
105
+ return html`
106
+ <devtools-menu-item
107
+ .value=${option.calibratedDeviceType ?? rate}
108
+ .selected=${input.currentOption === option}
109
+ .disabled=${rate === 0}
110
+ .title=${title}
111
+ jslog=${VisualLogging.item(option.jslogContext).track({click: true})}
112
+ >
113
+ ${title}
114
+ </devtools-menu-item>
115
+ `;
116
+ })}
117
+ ${group.name === 'Calibrated presets' ? html`<devtools-menu-item
118
+ .value=${-1 /* This won't be displayed unless it has some value. */}
119
+ .title=${calibrationLabel}
120
+ jslog=${VisualLogging.action('cpu-throttling-selector-calibrate').track({click: true})}
121
+ @click=${input.onCalibrateClick}
122
+ >
123
+ ${calibrationLabel}
124
+ </devtools-menu-item>` : Lit.nothing}
125
+ </devtools-menu-group>`;
126
+ })}
127
+ </devtools-select-menu>
128
+ ${recommendedInfoEl}
129
+ `;
130
+ // clang-format on
131
+ render(template, target);
132
+ };
133
+
134
+ type View = typeof DEFAULT_VIEW;
135
+
136
+ export class CPUThrottlingSelector extends UI.Widget.Widget {
68
137
  #currentOption: SDK.CPUThrottlingManager.CPUThrottlingOption;
69
138
  #recommendedOption: SDK.CPUThrottlingManager.CPUThrottlingOption|null = null;
70
139
  #groups: CPUThrottlingGroup[] = [];
71
140
  #calibratedThrottlingSetting: Common.Settings.Setting<SDK.CPUThrottlingManager.CalibratedCPUThrottling>;
141
+ readonly #view: View;
72
142
 
73
- constructor() {
74
- super();
143
+ constructor(element?: HTMLElement, view: View = DEFAULT_VIEW) {
144
+ super(element);
75
145
  this.#currentOption = SDK.CPUThrottlingManager.CPUThrottlingManager.instance().cpuThrottlingOption();
76
146
  this.#calibratedThrottlingSetting =
77
147
  Common.Settings.Settings.instance().createSetting<SDK.CPUThrottlingManager.CalibratedCPUThrottling>(
78
148
  'calibrated-cpu-throttling', {}, Common.Settings.SettingStorageType.GLOBAL);
79
149
  this.#resetGroups();
80
- this.#render();
150
+ this.#view = view;
81
151
  }
82
152
 
83
153
  set recommendedOption(recommendedOption: SDK.CPUThrottlingManager.CPUThrottlingOption|null) {
84
154
  this.#recommendedOption = recommendedOption;
85
- void ComponentHelpers.ScheduledRender.scheduleRender(this, this.#render);
155
+ this.requestUpdate();
86
156
  }
87
157
 
88
- connectedCallback(): void {
158
+ override wasShown(): void {
159
+ super.wasShown();
89
160
  SDK.CPUThrottlingManager.CPUThrottlingManager.instance().addEventListener(
90
161
  SDK.CPUThrottlingManager.Events.RATE_CHANGED, this.#onOptionChange, this);
91
162
  this.#calibratedThrottlingSetting.addChangeListener(this.#onCalibratedSettingChanged, this);
92
163
  this.#onOptionChange();
93
164
  }
94
165
 
95
- disconnectedCallback(): void {
166
+ override willHide(): void {
167
+ super.willHide();
96
168
  this.#calibratedThrottlingSetting.removeChangeListener(this.#onCalibratedSettingChanged, this);
97
169
  SDK.CPUThrottlingManager.CPUThrottlingManager.instance().removeEventListener(
98
170
  SDK.CPUThrottlingManager.Events.RATE_CHANGED, this.#onOptionChange, this);
@@ -101,12 +173,12 @@ export class CPUThrottlingSelector extends HTMLElement {
101
173
  #onOptionChange(): void {
102
174
  this.#currentOption = SDK.CPUThrottlingManager.CPUThrottlingManager.instance().cpuThrottlingOption();
103
175
 
104
- void ComponentHelpers.ScheduledRender.scheduleRender(this, this.#render);
176
+ this.requestUpdate();
105
177
  }
106
178
 
107
179
  #onCalibratedSettingChanged(): void {
108
180
  this.#resetGroups();
109
- void ComponentHelpers.ScheduledRender.scheduleRender(this, this.#render);
181
+ this.requestUpdate();
110
182
  }
111
183
 
112
184
  #onMenuItemSelected(event: Menus.SelectMenu.SelectMenuItemSelectedEvent): void {
@@ -147,74 +219,15 @@ export class CPUThrottlingSelector extends HTMLElement {
147
219
  ];
148
220
  }
149
221
 
150
- #render = (): void => {
151
- let recommendedInfoEl;
152
- if (this.#recommendedOption && this.#currentOption === SDK.CPUThrottlingManager.NoThrottlingOption) {
153
- recommendedInfoEl = html`<devtools-icon
154
- title=${i18nString(UIStrings.recommendedThrottlingReason)}
155
- name=info></devtools-icon>`;
156
- }
157
-
158
- const selectionTitle = this.#currentOption.title();
159
- const setting = this.#calibratedThrottlingSetting.get();
160
- const hasCalibratedOnce = setting.low || setting.mid;
161
- const calibrationLabel = hasCalibratedOnce ? i18nString(UIStrings.recalibrate) : i18nString(UIStrings.calibrate);
162
-
163
- // clang-format off
164
- /* eslint-disable rulesdir/no-deprecated-component-usages */
165
- const output = html`
166
- <style>${cpuThrottlingSelectorStyles}</style>
167
- <devtools-select-menu
168
- @selectmenuselected=${this.#onMenuItemSelected}
169
- .showDivider=${true}
170
- .showArrow=${true}
171
- .sideButton=${false}
172
- .showSelectedItem=${true}
173
- .jslogContext=${'cpu-throttling'}
174
- .buttonTitle=${i18nString(UIStrings.cpu, {PH1: selectionTitle})}
175
- .title=${i18nString(UIStrings.cpuThrottling, {PH1: selectionTitle})}
176
- >
177
- ${this.#groups.map(group => {
178
- return html`
179
- <devtools-menu-group .name=${group.name} .title=${group.name}>
180
- ${group.items.map(option => {
181
- const title = option === this.#recommendedOption ? i18nString(UIStrings.recommendedThrottling, {PH1: option.title()}) : option.title();
182
- const rate = option.rate();
183
- return html`
184
- <devtools-menu-item
185
- .value=${option.calibratedDeviceType ?? rate}
186
- .selected=${this.#currentOption === option}
187
- .disabled=${rate === 0}
188
- .title=${title}
189
- jslog=${VisualLogging.item(option.jslogContext).track({click: true})}
190
- >
191
- ${title}
192
- </devtools-menu-item>
193
- `;
194
- })}
195
- ${group.name === 'Calibrated presets' ? html`<devtools-menu-item
196
- .value=${-1 /* This won't be displayed unless it has some value. */}
197
- .title=${calibrationLabel}
198
- jslog=${VisualLogging.action('cpu-throttling-selector-calibrate').track({click: true})}
199
- @click=${this.#onCalibrateClick}
200
- >
201
- ${calibrationLabel}
202
- </devtools-menu-item>` : Lit.nothing}
203
- </devtools-menu-group>`;
204
- })}
205
- </devtools-select-menu>
206
- ${recommendedInfoEl}
207
- `;
208
- /* eslint-enable rulesdir/no-deprecated-component-usages */
209
- // clang-format on
210
- Lit.render(output, this.#shadow, {host: this});
211
- };
212
- }
213
-
214
- customElements.define('devtools-cpu-throttling-selector', CPUThrottlingSelector);
215
-
216
- declare global {
217
- interface HTMLElementTagNameMap {
218
- 'devtools-cpu-throttling-selector': CPUThrottlingSelector;
222
+ override async performUpdate(): Promise<void> {
223
+ const input: ViewInput = {
224
+ recommendedOption: this.#recommendedOption,
225
+ currentOption: this.#currentOption,
226
+ groups: this.#groups,
227
+ throttling: this.#calibratedThrottlingSetting.get(),
228
+ onMenuItemSelected: this.#onMenuItemSelected.bind(this),
229
+ onCalibrateClick: this.#onCalibrateClick.bind(this),
230
+ };
231
+ this.#view(input, undefined, this.contentElement);
219
232
  }
220
233
  }
@@ -5,7 +5,6 @@
5
5
  /* eslint-disable rulesdir/no-lit-render-outside-of-view */
6
6
 
7
7
  import '../../../ui/components/icon_button/icon_button.js';
8
- import './CPUThrottlingSelector.js';
9
8
  import './FieldSettingsDialog.js';
10
9
  import './NetworkThrottlingSelector.js';
11
10
  import '../../../ui/components/menus/menus.js';
@@ -30,6 +29,7 @@ import * as Lit from '../../../ui/lit/lit.js';
30
29
  import * as VisualLogging from '../../../ui/visual_logging/visual_logging.js';
31
30
  import {getThrottlingRecommendations} from '../utils/Helpers.js';
32
31
 
32
+ import {CPUThrottlingSelector} from './CPUThrottlingSelector.js';
33
33
  import {md} from './insights/Helpers.js';
34
34
  import liveMetricsViewStyles from './liveMetricsView.css.js';
35
35
  import type {MetricCardData} from './MetricCard.js';
@@ -638,7 +638,7 @@ export class LiveMetricsView extends LegacyWrapper.LegacyWrapper.WrappableCompon
638
638
  </ul>
639
639
  ` : nothing}
640
640
  <div class="environment-option">
641
- <devtools-cpu-throttling-selector .recommendedOption=${recs.cpuOption}></devtools-cpu-throttling-selector>
641
+ <devtools-widget .widgetConfig=${UI.Widget.widgetConfig(CPUThrottlingSelector, {recommendedOption: recs.cpuOption})}></devtools-widget>
642
642
  </div>
643
643
  <div class="environment-option">
644
644
  <devtools-network-throttling-selector .recommendedConditions=${recs.networkConditions}></devtools-network-throttling-selector>
@@ -4,21 +4,23 @@
4
4
  * found in the LICENSE file.
5
5
  */
6
6
 
7
- :host {
8
- display: flex;
9
- align-items: center;
10
- max-width: 100%;
11
- height: 20px;
12
- }
7
+ @scope to (devtools-widget > *) {
8
+ :scope {
9
+ display: flex;
10
+ align-items: center;
11
+ max-width: 100%;
12
+ height: 20px;
13
+ }
13
14
 
14
- devtools-icon[name="info"] {
15
- margin-left: var(--sys-size-3);
16
- width: var(--sys-size-8);
17
- height: var(--sys-size-8);
18
- }
15
+ devtools-icon[name="info"] {
16
+ margin-left: var(--sys-size-3);
17
+ width: var(--sys-size-8);
18
+ height: var(--sys-size-8);
19
+ }
19
20
 
20
- devtools-select-menu {
21
- min-width: 160px;
22
- max-width: 100%;
23
- height: 20px;
21
+ devtools-select-menu {
22
+ min-width: 160px;
23
+ max-width: 100%;
24
+ height: 20px;
25
+ }
24
26
  }
@@ -8,6 +8,7 @@ import '../../../../ui/components/markdown_view/markdown_view.js';
8
8
  import * as i18n from '../../../../core/i18n/i18n.js';
9
9
  import * as Root from '../../../../core/root/root.js';
10
10
  import * as AIAssistance from '../../../../models/ai_assistance/ai_assistance.js';
11
+ import * as Badges from '../../../../models/badges/badges.js';
11
12
  import type {InsightModel} from '../../../../models/trace/insights/types.js';
12
13
  import type * as Trace from '../../../../models/trace/trace.js';
13
14
  import * as Buttons from '../../../../ui/components/buttons/buttons.js';
@@ -195,6 +196,8 @@ export abstract class BaseInsightComponent<T extends InsightModel> extends HTMLE
195
196
  UI.Context.Context.instance().setFlavor(AIAssistance.AgentFocus, focus.withInsight(this.model));
196
197
  }
197
198
 
199
+ Badges.UserBadges.instance().recordAction(Badges.BadgeAction.PERFORMANCE_INSIGHT_CLICKED);
200
+
198
201
  this.sharedTableState.selectedRowEl?.classList.remove('selected');
199
202
  this.sharedTableState.selectedRowEl = null;
200
203
  this.sharedTableState.selectionIsSticky = false;
@@ -1,7 +1,7 @@
1
1
  Name: Dependencies sourced from the upstream `chromium` repository
2
2
  URL: https://source.chromium.org/chromium/chromium/src/+/main:components/variations/proto/devtools/
3
3
  Version: N/A
4
- Revision: a53252f55270b0a53536cabc8402ef6457ee9ab9
4
+ Revision: 8b6a2b940e6b293e99d648cdf34f8d26ae731d64
5
5
  Update Mechanism: Manual (https://crbug.com/428069060)
6
6
  License: BSD-3-Clause
7
7
  License File: LICENSE