Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: chromecast/base/metrics/cast_metrics_helper.h

Issue 1142513004: Chromecast: MessageLoopProxy cleanup --> SingleThreadTaskRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_BASE_METRICS_CAST_METRICS_HELPER_H_ 5 #ifndef CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_
6 #define CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_ 6 #define CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 13
14 namespace base { 14 namespace base {
15 class MessageLoopProxy; 15 class SingleThreadTaskRunner;
16 } 16 }
17 17
18 namespace chromecast { 18 namespace chromecast {
19 namespace metrics { 19 namespace metrics {
20 20
21 // Helper class for tracking complex metrics. This particularly includes 21 // Helper class for tracking complex metrics. This particularly includes
22 // playback metrics that span events across time, such as "time from app launch 22 // playback metrics that span events across time, such as "time from app launch
23 // to video being rendered." 23 // to video being rendered."
24 class CastMetricsHelper { 24 class CastMetricsHelper {
25 public: 25 public:
(...skipping 25 matching lines...) Expand all
51 static bool DecodeAppInfoFromMetricsName( 51 static bool DecodeAppInfoFromMetricsName(
52 const std::string& metrics_name, 52 const std::string& metrics_name,
53 std::string* action_name, 53 std::string* action_name,
54 std::string* app_id, 54 std::string* app_id,
55 std::string* session_id, 55 std::string* session_id,
56 std::string* sdk_version); 56 std::string* sdk_version);
57 57
58 static CastMetricsHelper* GetInstance(); 58 static CastMetricsHelper* GetInstance();
59 59
60 explicit CastMetricsHelper( 60 explicit CastMetricsHelper(
61 scoped_refptr<base::MessageLoopProxy> message_loop_proxy); 61 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
62 virtual ~CastMetricsHelper(); 62 virtual ~CastMetricsHelper();
63 63
64 // This function updates the info and stores the startup time of the current 64 // This function updates the info and stores the startup time of the current
65 // active application 65 // active application
66 virtual void UpdateCurrentAppInfo(const std::string& app_id, 66 virtual void UpdateCurrentAppInfo(const std::string& app_id,
67 const std::string& session_id); 67 const std::string& session_id);
68 // This function updates the sdk version of the current active application 68 // This function updates the sdk version of the current active application
69 virtual void UpdateSDKInfo(const std::string& sdk_version); 69 virtual void UpdateSDKInfo(const std::string& sdk_version);
70 70
71 // Logs UMA record for media play/pause user actions. 71 // Logs UMA record for media play/pause user actions.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 void LogEnumerationHistogramEvent(const std::string& name, 127 void LogEnumerationHistogramEvent(const std::string& name,
128 int value, int num_buckets); 128 int value, int num_buckets);
129 void LogTimeHistogramEvent(const std::string& name, 129 void LogTimeHistogramEvent(const std::string& name,
130 const base::TimeDelta& value, 130 const base::TimeDelta& value,
131 const base::TimeDelta& min, 131 const base::TimeDelta& min,
132 const base::TimeDelta& max, 132 const base::TimeDelta& max,
133 int num_buckets); 133 int num_buckets);
134 void LogMediumTimeHistogramEvent(const std::string& name, 134 void LogMediumTimeHistogramEvent(const std::string& name,
135 const base::TimeDelta& value); 135 const base::TimeDelta& value);
136 136
137 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; 137 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
138 138
139 // Start time of the most recent app. 139 // Start time of the most recent app.
140 base::TimeTicks app_start_time_; 140 base::TimeTicks app_start_time_;
141 141
142 // Currently running app id. Used to construct histogram name. 142 // Currently running app id. Used to construct histogram name.
143 std::string app_id_; 143 std::string app_id_;
144 std::string session_id_; 144 std::string session_id_;
145 std::string sdk_version_; 145 std::string sdk_version_;
146 146
147 // Whether a new app start time has been stored but not recorded. 147 // Whether a new app start time has been stored but not recorded.
148 // After the startup time has been used to generate an UMA event, 148 // After the startup time has been used to generate an UMA event,
149 // this is set to false. 149 // this is set to false.
150 bool new_startup_time_; 150 bool new_startup_time_;
151 151
152 base::TimeTicks previous_video_stat_sample_time_; 152 base::TimeTicks previous_video_stat_sample_time_;
153 153
154 MetricsSink* metrics_sink_; 154 MetricsSink* metrics_sink_;
155 // Default RecordAction callback when metrics_sink_ is not set. 155 // Default RecordAction callback when metrics_sink_ is not set.
156 RecordActionCallback record_action_callback_; 156 RecordActionCallback record_action_callback_;
157 157
158 DISALLOW_COPY_AND_ASSIGN(CastMetricsHelper); 158 DISALLOW_COPY_AND_ASSIGN(CastMetricsHelper);
159 }; 159 };
160 160
161 } // namespace metrics 161 } // namespace metrics
162 } // namespace chromecast 162 } // namespace chromecast
163 163
164 #endif // CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_ 164 #endif // CHROMECAST_BASE_METRICS_CAST_METRICS_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | chromecast/base/metrics/cast_metrics_helper.cc » ('j') | chromecast/browser/media/cma_message_loop.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698