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

Unified Diff: chrome/browser/chromeos/system/statistics_provider.h

Issue 10078017: Added asynchronous notification of readiness to the StatisticsProvider, and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Load hardware_class when available without delaying init of MetricsService 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/chromeos/system/statistics_provider.h
diff --git a/chrome/browser/chromeos/system/statistics_provider.h b/chrome/browser/chromeos/system/statistics_provider.h
index 1908087826ccb6b91d74b66b56b69ea3cdbde80e..671fc9212c31ee8035103cb883d40de4f3f5ee9a 100644
--- a/chrome/browser/chromeos/system/statistics_provider.h
+++ b/chrome/browser/chromeos/system/statistics_provider.h
@@ -8,6 +8,8 @@
#include <string>
+#include "base/callback.h"
+
namespace chromeos {
namespace system {
@@ -16,10 +18,19 @@ class StatisticsProvider {
public:
// Retrieve the named machine statistic (e.g. "hardware_class").
// This does not update the statistcs. If the |name| is not set, |result|
- // preserves old value.
+ // preserves the previous value.
Ilya Sherman 2012/04/20 21:18:37 nit: Perhaps "is unchanged" rather than "preserves
Joao da Silva 2012/04/23 09:36:50 Rephrased as suggested. It's not a DCHECK, since i
+ // This call may block if the statistics aren't ready yet, up to a timeout;
+ // it may also fail because the statistics weren't ready before the timeout.
+ // To make sure this won't block nor fail, invoke GetMachineStatistic() after
+ // WhenReady() has invoked its callback.
virtual bool GetMachineStatistic(const std::string& name,
std::string* result) = 0;
+ // Invokes |callback| on the UI loop once the statistics have been loaded.
+ // |callback| is immediately posted to the UI loop if the statistics are
+ // already available.
+ virtual void WhenReady(const base::Closure& callback) = 0;
+
static StatisticsProvider* GetInstance();
protected:

Powered by Google App Engine
This is Rietveld 408576698