diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-22 22:09:35 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-22 22:09:35 +0000 |
commit | 5ceb1b0ba8c3ab4fe3f7907940ad904e700114f4 (patch) | |
tree | 0f7dfc719d3b1ac5ba6b7d050e760036fdc104f3 /base | |
parent | 6f706f3a3b9ca5c0bbef36cee7e476fc2e91a224 (diff) | |
download | chromium_src-5ceb1b0ba8c3ab4fe3f7907940ad904e700114f4.zip chromium_src-5ceb1b0ba8c3ab4fe3f7907940ad904e700114f4.tar.gz chromium_src-5ceb1b0ba8c3ab4fe3f7907940ad904e700114f4.tar.bz2 |
Base: Change the AtExitManager so that if base is built
as a dll, multiple managers could coexist in the same
address space.
BUG=76996
TEST=none
Review URL: http://codereview.chromium.org/6897015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82724 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/at_exit.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/base/at_exit.cc b/base/at_exit.cc index e467c5d..b7ab0a7 100644 --- a/base/at_exit.cc +++ b/base/at_exit.cc @@ -12,13 +12,19 @@ namespace base { // Keep a stack of registered AtExitManagers. We always operate on the most -// recent, and we should never have more than one outside of testing, when we -// use the shadow version of the constructor. We don't protect this for -// thread-safe access, since it will only be modified in testing. +// recent, and we should never have more than one outside of testing (for a +// statically linked version of this library). Testing may use the shadow +// version of the constructor, and if we are building a dynamic library we may +// end up with multiple AtExitManagers on the same process. We don't protect +// this for thread-safe access, since it will only be modified in testing. static AtExitManager* g_top_manager = NULL; -AtExitManager::AtExitManager() : next_manager_(NULL) { +AtExitManager::AtExitManager() : next_manager_(g_top_manager) { +// If multiple modules instantiate AtExitManagers they'll end up living in this +// module... they have to coexist. +#if !defined(BASE_DLL) DCHECK(!g_top_manager); +#endif g_top_manager = this; } |