chrome-devtools-frontend 1.0.1516909 → 1.0.1519267

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 (162) hide show
  1. package/config/owner/COMMON_OWNERS +2 -2
  2. package/docs/checklist/README.md +2 -2
  3. package/docs/checklist/javascript.md +1 -1
  4. package/docs/contributing/README.md +1 -1
  5. package/docs/contributing/settings-experiments-features.md +9 -8
  6. package/docs/cookbook/devtools_on_devtools.md +2 -2
  7. package/docs/cookbook/localization.md +10 -10
  8. package/docs/devtools-protocol.md +9 -8
  9. package/docs/ecosystem/automatic_workspace_folders.md +3 -3
  10. package/docs/get_the_code.md +0 -2
  11. package/docs/styleguide/ux/components.md +166 -85
  12. package/docs/styleguide/ux/numbers.md +3 -4
  13. package/eslint.config.mjs +1 -0
  14. package/front_end/core/common/README.md +13 -12
  15. package/front_end/core/host/GdpClient.ts +16 -1
  16. package/front_end/core/host/UserMetrics.ts +4 -2
  17. package/front_end/core/root/Runtime.ts +13 -0
  18. package/front_end/core/sdk/CSSMatchedStyles.ts +5 -1
  19. package/front_end/core/sdk/EnhancedTracesParser.ts +5 -5
  20. package/front_end/core/sdk/RehydratingConnection.snapshot.txt +211 -0
  21. package/front_end/core/sdk/TargetManager.ts +4 -0
  22. package/front_end/entrypoints/main/MainImpl.ts +6 -3
  23. package/front_end/generated/InspectorBackendCommands.js +10 -7
  24. package/front_end/generated/SupportedCSSProperties.js +40 -11
  25. package/front_end/generated/protocol-mapping.d.ts +16 -1
  26. package/front_end/generated/protocol-proxy-api.d.ts +13 -1
  27. package/front_end/generated/protocol.ts +95 -0
  28. package/front_end/models/ai_assistance/agents/AiAgent.ts +57 -10
  29. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +119 -51
  30. package/front_end/models/ai_assistance/agents/StylingAgent.ts +0 -31
  31. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +14 -181
  32. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +19 -315
  33. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +224 -50
  34. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +310 -11
  35. package/front_end/models/ai_assistance/performance/AIContext.ts +15 -2
  36. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +22 -11
  37. package/front_end/models/badges/AiExplorerBadge.ts +19 -3
  38. package/front_end/models/badges/Badge.ts +10 -3
  39. package/front_end/models/badges/CodeWhispererBadge.ts +3 -4
  40. package/front_end/models/badges/DOMDetectiveBadge.ts +1 -0
  41. package/front_end/models/badges/SpeedsterBadge.ts +1 -0
  42. package/front_end/models/badges/StarterBadge.ts +3 -2
  43. package/front_end/models/badges/UserBadges.ts +21 -3
  44. package/front_end/models/badges/badges.ts +1 -0
  45. package/front_end/models/javascript_metadata/NativeFunctions.js +2 -2
  46. package/front_end/models/trace/EventsSerializer.ts +4 -3
  47. package/front_end/models/trace/README.md +28 -1
  48. package/front_end/models/trace/handlers/UserInteractionsHandler.ts +101 -73
  49. package/front_end/models/trace/handlers/UserTimingsHandler.ts +1 -1
  50. package/front_end/models/trace/helpers/Timing.ts +1 -1
  51. package/front_end/models/trace/helpers/Trace.ts +99 -43
  52. package/front_end/models/trace/types/TraceEvents.ts +9 -0
  53. package/front_end/panels/accessibility/ARIAAttributesView.ts +113 -191
  54. package/front_end/panels/accessibility/AccessibilityNodeView.ts +9 -9
  55. package/front_end/panels/accessibility/AccessibilitySubPane.ts +6 -4
  56. package/front_end/panels/accessibility/accessibilityProperties.css +2 -0
  57. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +20 -3
  58. package/front_end/panels/ai_assistance/components/ChatView.ts +9 -10
  59. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +44 -0
  60. package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +2 -2
  61. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +32 -9
  62. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +7 -1
  63. package/front_end/panels/common/BadgeNotification.ts +21 -5
  64. package/front_end/panels/common/GdpSignUpDialog.ts +20 -12
  65. package/front_end/panels/console/ConsolePrompt.ts +1 -1
  66. package/front_end/panels/console/ConsoleView.ts +6 -2
  67. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +5 -5
  68. package/front_end/panels/elements/ElementsPanel.ts +4 -0
  69. package/front_end/panels/elements/ElementsTreeElement.ts +18 -0
  70. package/front_end/panels/elements/ElementsTreeOutline.ts +13 -0
  71. package/front_end/panels/elements/StylePropertyTreeElement.ts +21 -6
  72. package/front_end/panels/media/TickingFlameChart.ts +1 -1
  73. package/front_end/panels/profiler/HeapSnapshotView.ts +34 -19
  74. package/front_end/panels/recorder/components/RecordingView.ts +2 -2
  75. package/front_end/panels/search/SearchResultsPane.ts +167 -152
  76. package/front_end/panels/search/SearchView.ts +36 -26
  77. package/front_end/panels/search/searchResultsPane.css +9 -0
  78. package/front_end/panels/security/CookieControlsView.ts +2 -1
  79. package/front_end/panels/settings/AISettingsTab.ts +6 -3
  80. package/front_end/panels/settings/components/SyncSection.ts +39 -17
  81. package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +1 -1
  82. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +9 -1
  83. package/front_end/panels/sources/SourcesPanel.ts +4 -1
  84. package/front_end/panels/sources/sourcesView.css +6 -1
  85. package/front_end/panels/timeline/AppenderUtils.ts +2 -2
  86. package/front_end/panels/timeline/ExtensionTrackAppender.ts +13 -4
  87. package/front_end/panels/timeline/GPUTrackAppender.ts +2 -1
  88. package/front_end/panels/timeline/InteractionsTrackAppender.ts +5 -1
  89. package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +2 -1
  90. package/front_end/panels/timeline/ThreadAppender.ts +12 -3
  91. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +9 -4
  92. package/front_end/panels/timeline/TimelinePanel.ts +3 -2
  93. package/front_end/panels/timeline/TimelineUIUtils.ts +5 -4
  94. package/front_end/panels/timeline/TimingsTrackAppender.ts +6 -1
  95. package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +95 -82
  96. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +1 -1
  97. package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
  98. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +1 -1
  99. package/front_end/panels/timeline/components/RelatedInsightChips.ts +1 -1
  100. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +1 -1
  101. package/front_end/panels/timeline/components/cpuThrottlingSelector.css +17 -15
  102. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +3 -0
  103. package/front_end/third_party/chromium/README.chromium +1 -1
  104. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  105. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  106. package/front_end/third_party/codemirror.next/codemirror.next.d.ts +6 -9
  107. package/front_end/third_party/codemirror.next/package.json +2 -1
  108. package/front_end/third_party/diff/README.chromium +1 -0
  109. package/front_end/third_party/puppeteer/README.chromium +2 -2
  110. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Realm.d.ts +2 -2
  111. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.d.ts +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.js +1 -1
  113. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
  114. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
  115. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  116. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  117. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js +1 -0
  118. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/ChromeLauncher.js.map +1 -1
  119. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  120. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  121. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Function.d.ts.map +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Function.js +16 -25
  124. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Function.js.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  126. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +19 -28
  127. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.d.ts +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.js +1 -1
  129. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
  130. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
  131. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.d.ts.map +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js +1 -0
  133. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/ChromeLauncher.js.map +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  135. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  136. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/Function.d.ts.map +1 -1
  138. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/Function.js +16 -25
  139. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/Function.js.map +1 -1
  140. package/front_end/third_party/puppeteer/package/package.json +10 -3
  141. package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
  142. package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
  143. package/front_end/third_party/puppeteer/package/src/node/ChromeLauncher.ts +1 -0
  144. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  145. package/front_end/third_party/puppeteer/package/src/util/Function.ts +22 -30
  146. package/front_end/ui/components/dialogs/Dialog.ts +1 -1
  147. package/front_end/ui/components/markdown_view/MarkdownImage.ts +4 -5
  148. package/front_end/ui/components/switch/SwitchImpl.ts +12 -1
  149. package/front_end/ui/components/text_editor/config.ts +22 -9
  150. package/front_end/ui/components/tooltips/Tooltip.ts +70 -31
  151. package/front_end/ui/legacy/README.md +33 -24
  152. package/front_end/ui/legacy/SearchableView.ts +19 -26
  153. package/front_end/ui/legacy/TextPrompt.ts +166 -1
  154. package/front_end/ui/legacy/Treeoutline.ts +19 -3
  155. package/front_end/ui/legacy/UIUtils.ts +15 -2
  156. package/front_end/ui/legacy/XElement.ts +0 -43
  157. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +20 -4
  158. package/front_end/ui/legacy/components/source_frame/XMLView.ts +12 -11
  159. package/front_end/ui/lit/i18n-template.ts +5 -2
  160. package/front_end/ui/visual_logging/KnownContextValues.ts +23 -6
  161. package/front_end/ui/visual_logging/README.md +43 -27
  162. 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
