Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: base/at_exit.cc

Issue 1805: Add a void* parameter to the AtExitManager callbacks. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/at_exit.h ('k') | base/at_exit_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/at_exit.cc
===================================================================
--- base/at_exit.cc (revision 1691)
+++ base/at_exit.cc (working copy)
@@ -35,14 +35,16 @@
}
// 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 @@
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
-
« no previous file with comments | « base/at_exit.h ('k') | base/at_exit_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698