From 2ffba15063e4fa1f76d35dc0f79a113b45b74423 Mon Sep 17 00:00:00 2001 From: Fredrik Roubert Date: Fri, 25 Feb 2011 09:57:18 +0000 Subject: [PATCH] Update base dependencies to revision 76017 from the Chromium SVN. --- cpp/src/base/lazy_instance.h | 17 +++++++++++++++-- cpp/src/base/singleton.h | 2 +- cpp/src/base/threading/platform_thread_posix.cc | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cpp/src/base/lazy_instance.h b/cpp/src/base/lazy_instance.h index ef03d6e5c..a22dbf303 100644 --- a/cpp/src/base/lazy_instance.h +++ b/cpp/src/base/lazy_instance.h @@ -88,7 +88,7 @@ class LazyInstanceHelper { STATE_CREATED = 2 }; - explicit LazyInstanceHelper(LinkerInitialized /* x */) { /* state_ is 0 */ } + explicit LazyInstanceHelper(LinkerInitialized /*unused*/) {/* state_ is 0 */} // Declaring a destructor (even if it's empty) will cause MSVC to register a // static initializer to register the empty destructor with atexit(). @@ -127,7 +127,7 @@ class LazyInstance : public LazyInstanceHelper { NeedsInstance()) { // Create the instance in the space provided by |buf_|. instance_ = Traits::New(buf_); - // Traits::Delete will be null for LeakyLazyInstannceTraits + // Traits::Delete will be null for LeakyLazyInstanceTraits void (*dtor)(void*) = Traits::Delete; CompleteInstance(this, (dtor == NULL) ? NULL : OnExit); } @@ -141,6 +141,19 @@ class LazyInstance : public LazyInstanceHelper { return instance_; } + bool operator==(Type* p) { + switch (base::subtle::NoBarrier_Load(&state_)) { + case STATE_EMPTY: + return p == NULL; + case STATE_CREATING: + return static_cast(static_cast(p)) == buf_; + case STATE_CREATED: + return p == instance_; + default: + return false; + } + } + private: // Adapter function for use with AtExit. This should be called single // threaded, so don't use atomic operations. diff --git a/cpp/src/base/singleton.h b/cpp/src/base/singleton.h index ff606770e..0fe5e2782 100644 --- a/cpp/src/base/singleton.h +++ b/cpp/src/base/singleton.h @@ -254,7 +254,7 @@ class Singleton { // Adapter function for use with AtExit(). This should be called single // threaded, so don't use atomic operations. // Calling OnExit while singleton is in use by other threads is a mistake. - static void OnExit(void* /* unused */) { + static void OnExit(void* /*unused*/) { // AtExit should only ever be register after the singleton instance was // created. We should only ever get here with a valid instance_ pointer. Traits::Delete( diff --git a/cpp/src/base/threading/platform_thread_posix.cc b/cpp/src/base/threading/platform_thread_posix.cc index 68f10d640..103145a4d 100644 --- a/cpp/src/base/threading/platform_thread_posix.cc +++ b/cpp/src/base/threading/platform_thread_posix.cc @@ -189,7 +189,7 @@ void PlatformThread::SetName(const char* name) { // Mac is implemented in platform_thread_mac.mm. #else // static -void PlatformThread::SetName(const char* /* name */) { +void PlatformThread::SetName(const char* /*name*/) { // Leave it unimplemented. // (This should be relatively simple to implement for the BSDs; I