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

Side by Side Diff: components/metrics/metrics_log.h

Issue 2687393004: Gather stability prefs into managing objects. (Closed)
Patch Set: Incorporate Feedback Created 3 years, 10 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
« no previous file with comments | « components/metrics/environment_recorder_unittest.cc ('k') | components/metrics/metrics_log.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // This file defines a set of user experience metrics data recorded by 5 // This file defines a set of user experience metrics data recorded by
6 // the MetricsService. This is the unit of data that is sent to the server. 6 // the MetricsService. This is the unit of data that is sent to the server.
7 7
8 #ifndef COMPONENTS_METRICS_METRICS_LOG_H_ 8 #ifndef COMPONENTS_METRICS_METRICS_LOG_H_
9 #define COMPONENTS_METRICS_METRICS_LOG_H_ 9 #define COMPONENTS_METRICS_METRICS_LOG_H_
10 10
11 #include <stdint.h> 11 #include <stdint.h>
12 12
13 #include <memory> 13 #include <memory>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "components/metrics/metrics_service_client.h" 19 #include "components/metrics/metrics_service_client.h"
20 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h" 20 #include "components/metrics/proto/chrome_user_metrics_extension.pb.h"
21 21
22 class PrefRegistrySimple;
23 class PrefService; 22 class PrefService;
24 23
25 namespace base { 24 namespace base {
26 class HistogramSamples; 25 class HistogramSamples;
27 } 26 }
28 27
29 namespace variations { 28 namespace variations {
30 struct ActiveGroupId; 29 struct ActiveGroupId;
31 } 30 }
32 31
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 bool HasEnvironment() const; 165 bool HasEnvironment() const;
167 166
168 // Write the default state of the enable metrics checkbox. 167 // Write the default state of the enable metrics checkbox.
169 void WriteMetricsEnableDefault(EnableMetricsDefault metrics_default, 168 void WriteMetricsEnableDefault(EnableMetricsDefault metrics_default,
170 SystemProfileProto* system_profile); 169 SystemProfileProto* system_profile);
171 170
172 // Returns true if the stability metrics have already been filled in by a 171 // Returns true if the stability metrics have already been filled in by a
173 // call to RecordStabilityMetrics(). 172 // call to RecordStabilityMetrics().
174 bool HasStabilityMetrics() const; 173 bool HasStabilityMetrics() const;
175 174
176 // Within the stability group, write required attributes.
177 void WriteRequiredStabilityAttributes(PrefService* pref);
178
179 // Within the stability group, write attributes that need to be updated asap 175 // Within the stability group, write attributes that need to be updated asap
180 // and can't be delayed until the user decides to restart chromium. 176 // and can't be delayed until the user decides to restart chromium.
181 // Delaying these stats would bias metrics away from happy long lived 177 // Delaying these stats would bias metrics away from happy long lived
182 // chromium processes (ones that don't crash, and keep on running). 178 // chromium processes (ones that don't crash, and keep on running).
183 void WriteRealtimeStabilityAttributes(PrefService* pref, 179 void WriteRealtimeStabilityAttributes(base::TimeDelta incremental_uptime,
184 base::TimeDelta incremental_uptime,
185 base::TimeDelta uptime); 180 base::TimeDelta uptime);
186 181
187 // closed_ is true when record has been packed up for sending, and should 182 // closed_ is true when record has been packed up for sending, and should
188 // no longer be written to. It is only used for sanity checking. 183 // no longer be written to. It is only used for sanity checking.
189 bool closed_; 184 bool closed_;
190 185
191 // The type of the log, i.e. initial or ongoing. 186 // The type of the log, i.e. initial or ongoing.
192 const LogType log_type_; 187 const LogType log_type_;
193 188
194 // Stores the protocol buffer representation for this log. 189 // Stores the protocol buffer representation for this log.
195 ChromeUserMetricsExtension uma_proto_; 190 ChromeUserMetricsExtension uma_proto_;
196 191
197 // Used to interact with the embedder. Weak pointer; must outlive |this| 192 // Used to interact with the embedder. Weak pointer; must outlive |this|
198 // instance. 193 // instance.
199 MetricsServiceClient* const client_; 194 MetricsServiceClient* const client_;
200 195
201 // The time when the current log was created. 196 // The time when the current log was created.
202 const base::TimeTicks creation_time_; 197 const base::TimeTicks creation_time_;
203 198
204 PrefService* local_state_; 199 PrefService* local_state_;
205 200
206 DISALLOW_COPY_AND_ASSIGN(MetricsLog); 201 DISALLOW_COPY_AND_ASSIGN(MetricsLog);
207 }; 202 };
208 203
209 } // namespace metrics 204 } // namespace metrics
210 205
211 #endif // COMPONENTS_METRICS_METRICS_LOG_H_ 206 #endif // COMPONENTS_METRICS_METRICS_LOG_H_
OLDNEW
« no previous file with comments | « components/metrics/environment_recorder_unittest.cc ('k') | components/metrics/metrics_log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698