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

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

Issue 7980011: Convert the PluginService interface to be an async wrapper around PluginList. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for review Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 service that collects information about the user 5 // This file defines a service that collects information about the user
6 // experience in order to help improve future versions of the app. 6 // experience in order to help improve future versions of the app.
7 7
8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 8 #ifndef CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 9 #define CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
10 #pragma once 10 #pragma once
(...skipping 19 matching lines...) Expand all
30 class BookmarkNode; 30 class BookmarkNode;
31 class HistogramSynchronizer; 31 class HistogramSynchronizer;
32 class MetricsLogBase; 32 class MetricsLogBase;
33 class MetricsReportingScheduler; 33 class MetricsReportingScheduler;
34 class PrefService; 34 class PrefService;
35 class TemplateURLService; 35 class TemplateURLService;
36 36
37 namespace base { 37 namespace base {
38 class DictionaryValue; 38 class DictionaryValue;
39 class ListValue; 39 class ListValue;
40 class MessageLoopProxy;
40 } 41 }
41 42
42 namespace webkit { 43 namespace webkit {
43 struct WebPluginInfo; 44 struct WebPluginInfo;
44 } 45 }
45 46
46 class MetricsService : public NotificationObserver, 47 class MetricsService : public NotificationObserver,
47 public URLFetcher::Delegate, 48 public URLFetcher::Delegate,
48 public MetricsServiceBase { 49 public MetricsServiceBase {
49 public: 50 public:
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 enum State { 148 enum State {
148 INITIALIZED, // Constructor was called. 149 INITIALIZED, // Constructor was called.
149 INIT_TASK_SCHEDULED, // Waiting for deferred init tasks to complete. 150 INIT_TASK_SCHEDULED, // Waiting for deferred init tasks to complete.
150 INIT_TASK_DONE, // Waiting for timer to send initial log. 151 INIT_TASK_DONE, // Waiting for timer to send initial log.
151 INITIAL_LOG_READY, // Initial log generated, and waiting for reply. 152 INITIAL_LOG_READY, // Initial log generated, and waiting for reply.
152 SEND_OLD_INITIAL_LOGS, // Sending unsent logs from previous session. 153 SEND_OLD_INITIAL_LOGS, // Sending unsent logs from previous session.
153 SENDING_OLD_LOGS, // Sending unsent logs from previous session. 154 SENDING_OLD_LOGS, // Sending unsent logs from previous session.
154 SENDING_CURRENT_LOGS, // Sending standard current logs as they acrue. 155 SENDING_CURRENT_LOGS, // Sending standard current logs as they acrue.
155 }; 156 };
156 157
158 // When in the INIT_TASK_SCHEDULED state, multiple tasks are performed. In the
jam 2011/09/21 00:04:51 are all these changes really necessary? can't we k
Robert Sesek 2011/09/21 01:13:44 Ok. Made the init tasks serial.
159 // completion callback, when all init tasks are done, the service moves to
160 // INIT_TASK_DONE.
161 enum InitSubtaskState {
162 INIT_SUBTASK_UNSTARTED = 0, // Init subtasks have not been started.
163 INIT_SUBTASK_PLUGINS = 1 << 0, // Finished loading the plugin list.
164 INIT_SUBTASK_HWCLASS = 1 << 1, // Finished loading the hardware class.
165 INIT_SUBTASK_ALL = INIT_SUBTASK_PLUGINS | INIT_SUBTASK_HWCLASS,
166 };
167
157 enum ShutdownCleanliness { 168 enum ShutdownCleanliness {
158 CLEANLY_SHUTDOWN = 0xdeadbeef, 169 CLEANLY_SHUTDOWN = 0xdeadbeef,
159 NEED_TO_SHUTDOWN = ~CLEANLY_SHUTDOWN 170 NEED_TO_SHUTDOWN = ~CLEANLY_SHUTDOWN
160 }; 171 };
161 172
162 class InitTask; 173 // Method that is run as a delayed task after the MetricsService is
163 class InitTaskComplete; 174 // constructed to perform initialization tasks.
175 void RunInitTasks();
164 176
165 // Callback to let us know that the init task is done. 177 // Called on the FILE thread to load hardware class information.
166 void OnInitTaskComplete( 178 void InitTaskGetHardwareClass(base::MessageLoopProxy* target_loop);
167 const std::string& hardware_class, 179
168 const std::vector<webkit::WebPluginInfo>& plugins); 180 // Callbacks to let us know that the init task is done.
181 void OnInitTaskGotHardwareClass(const std::string& hardware_class);
182 void OnInitTaskGotPluginInfo(
183 std::vector<webkit::WebPluginInfo> plugins);
184
185 // Moves the |state_| to INIT_TASK_DONE if all the init subtasks have
186 // completed.
187 void OnInitTaskMaybeDone();
169 188
170 // When we start a new version of Chromium (different from our last run), we 189 // When we start a new version of Chromium (different from our last run), we
171 // need to discard the old crash stats so that we don't attribute crashes etc. 190 // need to discard the old crash stats so that we don't attribute crashes etc.
172 // in the old version to the current version (via current logs). 191 // in the old version to the current version (via current logs).
173 // Without this, a common reason to finally start a new version is to crash 192 // Without this, a common reason to finally start a new version is to crash
174 // the old version (after an autoupdate has arrived), and so we'd bias 193 // the old version (after an autoupdate has arrived), and so we'd bias
175 // initial results towards showing crashes :-(. 194 // initial results towards showing crashes :-(.
176 static void DiscardOldStabilityStats(PrefService* local_state); 195 static void DiscardOldStabilityStats(PrefService* local_state);
177 196
178 // Sets and gets whether metrics recording is active. 197 // Sets and gets whether metrics recording is active.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // Indicate whether recording and reporting are currently happening. 370 // Indicate whether recording and reporting are currently happening.
352 // These should not be set directly, but by calling SetRecording and 371 // These should not be set directly, but by calling SetRecording and
353 // SetReporting. 372 // SetReporting.
354 bool recording_active_; 373 bool recording_active_;
355 bool reporting_active_; 374 bool reporting_active_;
356 375
357 // The progession of states made by the browser are recorded in the following 376 // The progession of states made by the browser are recorded in the following
358 // state. 377 // state.
359 State state_; 378 State state_;
360 379
380 // The state of the init subtask.
381 uint32 init_state_;
382
361 // Chrome OS hardware class (e.g., hardware qualification ID). This 383 // Chrome OS hardware class (e.g., hardware qualification ID). This
362 // class identifies the configured system components such as CPU, 384 // class identifies the configured system components such as CPU,
363 // WiFi adapter, etc. For non Chrome OS hosts, this will be an 385 // WiFi adapter, etc. For non Chrome OS hosts, this will be an
364 // empty string. 386 // empty string.
365 std::string hardware_class_; 387 std::string hardware_class_;
366 388
367 // The list of plugins which was retrieved on the file thread. 389 // The list of plugins which was retrieved on the file thread.
368 std::vector<webkit::WebPluginInfo> plugins_; 390 std::vector<webkit::WebPluginInfo> plugins_;
369 391
370 // The outstanding transmission appears as a URL Fetch operation. 392 // The outstanding transmission appears as a URL Fetch operation.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 private: 479 private:
458 friend class InstantFieldTrial; 480 friend class InstantFieldTrial;
459 481
460 // Returns true if prefs::kMetricsReportingEnabled is set. 482 // Returns true if prefs::kMetricsReportingEnabled is set.
461 static bool IsMetricsReportingEnabled(); 483 static bool IsMetricsReportingEnabled();
462 484
463 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper); 485 DISALLOW_IMPLICIT_CONSTRUCTORS(MetricsServiceHelper);
464 }; 486 };
465 487
466 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_ 488 #endif // CHROME_BROWSER_METRICS_METRICS_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698