summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authordilmah@chromium.org <dilmah@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 19:21:59 +0000
committerdilmah@chromium.org <dilmah@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-22 19:21:59 +0000
commit332710b135ef087d130e8f70e0aba8e187816be2 (patch)
tree972f588deb51f4ec95a28bf50c8045eb93c871ec /base
parentc9067ac524b9e543f07398b8821ad0f80af589bf (diff)
downloadchromium_src-332710b135ef087d130e8f70e0aba8e187816be2.zip
chromium_src-332710b135ef087d130e8f70e0aba8e187816be2.tar.gz
chromium_src-332710b135ef087d130e8f70e0aba8e187816be2.tar.bz2
Do not block in OwnershipService::IsAlreadyOwned on UI thread.
Moved all stuff related to GetOwnershipStatus from user_cros_settings.cc where it was irrelevant to OwnershipService. Prefetch and cache ownership status in order not to block on UI thread. BUG=chromium:70097 TEST=Manual Review URL: http://codereview.chromium.org/6538057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75617 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/lazy_instance.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index f4cfda0..e50902d 100644
--- a/base/lazy_instance.h
+++ b/base/lazy_instance.h
@@ -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<int8*>(static_cast<void*>(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.