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 CHROMECAST_BROWSER_METRICS_EXTERNAL_METRICS_H_ | 5 #ifndef CHROMECAST_BROWSER_METRICS_EXTERNAL_METRICS_H_ |
6 #define CHROMECAST_BROWSER_METRICS_EXTERNAL_METRICS_H_ | 6 #define CHROMECAST_BROWSER_METRICS_EXTERNAL_METRICS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/sequence_checker.h" |
13 #include "base/sequenced_task_runner_helpers.h" | 14 #include "base/sequenced_task_runner_helpers.h" |
14 | 15 |
15 namespace metrics { | 16 namespace metrics { |
16 class MetricSample; | 17 class MetricSample; |
17 } // namespace metrics | 18 } // namespace metrics |
18 | 19 |
19 namespace chromecast { | 20 namespace chromecast { |
20 namespace metrics { | 21 namespace metrics { |
21 | 22 |
22 class CastStabilityMetricsProvider; | 23 class CastStabilityMetricsProvider; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 56 |
56 // Collects external events from metrics log file. This is run at periodic | 57 // Collects external events from metrics log file. This is run at periodic |
57 // intervals. | 58 // intervals. |
58 // | 59 // |
59 // Returns the number of events collected. | 60 // Returns the number of events collected. |
60 int CollectEvents(); | 61 int CollectEvents(); |
61 | 62 |
62 // Calls CollectEvents and reschedules a future collection. | 63 // Calls CollectEvents and reschedules a future collection. |
63 void CollectEventsAndReschedule(); | 64 void CollectEventsAndReschedule(); |
64 | 65 |
| 66 // Schedules a future collection. |
| 67 void ScheduleCollection(); |
| 68 |
65 // Reference to stability metrics provider, for reporting external crashes. | 69 // Reference to stability metrics provider, for reporting external crashes. |
66 CastStabilityMetricsProvider* const stability_provider_; | 70 CastStabilityMetricsProvider* const stability_provider_; |
67 | 71 |
68 // File used by libmetrics to send metrics to the browser process. | 72 // File used by libmetrics to send metrics to the browser process. |
69 const std::string uma_events_file_; | 73 const std::string uma_events_file_; |
70 | 74 |
| 75 // The task runner used for running background tasks. |
| 76 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 77 |
| 78 SEQUENCE_CHECKER(sequence_checker_); |
| 79 |
71 base::WeakPtrFactory<ExternalMetrics> weak_factory_; | 80 base::WeakPtrFactory<ExternalMetrics> weak_factory_; |
72 | 81 |
73 DISALLOW_COPY_AND_ASSIGN(ExternalMetrics); | 82 DISALLOW_COPY_AND_ASSIGN(ExternalMetrics); |
74 }; | 83 }; |
75 | 84 |
76 } // namespace metrics | 85 } // namespace metrics |
77 } // namespace chromecast | 86 } // namespace chromecast |
78 | 87 |
79 #endif // CHROMECAST_BROWSER_METRICS_EXTERNAL_METRICS_H_ | 88 #endif // CHROMECAST_BROWSER_METRICS_EXTERNAL_METRICS_H_ |
OLD | NEW |