forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
execution_phase.h
55 lines (41 loc) · 1.45 KB
/
execution_phase.h
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
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_METRICS_EXECUTION_PHASE_H_
#define COMPONENTS_METRICS_EXECUTION_PHASE_H_
#include "base/macros.h"
#include "build/build_config.h"
class PrefService;
class PrefRegistrySimple;
namespace metrics {
enum class ExecutionPhase {
UNINITIALIZED_PHASE = 0,
START_METRICS_RECORDING = 100,
CREATE_PROFILE = 200,
STARTUP_TIMEBOMB_ARM = 300,
THREAD_WATCHER_START = 400,
MAIN_MESSAGE_LOOP_RUN = 500,
SHUTDOWN_TIMEBOMB_ARM = 600,
SHUTDOWN_COMPLETE = 700,
};
// Helper class for managing ExecutionPhase state in prefs and memory.
// It's safe to construct temporary objects to perform these operations.
class ExecutionPhaseManager {
public:
explicit ExecutionPhaseManager(PrefService* local_state);
~ExecutionPhaseManager();
static void RegisterPrefs(PrefRegistrySimple* registry);
void SetExecutionPhase(ExecutionPhase execution_phase);
ExecutionPhase GetExecutionPhase();
#if defined(OS_ANDROID) || defined(OS_IOS)
void OnAppEnterBackground();
void OnAppEnterForeground();
#endif // defined(OS_ANDROID) || defined(OS_IOS)
private:
// Execution phase the browser is in.
static ExecutionPhase execution_phase_;
PrefService* local_state_;
DISALLOW_COPY_AND_ASSIGN(ExecutionPhaseManager);
};
} // namespace metrics
#endif // COMPONENTS_METRICS_EXECUTION_PHASE_H_