@@ -1711,10 +1712,10 @@ export class TimelineUIUtils {
1711
1712
  parsedTrace: Trace.TraceModel.ParsedTrace): Promise<void> {
1712
1713
  const {startTime} = Trace.Helpers.Timing.eventTimingsMilliSeconds(event);
1713
1714
  let initiatorStackLabel = i18nString(UIStrings.initiatorStackTrace);
1714
- let stackLabel = i18nString(UIStrings.stackTrace);
1715
+ let stackLabel = i18nString(UIStrings.functionStack);
1715
1716
  const stackTraceForEvent = Trace.Extras.StackTraceForEvent.get(event, parsedTrace.data);
1716
1717
  if (stackTraceForEvent?.callFrames.length || stackTraceForEvent?.description || stackTraceForEvent?.parent) {
1717
- contentHelper.addSection(i18nString(UIStrings.stackTrace));
1718
+ contentHelper.addSection(i18nString(UIStrings.functionStack));
1718
1719
  contentHelper.createChildStackTraceElement(stackTraceForEvent);
1719
1720
  // TODO(andoli): also build stack trace component for other events
1720
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
  }
@@ -158,7 +158,7 @@ export class LayoutShiftDetails extends UI.Widget.Widget {
158
158
  export const DEFAULT_VIEW: (input: ViewInput, output: object, target: HTMLElement) => void =
159
159
  (input, _output, target) => {
160
160
  if (!input.event || !input.parsedTrace) {
161
- render(html``, target);
161
+ render(Lit.nothing, target);
162
162
  return;
163
163
  }
164
164
 
@@ -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>
@@ -197,7 +197,7 @@ export interface ViewInput {
197
197
  export const DEFAULT_VIEW: (
198
198
  input: ViewInput, output: object, target: HTMLElement) => void = (input, _output, target) => {
199
199
  if (!input.request) {
200
- render(html``, target);
200
+ render(Lit.nothing, target);
201
201
  return;
202
202
  }
203
203
  const {request} = input;
@@ -86,7 +86,7 @@ export const DEFAULT_VIEW: (input: ViewInput, output: object, target: HTMLElemen
86
86
  const {activeEvent, eventToInsightsMap} = input;
87
87
  const relatedInsights = activeEvent ? eventToInsightsMap.get(activeEvent) ?? [] : [];
88
88
  if (!activeEvent || eventToInsightsMap.size === 0 || relatedInsights.length === 0) {
89
- render(html``, target);
89
+ render(Lit.nothing, target);
90
90
  return;
91
91
  }
92
92
 
@@ -478,7 +478,7 @@ export class SidebarSingleInsightSet extends HTMLElement {
478
478
  insightSetKey,
479
479
  } = this.#data;
480
480
  if (!parsedTrace?.insights || !insightSetKey) {
481
- Lit.render(html``, this.#shadow, {host: this});
481
+ Lit.render(Lit.nothing, this.#shadow, {host: this});
482
482
  return;
483
483
  }
484
484
 
@@ -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: 0b46aaf7af942d8ed35500074840aba1ef6d6303
5
5
  Update Mechanism: Manual (https://crbug.com/428069060)
6
6
  License: BSD-3-Clause
7
7
  License File: LICENSE