diff options
author | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-08 09:06:51 +0000 |
---|---|---|
committer | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-08 09:06:51 +0000 |
commit | 9795ec11c994c7750a19aeab79cbf094df0d90dd (patch) | |
tree | 0fa6e92fbba024e5ad495461cfbb49527a2c600d /base/at_exit.cc | |
parent | 88eb0a862e97af4ec2e7c6fe1b5d32652cb8a854 (diff) | |
download | chromium_src-9795ec11c994c7750a19aeab79cbf094df0d90dd.zip chromium_src-9795ec11c994c7750a19aeab79cbf094df0d90dd.tar.gz chromium_src-9795ec11c994c7750a19aeab79cbf094df0d90dd.tar.bz2 |
Add a void* parameter to the AtExitManager callbacks.
Review URL: http://codereview.chromium.org/1805
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1835 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/at_exit.cc')
-rw-r--r-- | base/at_exit.cc | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/base/at_exit.cc b/base/at_exit.cc index fb4e8c9..9fdfd77 100644 --- a/base/at_exit.cc +++ b/base/at_exit.cc @@ -35,14 +35,16 @@ AtExitManager::~AtExitManager() { } // static -void AtExitManager::RegisterCallback(AtExitCallbackType func) { +void AtExitManager::RegisterCallback(AtExitCallbackType func, void* param) { if (!g_top_manager) { NOTREACHED() << "Tried to RegisterCallback without an AtExitManager"; return; } + DCHECK(func); + AutoLock lock(g_top_manager->lock_); - g_top_manager->stack_.push(func); + g_top_manager->stack_.push(CallbackAndParam(func, param)); } // static @@ -55,12 +57,11 @@ void AtExitManager::ProcessCallbacksNow() { AutoLock lock(g_top_manager->lock_); while (!g_top_manager->stack_.empty()) { - AtExitCallbackType func = g_top_manager->stack_.top(); + CallbackAndParam callback_and_param = g_top_manager->stack_.top(); g_top_manager->stack_.pop(); - if (func) - func(); + + callback_and_param.func_(callback_and_param.param_); } } } // namespace base - |