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

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

Issue 2691803002: Remove ScopedVector in //component/metrics (Closed)
Patch Set: Remove ScopedVector in //component/metrics 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
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
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 // TODO(rkaplow): I think this can be a little refactored as it currently 89 // TODO(rkaplow): I think this can be a little refactored as it currently
90 // records a pretty arbitrary set of things. 90 // records a pretty arbitrary set of things.
91 // Records the current operating environment, including metrics provided by 91 // Records the current operating environment, including metrics provided by
92 // the specified set of |metrics_providers|. Takes the list of synthetic 92 // the specified set of |metrics_providers|. Takes the list of synthetic
93 // trial IDs as a parameter. A synthetic trial is one that is set up 93 // trial IDs as a parameter. A synthetic trial is one that is set up
94 // dynamically by code in Chrome. For example, a pref may be mapped to a 94 // dynamically by code in Chrome. For example, a pref may be mapped to a
95 // synthetic trial such that the group is determined by the pref value. The 95 // synthetic trial such that the group is determined by the pref value. The
96 // current environment is returned serialized as a string. 96 // current environment is returned serialized as a string.
97 std::string RecordEnvironment( 97 std::string RecordEnvironment(
98 const std::vector<MetricsProvider*>& metrics_providers, 98 const std::vector<std::unique_ptr<MetricsProvider>>& metrics_providers,
ke.he 2017/02/12 10:14:39 I just changed the interface definition. An altern
Ilya Sherman 2017/02/13 19:21:30 I think this change is fine -- there's no intent t
99 const std::vector<variations::ActiveGroupId>& synthetic_trials, 99 const std::vector<variations::ActiveGroupId>& synthetic_trials,
100 int64_t install_date, 100 int64_t install_date,
101 int64_t metrics_reporting_enabled_date); 101 int64_t metrics_reporting_enabled_date);
102 102
103 // Loads the environment proto that was saved by the last RecordEnvironment() 103 // Loads the environment proto that was saved by the last RecordEnvironment()
104 // call from prefs. On success, returns true and |app_version| contains the 104 // call from prefs. On success, returns true and |app_version| contains the
105 // recovered version. Otherwise (if there was no saved environment in prefs 105 // recovered version. Otherwise (if there was no saved environment in prefs
106 // or it could not be decoded), returns false and |app_version| is empty. 106 // or it could not be decoded), returns false and |app_version| is empty.
107 bool LoadSavedEnvironmentFromPrefs(std::string* app_version); 107 bool LoadSavedEnvironmentFromPrefs(std::string* app_version);
108 108
109 // Writes application stability metrics, including stability metrics provided 109 // Writes application stability metrics, including stability metrics provided
110 // by the specified set of |metrics_providers|. The system profile portion of 110 // by the specified set of |metrics_providers|. The system profile portion of
111 // the log must have already been filled in by a call to RecordEnvironment() 111 // the log must have already been filled in by a call to RecordEnvironment()
112 // or LoadSavedEnvironmentFromPrefs(). 112 // or LoadSavedEnvironmentFromPrefs().
113 // NOTE: Has the side-effect of clearing the stability prefs.. 113 // NOTE: Has the side-effect of clearing the stability prefs..
114 // 114 //
115 // If this log is of type INITIAL_STABILITY_LOG, records additional info such 115 // If this log is of type INITIAL_STABILITY_LOG, records additional info such
116 // as number of incomplete shutdowns as well as extra breakpad and debugger 116 // as number of incomplete shutdowns as well as extra breakpad and debugger
117 // stats. 117 // stats.
118 void RecordStabilityMetrics( 118 void RecordStabilityMetrics(
119 const std::vector<MetricsProvider*>& metrics_providers, 119 const std::vector<std::unique_ptr<MetricsProvider>>& metrics_providers,
120 base::TimeDelta incremental_uptime, 120 base::TimeDelta incremental_uptime,
121 base::TimeDelta uptime); 121 base::TimeDelta uptime);
122 122
123 // Records general metrics based on the specified |metrics_providers|. 123 // Records general metrics based on the specified |metrics_providers|.
124 void RecordGeneralMetrics( 124 void RecordGeneralMetrics(
125 const std::vector<MetricsProvider*>& metrics_providers); 125 const std::vector<std::unique_ptr<MetricsProvider>>& metrics_providers);
126 126
127 // Stop writing to this record and generate the encoded representation. 127 // Stop writing to this record and generate the encoded representation.
128 // None of the Record* methods can be called after this is called. 128 // None of the Record* methods can be called after this is called.
129 void CloseLog(); 129 void CloseLog();
130 130
131 // Fills |encoded_log| with the serialized protobuf representation of the 131 // Fills |encoded_log| with the serialized protobuf representation of the
132 // record. Must only be called after CloseLog() has been called. 132 // record. Must only be called after CloseLog() has been called.
133 void GetEncodedLog(std::string* encoded_log); 133 void GetEncodedLog(std::string* encoded_log);
134 134
135 const base::TimeTicks& creation_time() const { 135 const base::TimeTicks& creation_time() const {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 const base::TimeTicks creation_time_; 201 const base::TimeTicks creation_time_;
202 202
203 PrefService* local_state_; 203 PrefService* local_state_;
204 204
205 DISALLOW_COPY_AND_ASSIGN(MetricsLog); 205 DISALLOW_COPY_AND_ASSIGN(MetricsLog);
206 }; 206 };
207 207
208 } // namespace metrics 208 } // namespace metrics
209 209
210 #endif // COMPONENTS_METRICS_METRICS_LOG_H_ 210 #endif // COMPONENTS_METRICS_METRICS_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698