perfetto-ui: Refactor action/reducer
1. Move all the reducer & action code to the same file in common/.
2. Turn rootReducers case statements into methods on a StateActions object.
3. Replace all the Actions functions with a proxy of StateActions (Actions)
which turns method calls into something that can be dispatched to the
controller.
Change-Id: I42ea7ab783c24acd3aa0a69fae8d020d6270ed03
diff --git a/ui/src/controller/trace_controller.ts b/ui/src/controller/trace_controller.ts
index 06f570f..08b205f 100644
--- a/ui/src/controller/trace_controller.ts
+++ b/ui/src/controller/trace_controller.ts
@@ -16,8 +16,8 @@
import {assertExists, assertTrue} from '../base/logging';
import {
- Action,
addTrack,
+ DeferredAction,
navigate,
setEngineReady,
setTraceTime,
@@ -180,7 +180,7 @@
private async listTracks() {
globals.dispatch(updateStatus('Loading tracks'));
const engine = assertExists<Engine>(this.engine);
- const addToTrackActions: Action[] = [];
+ const addToTrackActions: DeferredAction[] = [];
const numCpus = await engine.getNumberOfCpus();
for (let cpu = 0; cpu < numCpus; cpu++) {
addToTrackActions.push(