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

Unified Diff: chrome/browser/chromeos/cros/cros_library.cc

Issue 7891021: Use stub impl when libcros fails to load (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix power manager stub impl Created 9 years, 3 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/cros/cros_library.cc
diff --git a/chrome/browser/chromeos/cros/cros_library.cc b/chrome/browser/chromeos/cros/cros_library.cc
index e3dc3558930a828d36ab52e73b1481ba396a28d2..cfcf2e1194f8dd07f3ee3bd2b7824ee29a1ec711 100644
--- a/chrome/browser/chromeos/cros/cros_library.cc
+++ b/chrome/browser/chromeos/cros/cros_library.cc
@@ -19,9 +19,12 @@
#include "chrome/browser/chromeos/cros/update_library.h"
#include "third_party/cros/chromeos_cros_api.h"
+// Pass !libcros_loaded_ to GetDefaultImpl instead of use_stub_impl_ so that
+// we load the stub impl regardless of whether use_stub was specified or the
+// library failed to load.
#define DEFINE_GET_LIBRARY_METHOD(class_prefix, var_prefix) \
class_prefix##Library* CrosLibrary::Get##class_prefix##Library() { \
- return var_prefix##_lib_.GetDefaultImpl(use_stub_impl_); \
+ return var_prefix##_lib_.GetDefaultImpl(!libcros_loaded_); \
}
#define DEFINE_SET_LIBRARY_METHOD(class_prefix, var_prefix) \
@@ -58,10 +61,12 @@ void CrosLibrary::Initialize(bool use_stub) {
}
// Attempt to load libcros here, so that we can log, show warnings, and
// set load_error_string_ immediately.
- if (g_cros_library->LoadLibcros())
+ if (g_cros_library->LoadLibcros()) {
VLOG(1) << "CrosLibrary Initialized, version = " << kCrosAPIVersion;
- else
- LOG(WARNING) << "CrosLibrary failed to Initialize.";
+ } else {
+ LOG(WARNING) << "CrosLibrary failed to Initialize."
+ << " Will use stub implementations.";
satorux1 2011/09/16 20:05:55 This is okay for Linux desktop, but I think this s
stevenjb 2011/09/16 21:44:24 I actually prefer to use a warning here. We alread
satorux1 2011/09/16 21:59:43 I misunderstood. I thought you changed this from a
+ }
}
// static

Powered by Google App Engine
This is Rietveld 408576698