From 4ea927b886af2654b5a193278c0bfb6c25b56fc7 Mon Sep 17 00:00:00 2001 From: "phajdan.jr@chromium.org" Date: Thu, 19 Nov 2009 09:11:39 +0000 Subject: 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 --- base/lazy_instance.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'base/lazy_instance.h') 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); }; -- cgit v1.1