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

Unified Diff: chrome/browser/metrics/metrics_service.h

Issue 10078017: Added asynchronous notification of readiness to the StatisticsProvider, and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Timeout while waiting for the hardware_class; sample UMA stats Created 8 years, 8 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 cfe194359bad97e8d4e42b12b333f9b86a629ffe..2cfa42404ad0006ad44cd273b40c07663fad6a7f 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -39,6 +39,7 @@ class TemplateURLService;
namespace base {
class DictionaryValue;
class MessageLoopProxy;
+class Time;
}
namespace content {
@@ -157,14 +158,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);
+ // Callback for the StatisticsProvider to signal that hardware data has been
+ // loaded. Retrieves the hardware class and stores it in hardware_class_.
+ // |start_time| is a timestamp of when the initialization was first requested.
+ void OnStatisticsProviderReady(const base::Time& start_time);
+
+ // Handles a timeout while waiting for the StatisticsProvider to become ready
+ // during initialization.
+ void OnStatisticsProviderTimeout();
+
+ // Second init task, that starts retrieving plugin info.
+ void InitTaskGetPluginInfo();
// Callback from PluginService::GetPlugins() that continues the init task by
// loading profiler data.
@@ -412,6 +421,9 @@ class MetricsService
// this factory are invalidated in ScheduleNextStateSave.
base::WeakPtrFactory<MetricsService> state_saver_factory_;
+ // Weak pointers factory used to post and invalidate the timeout task.
+ base::WeakPtrFactory<MetricsService> timeout_task_factory_;
Ilya Sherman 2012/04/30 07:36:41 nit: Why not just use self_ptr_factory_ here?
Joao da Silva 2012/05/15 13:52:47 Because self_ptr_factory_ is used to post other ta
+
// Dictionary containing all the profile specific metrics. This is set
// at creation time from the prefs.
scoped_ptr<base::DictionaryValue> profile_dictionary_;

Powered by Google App Engine
This is Rietveld 408576698