OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_ | 5 #ifndef COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_ |
6 #define COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_ | 6 #define COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "components/metrics/metrics_provider.h" | 10 #include "components/metrics/metrics_provider.h" |
11 #include "components/metrics/profiler/tracking_synchronizer_observer.h" | 11 #include "components/metrics/profiler/tracking_synchronizer_observer.h" |
12 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" | 12 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" |
13 | 13 |
14 namespace tracked_objects { | 14 namespace tracked_objects { |
15 struct ProcessDataPhaseSnapshot; | 15 struct ProcessDataPhaseSnapshot; |
16 } | 16 } |
17 | 17 |
18 namespace metrics { | 18 namespace metrics { |
19 | 19 |
20 // ProfilerMetricsProvider is responsible for filling out the |profiler_event| | 20 // ProfilerMetricsProvider is responsible for filling out the |profiler_event| |
21 // section of the UMA proto. | 21 // section of the UMA proto. |
22 class ProfilerMetricsProvider : public MetricsProvider { | 22 class ProfilerMetricsProvider : public MetricsProvider { |
23 public: | 23 public: |
24 explicit ProfilerMetricsProvider( | 24 explicit ProfilerMetricsProvider( |
25 const base::Callback<bool(void)>& cellular_callback); | 25 const base::Callback<void(bool*)>& cellular_callback); |
26 // Creates profiler metrics provider with a null callback. | 26 // Creates profiler metrics provider with a null callback. |
27 ProfilerMetricsProvider(); | 27 ProfilerMetricsProvider(); |
28 ~ProfilerMetricsProvider() override; | 28 ~ProfilerMetricsProvider() override; |
29 | 29 |
30 // MetricsDataProvider: | 30 // MetricsDataProvider: |
31 void ProvideGeneralMetrics(ChromeUserMetricsExtension* uma_proto) override; | 31 void ProvideGeneralMetrics(ChromeUserMetricsExtension* uma_proto) override; |
32 | 32 |
33 // Records the passed profiled data, which should be a snapshot of the | 33 // Records the passed profiled data, which should be a snapshot of the |
34 // browser's profiled performance during startup for a single process. | 34 // browser's profiled performance during startup for a single process. |
35 void RecordProfilerData( | 35 void RecordProfilerData( |
(...skipping 10 matching lines...) Expand all Loading... |
46 // experimental group for enabled cellular uploads according to | 46 // experimental group for enabled cellular uploads according to |
47 // |cellular_callback_|. | 47 // |cellular_callback_|. |
48 bool IsCellularLogicEnabled(); | 48 bool IsCellularLogicEnabled(); |
49 | 49 |
50 // Saved cache of generated Profiler event protos, to be copied into the UMA | 50 // Saved cache of generated Profiler event protos, to be copied into the UMA |
51 // proto when ProvideGeneralMetrics() is called. The map is from a profiling | 51 // proto when ProvideGeneralMetrics() is called. The map is from a profiling |
52 // phase id to the profiler event proto that represents profiler data for the | 52 // phase id to the profiler event proto that represents profiler data for the |
53 // profiling phase. | 53 // profiling phase. |
54 std::map<int, ProfilerEventProto> profiler_events_cache_; | 54 std::map<int, ProfilerEventProto> profiler_events_cache_; |
55 | 55 |
56 // Returns true if current connection type is cellular and user is assigned to | 56 // Assigns true if current connection type is cellular and user is assigned to |
57 // experimental group for enabled cellular uploads. | 57 // experimental group for enabled cellular uploads. |
58 base::Callback<bool(void)> cellular_callback_; | 58 base::Callback<void(bool*)> cellular_callback_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(ProfilerMetricsProvider); | 60 DISALLOW_COPY_AND_ASSIGN(ProfilerMetricsProvider); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace metrics | 63 } // namespace metrics |
64 | 64 |
65 #endif // COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_ | 65 #endif // COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_ |
OLD | NEW |