blob: 18c9f4cadc3781696dc60e71c5f8bc46d22acde5 (
plain)
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
|
// Copyright 2015 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 IOS_CHROME_BROWSER_METRICS_MOBILE_SESSION_SHUTDOWN_METRICS_PROVIDER_H_
#define IOS_CHROME_BROWSER_METRICS_MOBILE_SESSION_SHUTDOWN_METRICS_PROVIDER_H_
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "components/metrics/metrics_provider.h"
namespace metrics {
class MetricsService;
}
// Exposed for testing purposes only.
// Values of the UMA Stability.MobileSessionShutdownType histogram.
enum MobileSessionShutdownType {
SHUTDOWN_IN_BACKGROUND = 0,
SHUTDOWN_IN_FOREGROUND_NO_CRASH_LOG_NO_MEMORY_WARNING,
SHUTDOWN_IN_FOREGROUND_WITH_CRASH_LOG_NO_MEMORY_WARNING,
SHUTDOWN_IN_FOREGROUND_NO_CRASH_LOG_WITH_MEMORY_WARNING,
SHUTDOWN_IN_FOREGROUND_WITH_CRASH_LOG_WITH_MEMORY_WARNING,
FIRST_LAUNCH_AFTER_UPGRADE,
MOBILE_SESSION_SHUTDOWN_TYPE_COUNT,
};
class MobileSessionShutdownMetricsProvider : public metrics::MetricsProvider {
public:
explicit MobileSessionShutdownMetricsProvider(
metrics::MetricsService* metrics_service);
~MobileSessionShutdownMetricsProvider() override;
// metrics::MetricsProvider
bool HasInitialStabilityMetrics() override;
void ProvideInitialStabilityMetrics(
metrics::SystemProfileProto* system_profile_proto) override;
protected:
// Provides information on the last session environment, used to decide what
// stability metrics to provide in ProvideInitialStabilityMetrics.
// These methods are virtual to be overridden in the tests.
// The default implementations return the real values.
// Whether this is the first time the app is launched after an upgrade.
virtual bool IsFirstLaunchAfterUpgrade();
// Whether there are crash reports to upload.
virtual bool HasCrashLogs();
// Whether there were crash reports that have been uploaded in background
// since the last full start.
virtual bool HasUploadedCrashReportsInBackground();
// Whether there was a memory warning shortly before last shutdown.
virtual bool ReceivedMemoryWarningBeforeLastShutdown();
private:
metrics::MetricsService* metrics_service_;
DISALLOW_COPY_AND_ASSIGN(MobileSessionShutdownMetricsProvider);
};
#endif // IOS_CHROME_BROWSER_METRICS_MOBILE_SESSION_SHUTDOWN_METRICS_PROVIDER_H_
|