Chromium Code Reviews| Index: chrome/browser/metrics/metrics_service.h |
| diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h |
| index 82c89cf8047bbe49cc34c2ad2c061e3de9feec4a..e64a565d7937f0e57cefd6775e71fd0a7d172f91 100644 |
| --- a/chrome/browser/metrics/metrics_service.h |
| +++ b/chrome/browser/metrics/metrics_service.h |
| @@ -14,6 +14,7 @@ |
| #include <vector> |
| #include "base/basictypes.h" |
| +#include "base/cancelable_callback.h" |
| #include "base/gtest_prod_util.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/memory/weak_ptr.h" |
| @@ -28,6 +29,7 @@ |
| #if defined(OS_CHROMEOS) |
| #include "chrome/browser/chromeos/external_metrics.h" |
| +#include "chrome/browser/chromeos/system/statistics_provider.h" |
| #endif |
| class BookmarkModel; |
| @@ -66,6 +68,9 @@ class MetricsService |
| : public chrome_browser_metrics::TrackingSynchronizerObserver, |
| public content::NotificationObserver, |
| public content::URLFetcherDelegate, |
| +#if defined(OS_CHROMEOS) |
| + public chromeos::system::StatisticsProvider::Observer, |
| +#endif |
| public MetricsServiceBase { |
| public: |
| MetricsService(); |
| @@ -158,14 +163,22 @@ class MetricsService |
| NEED_TO_SHUTDOWN = ~CLEANLY_SHUTDOWN |
| }; |
| - // First part of the init task. Called on the FILE thread to load hardware |
| - // class information. |
| - static void InitTaskGetHardwareClass(base::WeakPtr<MetricsService> self, |
| - base::MessageLoopProxy* target_loop); |
| + // First init task, that starts retrieving the hardware class. It proceeds |
| + // to InitTaskGetPluginInfo after reading the hardware_class, or after |
| + // timing out waiting for it. |
| + void InitTaskGetHardwareClass(); |
| - // Callback from InitTaskGetHardwareClass() that continues the init task by |
| - // loading plugin information. |
| - void OnInitTaskGotHardwareClass(const std::string& hardware_class); |
| +#if defined(OS_CHROMEOS) |
| + // chromeos::system::StatisticsProvider::Observer implementation: |
| + virtual void OnMachineStatisticsReady() OVERRIDE; |
| + |
| + // Handles a timeout while waiting for the StatisticsProvider to become ready |
| + // during initialization. |
| + void OnStatisticsProviderTimeout(); |
| +#endif |
| + |
| + // Second init task, that starts retrieving plugin info. |
| + void InitTaskGetPluginInfo(); |
| // Callback from PluginService::GetPlugins() that continues the init task by |
| // launching a task to gather Google Update statistics. |
| @@ -440,6 +453,11 @@ class MetricsService |
| #if defined(OS_CHROMEOS) |
| // The external metric service is used to log ChromeOS UMA events. |
| scoped_refptr<chromeos::ExternalMetrics> external_metrics_; |
| + |
| + // Used to resume initialization of the MetricsService when the |
| + // StatisticsProvider becomes ready, or after timing out while waiting for it. |
| + base::CancelableClosure timeout_callback_; |
| + base::CancelableClosure on_ready_callback_; |
|
Ilya Sherman
2012/05/16 01:01:17
nit: I'd recommend either prefixing both callbacks
Joao da Silva
2012/05/16 12:53:34
Renamed to on_timeout_callback_.
|
| #endif |
| // Reduntant marker to check that we completed our shutdown, and set the |