summaryrefslogtreecommitdiffstats
path: root/base/at_exit.h
diff options
context:
space:
mode:
authordeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-11 14:02:06 +0000
committerdeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-11 14:02:06 +0000
commit4ac8f670af190931c88542ae57295da97e2971ce (patch)
treec53779e5876223856392e291d340c20088ab339e /base/at_exit.h
parent663fe3c5c9327b3b604fe7f2c7fd3f4d5cccc4e4 (diff)
downloadchromium_src-4ac8f670af190931c88542ae57295da97e2971ce.zip
chromium_src-4ac8f670af190931c88542ae57295da97e2971ce.tar.gz
chromium_src-4ac8f670af190931c88542ae57295da97e2971ce.tar.bz2
Allow multiple AtExitManagers to be chained in a stack, this allows much easier testing for code that is expecting to be run via an AtExitManager. This actually cleaned up a lot of the at exit code.
Clean up singleton_dll_unittest. It is no longer windows specific DLL, and now is much simpler, and builds and runs cross platform. BUG=1314043 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/at_exit.h')
-rw-r--r--base/at_exit.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/base/at_exit.h b/base/at_exit.h
index 8b9f946..123935d 100644
--- a/base/at_exit.h
+++ b/base/at_exit.h
@@ -54,6 +54,12 @@ typedef void (*AtExitCallbackType)();
// callbacks and singleton destructors will be called.
class AtExitManager {
+ protected:
+ // This constructor will allow this instance of AtExitManager to be created
+ // even if on already exists. This should only be used for testing!
+ // AtExitManagers are kept on a global stack, and it will be removed during
+ // destruction. This allows you to shadow another AtExitManager.
+ AtExitManager(bool shadow);
public:
AtExitManager();
@@ -71,7 +77,7 @@ class AtExitManager {
private:
Lock lock_;
- std::stack<base::AtExitCallbackType> atexit_queue_;
+ std::stack<base::AtExitCallbackType> stack_;
DISALLOW_EVIL_CONSTRUCTORS(AtExitManager);
};