Android Chromoting: Remove exit-fullscreen button.
[chromium-blink-merge.git] / components / metrics / profiler / profiler_metrics_provider.h
blob7740cb80b1a0d2faa18e0a2f6713632fbd1f2fd5
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "components/metrics/metrics_provider.h"
11 #include "components/metrics/profiler/tracking_synchronizer_observer.h"
12 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
13 #include "content/public/common/process_type.h"
15 namespace tracked_objects {
16 struct ProcessDataPhaseSnapshot;
19 namespace metrics {
21 // ProfilerMetricsProvider is responsible for filling out the |profiler_event|
22 // section of the UMA proto.
23 class ProfilerMetricsProvider : public MetricsProvider {
24 public:
25 explicit ProfilerMetricsProvider(
26 const base::Callback<void(bool*)>& cellular_callback);
27 // Creates profiler metrics provider with a null callback.
28 ProfilerMetricsProvider();
29 ~ProfilerMetricsProvider() override;
31 // MetricsDataProvider:
32 void ProvideGeneralMetrics(ChromeUserMetricsExtension* uma_proto) override;
34 // Records the passed profiled data, which should be a snapshot of the
35 // browser's profiled performance during startup for a single process.
36 void RecordProfilerData(
37 const tracked_objects::ProcessDataPhaseSnapshot& process_data,
38 base::ProcessId process_id,
39 content::ProcessType process_type,
40 int profiling_phase,
41 base::TimeDelta phase_start,
42 base::TimeDelta phase_finish,
43 const ProfilerEvents& past_events);
45 private:
46 // Returns whether current connection is cellular or not according to the
47 // callback.
48 bool IsCellularConnection();
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
52 // phase id to the profiler event proto that represents profiler data for the
53 // profiling phase.
54 std::map<int, ProfilerEventProto> profiler_events_cache_;
56 // Callback function used to get current network connection type.
57 base::Callback<void(bool*)> cellular_callback_;
59 DISALLOW_COPY_AND_ASSIGN(ProfilerMetricsProvider);
62 } // namespace metrics
64 #endif // COMPONENTS_METRICS_PROFILER_PROFILER_METRICS_PROVIDER_H_