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

Side by Side Diff: chrome/browser/metrics/metrics_log.h

Issue 299783004: Create PluginMetricsProvider class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
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 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "chrome/browser/metrics/extension_metrics.h" 15 #include "chrome/browser/metrics/extension_metrics.h"
16 #include "chrome/browser/metrics/metrics_network_observer.h" 16 #include "chrome/browser/metrics/metrics_network_observer.h"
17 #include "chrome/common/variations/variations_util.h" 17 #include "chrome/common/variations/variations_util.h"
18 #include "chrome/installer/util/google_update_settings.h"
19 #include "components/metrics/metrics_log_base.h" 18 #include "components/metrics/metrics_log_base.h"
20 #include "ui/gfx/size.h" 19 #include "ui/gfx/size.h"
21 20
22 class HashedExtensionMetrics; 21 class HashedExtensionMetrics;
23 class MetricsNetworkObserver; 22 class MetricsNetworkObserver;
24 class PrefService; 23 class PrefService;
25 class PrefRegistrySimple;
26 24
27 #if defined(OS_CHROMEOS) 25 #if defined(OS_CHROMEOS)
28 class MetricsLogChromeOS; 26 class MetricsLogChromeOS;
29 #endif 27 #endif
30 28
31 namespace base { 29 namespace base {
32 class DictionaryValue; 30 class DictionaryValue;
33 } 31 }
34 32
35 namespace content { 33 namespace content {
(...skipping 13 matching lines...) Expand all
49 } 47 }
50 48
51 class MetricsLog : public metrics::MetricsLogBase { 49 class MetricsLog : public metrics::MetricsLogBase {
52 public: 50 public:
53 // Creates a new metrics log of the specified type. 51 // Creates a new metrics log of the specified type.
54 // client_id is the identifier for this profile on this installation 52 // client_id is the identifier for this profile on this installation
55 // session_id is an integer that's incremented on each application launch 53 // session_id is an integer that's incremented on each application launch
56 MetricsLog(const std::string& client_id, int session_id, LogType log_type); 54 MetricsLog(const std::string& client_id, int session_id, LogType log_type);
57 virtual ~MetricsLog(); 55 virtual ~MetricsLog();
58 56
59 static void RegisterPrefs(PrefRegistrySimple* registry);
60
61 // Get the current version of the application as a string. 57 // Get the current version of the application as a string.
62 static std::string GetVersionString(); 58 static std::string GetVersionString();
63 59
64 // Use |extension| in all uploaded appversions in addition to the standard 60 // Use |extension| in all uploaded appversions in addition to the standard
65 // version string. 61 // version string.
66 static void set_version_extension(const std::string& extension); 62 static void set_version_extension(const std::string& extension);
67 static const std::string& version_extension(); 63 static const std::string& version_extension();
68 64
69 // Records the current operating environment, including metrics provided by 65 // Records the current operating environment, including metrics provided by
70 // the specified set of |metrics_providers|. Takes the list of installed 66 // the specified set of |metrics_providers|. Takes the list of installed
71 // plugins, Google Update statistics, and synthetic trial IDs as parameters 67 // plugins, Google Update statistics, and synthetic trial IDs as parameters
72 // because those can't be obtained synchronously from the UI thread. 68 // because those can't be obtained synchronously from the UI thread.
73 // A synthetic trial is one that is set up dynamically by code in Chrome. For 69 // A synthetic trial is one that is set up dynamically by code in Chrome. For
74 // example, a pref may be mapped to a synthetic trial such that the group 70 // example, a pref may be mapped to a synthetic trial such that the group
75 // is determined by the pref value. 71 // is determined by the pref value.
76 void RecordEnvironment( 72 void RecordEnvironment(
77 const std::vector<metrics::MetricsProvider*>& metrics_providers, 73 const std::vector<metrics::MetricsProvider*>& metrics_providers,
78 const std::vector<content::WebPluginInfo>& plugin_list,
79 const std::vector<variations::ActiveGroupId>& synthetic_trials); 74 const std::vector<variations::ActiveGroupId>& synthetic_trials);
80 75
81 // Loads the environment proto that was saved by the last RecordEnvironment() 76 // Loads the environment proto that was saved by the last RecordEnvironment()
82 // call from prefs and clears the pref value. Returns true on success or false 77 // call from prefs and clears the pref value. Returns true on success or false
83 // if there was no saved environment in prefs or it could not be decoded. 78 // if there was no saved environment in prefs or it could not be decoded.
84 bool LoadSavedEnvironmentFromPrefs(); 79 bool LoadSavedEnvironmentFromPrefs();
85 80
86 // Records the passed profiled data, which should be a snapshot of the 81 // Records the passed profiled data, which should be a snapshot of the
87 // browser's profiled performance during startup for a single process. 82 // browser's profiled performance during startup for a single process.
88 void RecordProfilerData( 83 void RecordProfilerData(
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 FRIEND_TEST_ALL_PREFIXES(MetricsLogTest, ChromeOSStabilityData); 135 FRIEND_TEST_ALL_PREFIXES(MetricsLogTest, ChromeOSStabilityData);
141 136
142 // Returns true if the environment has already been filled in by a call to 137 // Returns true if the environment has already been filled in by a call to
143 // RecordEnvironment() or LoadSavedEnvironmentFromPrefs(). 138 // RecordEnvironment() or LoadSavedEnvironmentFromPrefs().
144 bool HasEnvironment() const; 139 bool HasEnvironment() const;
145 140
146 // Returns true if the stability metrics have already been filled in by a 141 // Returns true if the stability metrics have already been filled in by a
147 // call to RecordStabilityMetrics(). 142 // call to RecordStabilityMetrics().
148 bool HasStabilityMetrics() const; 143 bool HasStabilityMetrics() const;
149 144
150 // Within stability group, write plugin crash stats.
151 void WritePluginStabilityElements(PrefService* pref);
152
153 // Within the stability group, write required attributes. 145 // Within the stability group, write required attributes.
154 void WriteRequiredStabilityAttributes(PrefService* pref); 146 void WriteRequiredStabilityAttributes(PrefService* pref);
155 147
156 // Within the stability group, write attributes that need to be updated asap 148 // Within the stability group, write attributes that need to be updated asap
157 // and can't be delayed until the user decides to restart chromium. 149 // and can't be delayed until the user decides to restart chromium.
158 // Delaying these stats would bias metrics away from happy long lived 150 // Delaying these stats would bias metrics away from happy long lived
159 // chromium processes (ones that don't crash, and keep on running). 151 // chromium processes (ones that don't crash, and keep on running).
160 void WriteRealtimeStabilityAttributes(PrefService* pref, 152 void WriteRealtimeStabilityAttributes(PrefService* pref,
161 base::TimeDelta incremental_uptime, 153 base::TimeDelta incremental_uptime,
162 base::TimeDelta uptime); 154 base::TimeDelta uptime);
163 155
164 // Writes the list of installed plugins.
165 void WritePluginList(const std::vector<content::WebPluginInfo>& plugin_list);
166
167 // Observes network state to provide values for SystemProfile::Network. 156 // Observes network state to provide values for SystemProfile::Network.
168 MetricsNetworkObserver network_observer_; 157 MetricsNetworkObserver network_observer_;
169 158
170 // The time when the current log was created. 159 // The time when the current log was created.
171 const base::TimeTicks creation_time_; 160 const base::TimeTicks creation_time_;
172 161
173 // For including information on which extensions are installed in reports. 162 // For including information on which extensions are installed in reports.
174 HashedExtensionMetrics extension_metrics_; 163 HashedExtensionMetrics extension_metrics_;
175 164
176 DISALLOW_COPY_AND_ASSIGN(MetricsLog); 165 DISALLOW_COPY_AND_ASSIGN(MetricsLog);
177 }; 166 };
178 167
179 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_ 168 #endif // CHROME_BROWSER_METRICS_METRICS_LOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698