Skip to content

Commit

Permalink
Merge "ui: remove rerunControllers injections" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
primiano authored and Gerrit Code Review committed Oct 4, 2024
2 parents a99fafe + 7fbe53f commit 753416e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 35 deletions.
12 changes: 0 additions & 12 deletions ui/src/core/timeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -67,7 +58,6 @@ export class TimelineImpl implements Timeline {
.fitWithin(this.traceInfo.start, this.traceInfo.end);

raf.scheduleRedraw();
this.retriggerControllersOnChange();
}

panVisibleWindow(delta: number) {
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
13 changes: 0 additions & 13 deletions ui/src/core/trace_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -350,11 +345,3 @@ function createProxy<T extends object>(target: T, overrides: Partial<T>): 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;
}
11 changes: 1 addition & 10 deletions ui/src/frontend/globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -106,10 +105,6 @@ class Globals {
// is gone, figure out what to do with createSearchOverviewTrack().
async onTraceLoad(trace: TraceImpl): Promise<void> {
this._trace = trace;

this._trace.timeline.retriggerControllersOnChange = () =>
ratelimit(() => this.store.edit(() => {}), 50);

this._currentTraceId = trace.engine.engineId;
}

Expand All @@ -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(
Expand Down

0 comments on commit 753416e

Please sign in to comment.