From 7285ca5b07de7d6d9b8e4750b384b28a825b7a52 Mon Sep 17 00:00:00 2001 From: "satorux@chromium.org" Date: Sat, 1 Oct 2011 01:43:00 +0000 Subject: Revert 103572 - Use stub StatisticsProvider implementation on Linux desktop This broke many tests in browser_tests. -- This will silence spurious error messages like below. out/Release/chrome --enable-logging=stderr --login-manager ... [10361:10361:1375055823758:WARNING:name_value_pairs_parser.cc(77)] /usr/bin/crossystem not found. Maybe running on Linux desktop? [10361:10361:1375055827762:WARNING:name_value_pairs_parser.cc(102)] Error excuting: /bin/cat /tmp/machine-info [10361:10361:1375055832942:WARNING:name_value_pairs_parser.cc(102)] Error excuting: /bin/cat /var/log/vpd_2.0.txt TEST=confirm that the errors are gone from Linux desktop, and the functionality works on chrome os (add --vmodule=name_value_pairs_parser=1 and check the log). BUG=chromium-os:21080 Review URL: http://codereview.chromium.org/8098006 TBR=satorux@chromium.org Review URL: http://codereview.chromium.org/8098018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103615 0039d316-1c4b-4281-b951-d872f2087c98 --- .../chromeos/system/name_value_pairs_parser.cc | 2 +- .../browser/chromeos/system/statistics_provider.cc | 36 +++------------------- 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/chrome/browser/chromeos/system/name_value_pairs_parser.cc b/chrome/browser/chromeos/system/name_value_pairs_parser.cc index 3c2c3c8..16a6bad 100644 --- a/chrome/browser/chromeos/system/name_value_pairs_parser.cc +++ b/chrome/browser/chromeos/system/name_value_pairs_parser.cc @@ -74,7 +74,7 @@ bool NameValuePairsParser::GetSingleValueFromTool(int argc, // TODO(stevenjb,satorux): Make this non blocking: crosbug.com/5603. base::ThreadRestrictions::ScopedAllowIO allow_io_for_thread_join; if (!file_util::PathExists(FilePath(argv[0]))) { - LOG(ERROR) << argv[0] << " not found"; + LOG(WARNING) << argv[0] << " not found. Maybe running on Linux desktop?"; return false; } diff --git a/chrome/browser/chromeos/system/statistics_provider.cc b/chrome/browser/chromeos/system/statistics_provider.cc index 516465b..f863c1f 100644 --- a/chrome/browser/chromeos/system/statistics_provider.cc +++ b/chrome/browser/chromeos/system/statistics_provider.cc @@ -7,7 +7,6 @@ #include "base/memory/singleton.h" #include "base/task.h" #include "chrome/browser/chromeos/system/name_value_pairs_parser.h" -#include "chrome/browser/chromeos/system/runtime_environment.h" namespace chromeos { namespace system { @@ -39,7 +38,6 @@ const char kVpdDelim[] = "\n"; } // namespace -// The StatisticsProvider implementation used in production. class StatisticsProviderImpl : public StatisticsProvider { public: // StatisticsProvider implementation: @@ -101,37 +99,13 @@ StatisticsProviderImpl* StatisticsProviderImpl::GetInstance() { DefaultSingletonTraits >::get(); } -// The stub StatisticsProvider implementation used on Linux desktop. -class StatisticsProviderStubImpl : public StatisticsProvider { - public: - // StatisticsProvider implementation: - virtual bool GetMachineStatistic(const std::string& name, - std::string* result) { - *result = "stub statistic for " + name; - return true; - } - - static StatisticsProviderStubImpl* GetInstance() { - return Singleton >::get(); - } - - private: - friend struct DefaultSingletonTraits; - - StatisticsProviderStubImpl() { - } - - DISALLOW_COPY_AND_ASSIGN(StatisticsProviderStubImpl); -}; - StatisticsProvider* StatisticsProvider::GetInstance() { - if (system::runtime_environment::IsRunningOnChromeOS()) { - return StatisticsProviderImpl::GetInstance(); - } else { - return StatisticsProviderStubImpl::GetInstance(); - } + return StatisticsProviderImpl::GetInstance(); } } // namespace system } // namespace chromeos + +// Allows InvokeLater without adding refcounting. StatisticsProviderImpl is a +// Singleton and won't be deleted until it's last InvokeLater is run. +DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::system::StatisticsProviderImpl); -- cgit v1.1