forked from firefox-devtools/profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reducers.js
101 lines (89 loc) · 2.68 KB
/
reducers.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// @flow
import type {
Action,
DataSource,
ProfileSelection,
ImplementationFilter,
TabSlug,
} from './actions';
import type { Milliseconds, StartEndRange } from './units';
import type { IndexIntoMarkersTable, Profile, ThreadIndex } from './profile';
import type { CallNodePath } from './profile-derived';
import type { Attempt } from '../utils/errors';
import type { GetLabel } from '../profile-logic/labeling-strategies';
import type { GetCategory } from '../profile-logic/color-categories';
import type { TransformStacksPerThread } from './transforms';
export type Reducer<T> = (T, Action) => T;
export type RequestedLib = { debugName: string, breakpadId: string };
export type SymbolicationStatus = 'DONE' | 'SYMBOLICATING';
export type ThreadViewOptions = {
selectedCallNodePath: CallNodePath,
expandedCallNodePaths: Array<CallNodePath>,
selectedMarker: IndexIntoMarkersTable | -1,
};
export type ProfileViewState = {
viewOptions: {
perThread: ThreadViewOptions[],
symbolicationStatus: SymbolicationStatus,
waitingForLibs: Set<RequestedLib>,
selection: ProfileSelection,
scrollToSelectionGeneration: number,
focusCallTreeGeneration: number,
rootRange: StartEndRange,
zeroAt: Milliseconds,
tabOrder: number[],
rightClickedThread: ThreadIndex,
},
profile: Profile,
};
export type AppViewState =
| {| phase: string |}
| {
phase: 'INITIALIZING',
additionalData: { attempt: Attempt | null, message: string },
}
| { phase: 'FATAL_ERROR', error: Error };
export type AppState = {
view: AppViewState,
isUrlSetupDone: boolean,
hasZoomedViaMousewheel: boolean,
};
export type RangeFilterState = {
start: number,
end: number,
};
export type UrlState = {
dataSource: DataSource,
hash: string,
profileUrl: string,
selectedTab: TabSlug,
rangeFilters: RangeFilterState[],
selectedThread: ThreadIndex,
callTreeSearchString: string,
markersSearchString: string,
implementation: ImplementationFilter,
invertCallstack: boolean,
hidePlatformDetails: boolean,
threadOrder: ThreadIndex[],
hiddenThreads: ThreadIndex[],
transforms: TransformStacksPerThread,
};
export type IconState = Set<string>;
export type StackChartState = {
categoryColorStrategy: GetCategory,
labelingStrategy: GetLabel,
};
export type State = {
app: AppState,
profileView: ProfileViewState,
urlState: UrlState,
stackChart: StackChartState,
icons: IconState,
};
export type IconWithClassName = {
icon: string,
className: string,
};