summaryrefslogtreecommitdiffstats
path: root/base/lazy_instance.cc
diff options
context:
space:
mode:
authordeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-26 11:28:03 +0000
committerdeanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-26 11:28:03 +0000
commit001b694d745a07e3eb42d6f48e30b8f9f8901138 (patch)
tree4c000504c31b9c7a77d060a49f87537e18ba66a9 /base/lazy_instance.cc
parent09e5f47ad0ab092bdf03025eb72c2a29cb9fe2ec (diff)
downloadchromium_src-001b694d745a07e3eb42d6f48e30b8f9f8901138.zip
chromium_src-001b694d745a07e3eb42d6f48e30b8f9f8901138.tar.gz
chromium_src-001b694d745a07e3eb42d6f48e30b8f9f8901138.tar.bz2
Added dynamic annotation files into base/.
Added annotations for atomic reference counting, LazyInstance and Singleton classes. This changelist is a part of an effort of adding ThreadSanitizer support for Chromium. See http://code.google.com/p/data-race-test/wiki/ThreadSanitizer Patch by Timur Iskhodzhanov. Review URL: http://codereview.chromium.org/147008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19353 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/lazy_instance.cc')
-rw-r--r--base/lazy_instance.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/base/lazy_instance.cc b/base/lazy_instance.cc
index 3f089e0..388622a 100644
--- a/base/lazy_instance.cc
+++ b/base/lazy_instance.cc
@@ -6,6 +6,7 @@
#include "base/at_exit.h"
#include "base/atomicops.h"
+#include "base/dynamic_annotations.h"
#include "base/basictypes.h"
#include "base/platform_thread.h"
@@ -20,6 +21,10 @@ void LazyInstanceHelper::EnsureInstance(void* instance,
&state_, STATE_EMPTY, STATE_CREATING) == STATE_EMPTY) {
// Created the instance in the space provided by |instance|.
ctor(instance);
+
+ // See the comment to the corresponding HAPPENS_AFTER in Pointer().
+ ANNOTATE_HAPPENS_BEFORE(&state_);
+
// Instance is created, go from CREATING to CREATED.
base::subtle::Release_Store(&state_, STATE_CREATED);
// Register the destructor callback with AtExitManager.