From 7fbe53f3de1ba3ddc79e93f8cf5a1e9f7ff9ae97 Mon Sep 17 00:00:00 2001 From: Primiano Tucci Date: Fri, 4 Oct 2024 00:39:26 +0100 Subject: [PATCH] ui: remove rerunControllers injections They are not needed anymore now that all the relevant controllers have been moved to core/xxxManager. TraceController (which is the only one left) doesn't need this logic. Change-Id: I33687d22129f49149d8e8340f15e7ebfdbaa48e8 --- ui/src/core/timeline.ts | 12 ------------ ui/src/core/trace_impl.ts | 13 ------------- ui/src/frontend/globals.ts | 11 +---------- 3 files changed, 1 insertion(+), 35 deletions(-) diff --git a/ui/src/core/timeline.ts b/ui/src/core/timeline.ts index a71cace153..986612194b 100644 --- a/ui/src/core/timeline.ts +++ b/ui/src/core/timeline.ts @@ -37,15 +37,6 @@ export class TimelineImpl implements Timeline { private _visibleWindow: HighPrecisionTimeSpan; private _hoverCursorTimestamp?: time; - // This is a giant hack. Basically, removing visible window from the state - // means that we no longer update the state periodically while navigating - // the timeline, which means that controllers are not running. This keeps - // making null edits to the store which triggers the controller to run. - // This function is injected from Globals.initialize() to avoid a dependency - // on the State. - // TODO(stevegolton): When we remove controllers, we can remove this! - retriggerControllersOnChange: () => void = () => {}; - // This is used to calculate the tracks within a Y range for area selection. areaY: Range = {}; private _selectedArea?: Area; @@ -67,7 +58,6 @@ export class TimelineImpl implements Timeline { .fitWithin(this.traceInfo.start, this.traceInfo.end); raf.scheduleRedraw(); - this.retriggerControllersOnChange(); } panVisibleWindow(delta: number) { @@ -76,7 +66,6 @@ export class TimelineImpl implements Timeline { .fitWithin(this.traceInfo.start, this.traceInfo.end); raf.scheduleRedraw(); - this.retriggerControllersOnChange(); } // Given a timestamp, if |ts| is not currently in view move the view to @@ -134,7 +123,6 @@ export class TimelineImpl implements Timeline { .fitWithin(this.traceInfo.start, this.traceInfo.end); raf.scheduleRedraw(); - this.retriggerControllersOnChange(); } // Get the bounds of the visible window as a high-precision time span diff --git a/ui/src/core/trace_impl.ts b/ui/src/core/trace_impl.ts index 60d1e7d138..6eae5f7263 100644 --- a/ui/src/core/trace_impl.ts +++ b/ui/src/core/trace_impl.ts @@ -133,11 +133,6 @@ export class TraceContext implements Disposable { } this.flowMgr.updateFlows(selection); - - // TODO(primiano): this is temporarily necessary until we kill - // controllers. The flow controller needs to be re-kicked when we change - // the selection. - rerunControllersFunction?.(); } private onResultStep(searchResult: SearchResult) { @@ -350,11 +345,3 @@ function createProxy(target: T, overrides: Partial): T { }, }) as T; } - -// TODO(primiano): remove this once we get rid of controllers. This function -// gets bound to `globals.dispatch(Actions.runControllers({}));` and exists -// only to avoid a circular dependency between globals.ts and this file. -let rerunControllersFunction: () => void; -export function setRerunControllersFunction(f: () => void) { - rerunControllersFunction = f; -} diff --git a/ui/src/frontend/globals.ts b/ui/src/frontend/globals.ts index 4937a8850b..aedc10c042 100644 --- a/ui/src/frontend/globals.ts +++ b/ui/src/frontend/globals.ts @@ -30,8 +30,7 @@ import {HttpRpcState} from '../trace_processor/http_rpc_engine'; import type {Analytics} from './analytics'; import {getServingRoot} from '../base/http_utils'; import {Workspace} from '../public/workspace'; -import {ratelimit} from './rate_limiters'; -import {setRerunControllersFunction, TraceImpl} from '../core/trace_impl'; +import {TraceImpl} from '../core/trace_impl'; import {AppImpl} from '../core/app_impl'; import {createFakeTraceImpl} from '../core/fake_trace_impl'; @@ -106,10 +105,6 @@ class Globals { // is gone, figure out what to do with createSearchOverviewTrack(). async onTraceLoad(trace: TraceImpl): Promise { this._trace = trace; - - this._trace.timeline.retriggerControllersOnChange = () => - ratelimit(() => this.store.edit(() => {}), 50); - this._currentTraceId = trace.engine.engineId; } @@ -126,10 +121,6 @@ class Globals { // We just want an empty instance of TraceImpl but don't want to mark it // as the current trace, otherwise this will trigger the plugins' OnLoad(). AppImpl.instance.closeCurrentTrace(); - - setRerunControllersFunction(() => - this.dispatch(Actions.runControllers({})), - ); } initialize(