Skip to content

Commit 91610e5

Browse files
danilsomsikovDevtools-frontend LUCI CQ
authored andcommitted
Add update scheduling support to widgets
This CL adds support for RenderCoordinator to widgets. This is done by adding a new `update()` method to the `Widget` class that schedules a write job with the RenderCoordinator. The `update()` method returns a promise that resolves when the update is complete. This CL also updates all of the legacy widgets that extend the `Widget` class to use the new `update()` method. This ensures that all of the legacy widgets are using the RenderCoordinator to schedule their updates. This CL is part of a larger effort to improve the performance of the DevTools. By using the RenderCoordinator, we can ensure that the legacy widgets are only updated when they are visible on the screen. This can significantly improve the performance of the DevTools, especially for large and complex pages. Bug: 301364727 Change-Id: I3b638aadf169a37a0328cfe16e3c462a709bc0da Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6021958 Commit-Queue: Danil Somsikov <[email protected]> Reviewed-by: Benedikt Meurer <[email protected]> Auto-Submit: Danil Somsikov <[email protected]>
1 parent 8da8b80 commit 91610e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+128
-79
lines changed

front_end/models/persistence/EditFileSystemView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export class EditFileSystemView extends UI.Widget.VBox implements UI.ListWidget.
128128
return IsolatedFileSystemManager.instance().fileSystem(this.fileSystemPath) as PlatformFileSystem;
129129
}
130130

131-
private update(): void {
131+
override update(): void {
132132
if (this.muteUpdate) {
133133
return;
134134
}

front_end/panels/application/IndexedDBViews.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,10 @@ export class IDBDataView extends UI.View.SimpleView {
473473
this.updateData(true);
474474
}
475475

476-
update(objectStore: ObjectStore, index: Index|null): void {
476+
override update(objectStore: ObjectStore|null = null, index: Index|null = null): void {
477+
if (!objectStore) {
478+
return;
479+
}
477480
this.objectStore = objectStore;
478481
this.index = index;
479482

front_end/panels/application/ServiceWorkerCacheViews.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,10 @@ export class ServiceWorkerCacheView extends UI.View.SimpleView {
285285
node.remove();
286286
}
287287

288-
update(cache: SDK.ServiceWorkerCacheModel.Cache): void {
288+
override update(cache: SDK.ServiceWorkerCacheModel.Cache|null = null): void {
289+
if (!cache) {
290+
return;
291+
}
289292
this.cache = cache;
290293
this.resetDataGrid();
291294
void this.updateData(true);

front_end/panels/browser_debugger/CategorizedBreakpointsSidebarPane.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export abstract class CategorizedBreakpointsSidebarPane extends UI.Widget.VBox {
249249
return null;
250250
}
251251

252-
private update(): void {
252+
override update(): void {
253253
const target = UI.Context.Context.instance().flavor(SDK.Target.Target);
254254
const debuggerModel = target ? target.model(SDK.DebuggerModel.DebuggerModel) : null;
255255
const details = debuggerModel ? debuggerModel.debuggerPausedDetails() : null;

front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ export class DOMBreakpointsSidebarPane extends UI.Widget.VBox implements
349349
this.update();
350350
}
351351

352-
private update(): void {
352+
override update(): void {
353353
const details = UI.Context.Context.instance().flavor(SDK.DebuggerModel.DebuggerPausedDetails);
354354
if (this.#highlightedBreakpoint) {
355355
const oldHighlightedBreakpoint = this.#highlightedBreakpoint;

front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ export class XHRBreakpointsSidebarPane extends UI.Widget.VBox implements UI.Cont
372372
this.update();
373373
}
374374

375-
private update(): void {
375+
override update(): void {
376376
const isEmpty = this.#breakpoints.length === 0;
377377
this.#list.element.classList.toggle('hidden', isEmpty);
378378
this.#emptyElement.classList.toggle('hidden', !isEmpty);

front_end/panels/coverage/CoverageListView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ export class CoverageListView extends UI.Widget.VBox {
195195
this.setDefaultFocusedChild(dataGridWidget);
196196
}
197197

198-
update(coverageInfo: URLCoverageInfo[]): void {
198+
override update(coverageInfo: URLCoverageInfo[] = []): void {
199199
let hadUpdates = false;
200200
const maxSize = coverageInfo.reduce((acc, entry) => Math.max(acc, entry.size()), 0);
201201
const rootNode = this.dataGrid.rootNode();

front_end/panels/developer_resources/DeveloperResourcesListView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export class DeveloperResourcesListView extends UI.Widget.VBox {
145145
}
146146
}
147147

148-
update(items: Iterable<SDK.PageResourceLoader.PageResource>): void {
148+
override update(items: Iterable<SDK.PageResourceLoader.PageResource> = []): void {
149149
let hadUpdates = false;
150150
const rootNode = this.dataGrid.rootNode();
151151
for (const item of items) {

front_end/panels/elements/ClassesPaneWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ export class ClassesPaneWidget extends UI.Widget.Widget {
157157
this.registerCSSFiles([classesPaneWidgetStyles]);
158158
}
159159

160-
private update(): void {
160+
override update(): void {
161161
if (!this.isShowing()) {
162162
return;
163163
}

front_end/panels/elements/ElementStatePaneWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ export class ElementStatePaneWidget extends UI.Widget.Widget {
262262
this.registerCSSFiles([elementStatePaneWidgetStyles]);
263263
this.update();
264264
}
265-
private update(): void {
265+
override update(): void {
266266
let node = UI.Context.Context.instance().flavor(SDK.DOMModel.DOMNode);
267267
if (node) {
268268
node = node.enclosingElementOrSelf();

0 commit comments

Comments
 (0)