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

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

Issue 1030503003: Metrics log modification to handle external components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move deps Created 5 years, 9 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Records the current operating environment, including metrics provided by 90 // Records the current operating environment, including metrics provided by
91 // the specified set of |metrics_providers|. Takes the list of installed 91 // the specified set of |metrics_providers|. Takes the list of installed
92 // plugins, Google Update statistics, and synthetic trial IDs as parameters 92 // plugins, Google Update statistics, and synthetic trial IDs as parameters
93 // because those can't be obtained synchronously from the UI thread. 93 // because those can't be obtained synchronously from the UI thread.
94 // A synthetic trial is one that is set up dynamically by code in Chrome. For 94 // A synthetic trial is one that is set up dynamically by code in Chrome. For
95 // example, a pref may be mapped to a synthetic trial such that the group 95 // example, a pref may be mapped to a synthetic trial such that the group
96 // is determined by the pref value. 96 // is determined by the pref value.
97 void RecordEnvironment( 97 void RecordEnvironment(
98 const std::vector<MetricsProvider*>& metrics_providers, 98 const std::vector<MetricsProvider*>& metrics_providers,
99 const std::vector<variations::ActiveGroupId>& synthetic_trials, 99 const std::vector<variations::ActiveGroupId>& synthetic_trials,
100 int64 install_date); 100 int64 install_date,
101 int64 metrics_reporting_enabled_date);
101 102
102 // Loads the environment proto that was saved by the last RecordEnvironment() 103 // Loads the environment proto that was saved by the last RecordEnvironment()
103 // call from prefs and clears the pref value. Returns true on success or false 104 // call from prefs and clears the pref value. Returns true on success or false
104 // if there was no saved environment in prefs or it could not be decoded. 105 // if there was no saved environment in prefs or it could not be decoded.
105 bool LoadSavedEnvironmentFromPrefs(); 106 bool LoadSavedEnvironmentFromPrefs();
106 107
107 // Writes application stability metrics, including stability metrics provided 108 // Writes application stability metrics, including stability metrics provided
108 // by the specified set of |metrics_providers|. The system profile portion of 109 // by the specified set of |metrics_providers|. The system profile portion of
109 // the log must have already been filled in by a call to RecordEnvironment() 110 // the log must have already been filled in by a call to RecordEnvironment()
110 // or LoadSavedEnvironmentFromPrefs(). 111 // or LoadSavedEnvironmentFromPrefs().
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 144
144 protected: 145 protected:
145 // Exposed for the sake of mocking/accessing in test code. 146 // Exposed for the sake of mocking/accessing in test code.
146 147
147 // Fills |field_trial_ids| with the list of initialized field trials name and 148 // Fills |field_trial_ids| with the list of initialized field trials name and
148 // group ids. 149 // group ids.
149 virtual void GetFieldTrialIds( 150 virtual void GetFieldTrialIds(
150 std::vector<variations::ActiveGroupId>* field_trial_ids) const; 151 std::vector<variations::ActiveGroupId>* field_trial_ids) const;
151 152
152 ChromeUserMetricsExtension* uma_proto() { return &uma_proto_; } 153 ChromeUserMetricsExtension* uma_proto() { return &uma_proto_; }
154
155 // Exposed to allow subclass to access to export the uma_proto. Can be used
156 // by external components to export logs to Chrome.
153 const ChromeUserMetricsExtension* uma_proto() const { 157 const ChromeUserMetricsExtension* uma_proto() const {
154 return &uma_proto_; 158 return &uma_proto_;
155 } 159 }
156 160
157 private: 161 private:
158 // Returns true if the environment has already been filled in by a call to 162 // Returns true if the environment has already been filled in by a call to
159 // RecordEnvironment() or LoadSavedEnvironmentFromPrefs(). 163 // RecordEnvironment() or LoadSavedEnvironmentFromPrefs().
160 bool HasEnvironment() const; 164 bool HasEnvironment() const;
161 165
162 // Returns true if the stability metrics have already been filled in by a 166 // Returns true if the stability metrics have already been filled in by a
(...skipping 29 matching lines...) Expand all
192 const base::TimeTicks creation_time_; 196 const base::TimeTicks creation_time_;
193 197
194 PrefService* local_state_; 198 PrefService* local_state_;
195 199
196 DISALLOW_COPY_AND_ASSIGN(MetricsLog); 200 DISALLOW_COPY_AND_ASSIGN(MetricsLog);
197 }; 201 };
198 202
199 } // namespace metrics 203 } // namespace metrics
200 204
201 #endif // COMPONENTS_METRICS_METRICS_LOG_H_ 205 #endif // COMPONENTS_METRICS_METRICS_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698