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

Unified Diff: base/at_exit.h

Issue 7831021: Support for registering arbitrary Tasks with AtExitManager. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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 | « no previous file | base/at_exit.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/at_exit.h
===================================================================
--- base/at_exit.h (revision 99168)
+++ base/at_exit.h (working copy)
@@ -10,6 +10,7 @@
#include "base/base_export.h"
#include "base/basictypes.h"
+#include "base/callback.h"
#include "base/synchronization/lock.h"
namespace base {
@@ -39,9 +40,12 @@
~AtExitManager();
// Registers the specified function to be called at exit. The prototype of
- // the callback function is void func().
+ // the callback function is void func(void*).
static void RegisterCallback(AtExitCallbackType func, void* param);
+ // Registers the specified task to be called at exit.
+ static void RegisterTask(base::Closure task);
+
// Calls the functions registered with RegisterCallback in LIFO order. It
// is possible to register new callbacks after calling this function.
static void ProcessCallbacksNow();
@@ -54,15 +58,8 @@
explicit AtExitManager(bool shadow);
private:
- struct CallbackAndParam {
- CallbackAndParam(AtExitCallbackType func, void* param)
- : func_(func), param_(param) { }
- AtExitCallbackType func_;
- void* param_;
- };
-
base::Lock lock_;
- std::stack<CallbackAndParam> stack_;
+ std::stack<base::Closure> stack_;
AtExitManager* next_manager_; // Stack of managers to allow shadowing.
DISALLOW_COPY_AND_ASSIGN(AtExitManager);
« no previous file with comments | « no previous file | base/at_exit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698