summaryrefslogtreecommitdiffstats
path: root/base/lazy_instance.h
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 09:11:39 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-19 09:11:39 +0000
commit4ea927b886af2654b5a193278c0bfb6c25b56fc7 (patch)
tree81c0a1916e2b683b687ed6538386fcdbc9261c11 /base/lazy_instance.h
parentd10852ddcea9285a2808a1fa0caeddf4c5e221e0 (diff)
downloadchromium_src-4ea927b886af2654b5a193278c0bfb6c25b56fc7.zip
chromium_src-4ea927b886af2654b5a193278c0bfb6c25b56fc7.tar.gz
chromium_src-4ea927b886af2654b5a193278c0bfb6c25b56fc7.tar.bz2
Isolate tests by running AtExit callbacks between them.
For now, this is only for base_unittests. The plan is to enable it for all unit tests. This should finally fix mysterious problems cause by Singletons surviving after one test etc. This change also adapts LazyInstance so that it can be reused after being destroyed. It is used very frequently, for example each time a MessageLoop is used. It is also worth noting that we had some problems in the past related to the MessageLoop being destroyed and re-instantiated in the same test executable. This patch should also fix that. TEST=none BUG=12710 Review URL: http://codereview.chromium.org/372057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32507 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/lazy_instance.h')
-rw-r--r--base/lazy_instance.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index d0cc109..d7754a7 100644
--- a/base/lazy_instance.h
+++ b/base/lazy_instance.h
@@ -76,6 +76,10 @@ class LazyInstanceHelper {
base::subtle::Atomic32 state_;
private:
+ // Resets state of |helper| to STATE_EMPTY so that it can be reused.
+ // Not thread safe.
+ static void ResetState(void* helper);
+
DISALLOW_COPY_AND_ASSIGN(LazyInstanceHelper);
};