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

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

Issue 10127009: Make NameValuePairsParser support values that contain the 'equal' separator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments 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.cc
diff --git a/chrome/browser/chromeos/system/statistics_provider.cc b/chrome/browser/chromeos/system/statistics_provider.cc
index 0d6798f8f6890f4ac82208f2c60eca24ffe59bfe..f7b88ff1d3504bf5ea5f538d4e6a5ce5be6fbfdf 100644
--- a/chrome/browser/chromeos/system/statistics_provider.cc
+++ b/chrome/browser/chromeos/system/statistics_provider.cc
@@ -107,6 +107,12 @@ bool StatisticsProviderImpl::GetMachineStatistic(
LOG(WARNING) << "Waiting to load statistics. Requested statistic: "
<< name;
on_statistics_loaded_.TimedWait(base::TimeDelta::FromSeconds(kTimeoutSecs));
+
+ if (!on_statistics_loaded_.IsSignaled()) {
+ LOG(ERROR) << "Statistics weren't loaded after waiting! "
+ << "Requested statistic: " << name;
+ return false;
+ }
}
NameValuePairsParser::NameValueMap::iterator iter = machine_info_.find(name);
@@ -126,10 +132,7 @@ StatisticsProviderImpl::StatisticsProviderImpl()
void StatisticsProviderImpl::StartLoadingMachineStatistics() {
VLOG(1) << "Started loading statistics";
- CHECK(BrowserThread::IsMessageLoopValid(BrowserThread::FILE))
- << "StatisticsProvider must not be used before FILE thread is created";
- BrowserThread::PostTask(
- BrowserThread::FILE,
+ BrowserThread::PostBlockingPoolTask(
FROM_HERE,
base::Bind(&StatisticsProviderImpl::LoadMachineStatistics,
base::Unretained(this)));
@@ -139,9 +142,12 @@ void StatisticsProviderImpl::LoadMachineStatistics() {
NameValuePairsParser parser(&machine_info_);
// Parse all of the key/value pairs from the crossystem tool.
- parser.ParseNameValuePairsFromTool(
- arraysize(kCrosSystemTool), kCrosSystemTool, kCrosSystemEq,
- kCrosSystemDelim, kCrosSystemCommentDelim);
+ if (!parser.ParseNameValuePairsFromTool(
+ arraysize(kCrosSystemTool), kCrosSystemTool, kCrosSystemEq,
+ kCrosSystemDelim, kCrosSystemCommentDelim)) {
+ LOG(WARNING) << "There were errors parsing the output of "
+ << kCrosSystemTool << ".";
+ }
// Ensure that the hardware class key is present with the expected
// key name, and if it couldn't be retrieved, that the value is "unknown".

Powered by Google App Engine
This is Rietveld 408576698