Browse Source

Update base dependencies to revision 76017 from the Chromium SVN.

pull/567/head
Fredrik Roubert 15 years ago
committed by Mihaela Rosca
parent
commit
2ffba15063
3 changed files with 17 additions and 4 deletions
  1. +15
    -2
      cpp/src/base/lazy_instance.h
  2. +1
    -1
      cpp/src/base/singleton.h
  3. +1
    -1
      cpp/src/base/threading/platform_thread_posix.cc

+ 15
- 2
cpp/src/base/lazy_instance.h View File

@ -88,7 +88,7 @@ class LazyInstanceHelper {
STATE_CREATED = 2 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 // Declaring a destructor (even if it's empty) will cause MSVC to register a
// static initializer to register the empty destructor with atexit(). // static initializer to register the empty destructor with atexit().
@ -127,7 +127,7 @@ class LazyInstance : public LazyInstanceHelper {
NeedsInstance()) { NeedsInstance()) {
// Create the instance in the space provided by |buf_|. // Create the instance in the space provided by |buf_|.
instance_ = Traits::New(buf_); instance_ = Traits::New(buf_);
// Traits::Delete will be null for LeakyLazyInstannceTraits
// Traits::Delete will be null for LeakyLazyInstanceTraits
void (*dtor)(void*) = Traits::Delete; void (*dtor)(void*) = Traits::Delete;
CompleteInstance(this, (dtor == NULL) ? NULL : OnExit); CompleteInstance(this, (dtor == NULL) ? NULL : OnExit);
} }
@ -141,6 +141,19 @@ class LazyInstance : public LazyInstanceHelper {
return instance_; return instance_;
} }
bool operator==(Type* p) {
switch (base::subtle::NoBarrier_Load(&state_)) {
case STATE_EMPTY:
return p == NULL;
case STATE_CREATING:
return static_cast<int8*>(static_cast<void*>(p)) == buf_;
case STATE_CREATED:
return p == instance_;
default:
return false;
}
}
private: private:
// Adapter function for use with AtExit. This should be called single // Adapter function for use with AtExit. This should be called single
// threaded, so don't use atomic operations. // threaded, so don't use atomic operations.


+ 1
- 1
cpp/src/base/singleton.h View File

@ -254,7 +254,7 @@ class Singleton {
// Adapter function for use with AtExit(). This should be called single // Adapter function for use with AtExit(). This should be called single
// threaded, so don't use atomic operations. // threaded, so don't use atomic operations.
// Calling OnExit while singleton is in use by other threads is a mistake. // 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 // AtExit should only ever be register after the singleton instance was
// created. We should only ever get here with a valid instance_ pointer. // created. We should only ever get here with a valid instance_ pointer.
Traits::Delete( Traits::Delete(


+ 1
- 1
cpp/src/base/threading/platform_thread_posix.cc View File

@ -189,7 +189,7 @@ void PlatformThread::SetName(const char* name) {
// Mac is implemented in platform_thread_mac.mm. // Mac is implemented in platform_thread_mac.mm.
#else #else
// static // static
void PlatformThread::SetName(const char* /* name */) {
void PlatformThread::SetName(const char* /*name*/) {
// Leave it unimplemented. // Leave it unimplemented.
// (This should be relatively simple to implement for the BSDs; I // (This should be relatively simple to implement for the BSDs; I


Loading…
Cancel
Save