summaryrefslogtreecommitdiffstats
path: root/base/at_exit.h
diff options
context:
space:
mode:
authordeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-08 09:06:51 +0000
committerdeanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-08 09:06:51 +0000
commit9795ec11c994c7750a19aeab79cbf094df0d90dd (patch)
tree0fa6e92fbba024e5ad495461cfbb49527a2c600d /base/at_exit.h
parent88eb0a862e97af4ec2e7c6fe1b5d32652cb8a854 (diff)
downloadchromium_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.h')
-rw-r--r--base/at_exit.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/base/at_exit.h b/base/at_exit.h
index 94dff08..aecc892 100644
--- a/base/at_exit.h
+++ b/base/at_exit.h
@@ -35,7 +35,7 @@ class AtExitManager {
AtExitManager(bool shadow);
public:
- typedef void (*AtExitCallbackType)();
+ typedef void (*AtExitCallbackType)(void*);
AtExitManager();
@@ -45,15 +45,22 @@ class AtExitManager {
// Registers the specified function to be called at exit. The prototype of
// the callback function is void func().
- static void RegisterCallback(AtExitCallbackType func);
+ static void RegisterCallback(AtExitCallbackType func, void* param);
// Calls the functions registered with RegisterCallback in LIFO order. It
// is possible to register new callbacks after calling this function.
static void ProcessCallbacksNow();
private:
+ struct CallbackAndParam {
+ CallbackAndParam(AtExitCallbackType func, void* param)
+ : func_(func), param_(param) { }
+ AtExitCallbackType func_;
+ void* param_;
+ };
+
Lock lock_;
- std::stack<AtExitCallbackType> stack_;
+ std::stack<CallbackAndParam> stack_;
AtExitManager* next_manager_; // Stack of managers to allow shadowing.
DISALLOW_COPY_AND_ASSIGN(AtExitManager);
@@ -62,4 +69,3 @@ class AtExitManager {
} // namespace base
#endif // BASE_AT_EXIT_H_
-