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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/metrics_service.h
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index 46867ed717d9706d379ae6e683a6708b5d9a16e6..4323daa3c6a20390042b99b9a33ba99b392c7677 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -37,6 +37,7 @@ class TemplateURLService;
namespace base {
class DictionaryValue;
class ListValue;
+class MessageLoopProxy;
}
namespace webkit {
@@ -154,18 +155,36 @@ class MetricsService : public NotificationObserver,
SENDING_CURRENT_LOGS, // Sending standard current logs as they acrue.
};
+ // 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.
+ // completion callback, when all init tasks are done, the service moves to
+ // INIT_TASK_DONE.
+ enum InitSubtaskState {
+ INIT_SUBTASK_UNSTARTED = 0, // Init subtasks have not been started.
+ INIT_SUBTASK_PLUGINS = 1 << 0, // Finished loading the plugin list.
+ INIT_SUBTASK_HWCLASS = 1 << 1, // Finished loading the hardware class.
+ INIT_SUBTASK_ALL = INIT_SUBTASK_PLUGINS | INIT_SUBTASK_HWCLASS,
+ };
+
enum ShutdownCleanliness {
CLEANLY_SHUTDOWN = 0xdeadbeef,
NEED_TO_SHUTDOWN = ~CLEANLY_SHUTDOWN
};
- class InitTask;
- class InitTaskComplete;
+ // Method that is run as a delayed task after the MetricsService is
+ // constructed to perform initialization tasks.
+ void RunInitTasks();
+
+ // Called on the FILE thread to load hardware class information.
+ void InitTaskGetHardwareClass(base::MessageLoopProxy* target_loop);
- // Callback to let us know that the init task is done.
- void OnInitTaskComplete(
- const std::string& hardware_class,
- const std::vector<webkit::WebPluginInfo>& plugins);
+ // Callbacks to let us know that the init task is done.
+ void OnInitTaskGotHardwareClass(const std::string& hardware_class);
+ void OnInitTaskGotPluginInfo(
+ std::vector<webkit::WebPluginInfo> plugins);
+
+ // Moves the |state_| to INIT_TASK_DONE if all the init subtasks have
+ // completed.
+ void OnInitTaskMaybeDone();
// When we start a new version of Chromium (different from our last run), we
// need to discard the old crash stats so that we don't attribute crashes etc.
@@ -358,6 +377,9 @@ class MetricsService : public NotificationObserver,
// state.
State state_;
+ // The state of the init subtask.
+ uint32 init_state_;
+
// Chrome OS hardware class (e.g., hardware qualification ID). This
// class identifies the configured system components such as CPU,
// WiFi adapter, etc. For non Chrome OS hosts, this will be an

Powered by Google App Engine
This is Rietveld 408576698