OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 8 #ifndef CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
9 #define CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 9 #define CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
10 #pragma once | 10 #pragma once |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/metrics/field_trial.h" |
16 #include "chrome/common/metrics/metrics_log_base.h" | 17 #include "chrome/common/metrics/metrics_log_base.h" |
17 | 18 |
18 struct AutocompleteLog; | 19 struct AutocompleteLog; |
19 class PrefService; | 20 class PrefService; |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 class DictionaryValue; | 23 class DictionaryValue; |
23 } | 24 } |
24 | 25 |
25 namespace webkit { | 26 namespace webkit { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 65 |
65 // Record recent delta for critical stability metrics. We can't wait for a | 66 // Record recent delta for critical stability metrics. We can't wait for a |
66 // restart to gather these, as that delay biases our observation away from | 67 // restart to gather these, as that delay biases our observation away from |
67 // users that run happily for a looooong time. We send increments with each | 68 // users that run happily for a looooong time. We send increments with each |
68 // uma log upload, just as we send histogram data. Takes the list of | 69 // uma log upload, just as we send histogram data. Takes the list of |
69 // installed plugins as a parameter because that can't be obtained | 70 // installed plugins as a parameter because that can't be obtained |
70 // synchronously from the UI thread. | 71 // synchronously from the UI thread. |
71 void RecordIncrementalStabilityElements( | 72 void RecordIncrementalStabilityElements( |
72 const std::vector<webkit::WebPluginInfo>& plugin_list); | 73 const std::vector<webkit::WebPluginInfo>& plugin_list); |
73 | 74 |
| 75 protected: |
| 76 // Exposed for the sake of mocking in test code. |
| 77 |
| 78 // Returns the PrefService from which to log metrics data. |
| 79 virtual PrefService* GetPrefService(); |
| 80 |
| 81 // Fills |field_trial_ids| with the list of initialized field trials name and |
| 82 // group ids. |
| 83 virtual void GetFieldTrialIds( |
| 84 std::vector<base::FieldTrial::NameGroupId>* field_trial_ids) const; |
| 85 |
74 private: | 86 private: |
75 FRIEND_TEST_ALL_PREFIXES(MetricsLogTest, ChromeOSStabilityData); | 87 FRIEND_TEST_ALL_PREFIXES(MetricsLogTest, ChromeOSStabilityData); |
76 | 88 |
77 // Writes application stability metrics (as part of the profile log). | 89 // Writes application stability metrics (as part of the profile log). |
78 // NOTE: Has the side-effect of clearing those counts. | 90 // NOTE: Has the side-effect of clearing those counts. |
79 void WriteStabilityElement( | 91 void WriteStabilityElement( |
80 const std::vector<webkit::WebPluginInfo>& plugin_list, | 92 const std::vector<webkit::WebPluginInfo>& plugin_list, |
81 PrefService* pref); | 93 PrefService* pref); |
82 | 94 |
83 // Within stability group, write plugin crash stats. | 95 // Within stability group, write plugin crash stats. |
(...skipping 24 matching lines...) Expand all Loading... |
108 | 120 |
109 // Writes metrics for the profile identified by key. This writes all | 121 // Writes metrics for the profile identified by key. This writes all |
110 // key/value pairs in profile_metrics. | 122 // key/value pairs in profile_metrics. |
111 void WriteProfileMetrics(const std::string& key, | 123 void WriteProfileMetrics(const std::string& key, |
112 const base::DictionaryValue& profile_metrics); | 124 const base::DictionaryValue& profile_metrics); |
113 | 125 |
114 DISALLOW_COPY_AND_ASSIGN(MetricsLog); | 126 DISALLOW_COPY_AND_ASSIGN(MetricsLog); |
115 }; | 127 }; |
116 | 128 |
117 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ | 129 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ |
OLD | NEW |