diff options
author | Andras Becsi <andras.becsi@digia.com> | 2013-12-11 21:33:03 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@digia.com> | 2013-12-13 12:34:07 +0100 |
commit | f2a33ff9cbc6d19943f1c7fbddd1f23d23975577 (patch) | |
tree | 0586a32aa390ade8557dfd6b4897f43a07449578 /chromium/base/callback_helpers.h | |
parent | 5362912cdb5eea702b68ebe23702468d17c3017a (diff) | |
download | qtwebengine-chromium-f2a33ff9cbc6d19943f1c7fbddd1f23d23975577.tar.gz |
Update Chromium to branch 1650 (31.0.1650.63)
Change-Id: I57d8c832eaec1eb2364e0a8e7352a6dd354db99f
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'chromium/base/callback_helpers.h')
-rw-r--r-- | chromium/base/callback_helpers.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chromium/base/callback_helpers.h b/chromium/base/callback_helpers.h index 52cb71bbf26..8481e3e71c0 100644 --- a/chromium/base/callback_helpers.h +++ b/chromium/base/callback_helpers.h @@ -14,7 +14,9 @@ #ifndef BASE_CALLBACK_HELPERS_H_ #define BASE_CALLBACK_HELPERS_H_ +#include "base/basictypes.h" #include "base/callback.h" +#include "base/compiler_specific.h" namespace base { @@ -25,6 +27,24 @@ base::Callback<Sig> ResetAndReturn(base::Callback<Sig>* cb) { return ret; } +// ScopedClosureRunner is akin to scoped_ptr for Closures. It ensures that the +// Closure is executed and deleted no matter how the current scope exits. +class BASE_EXPORT ScopedClosureRunner { + public: + ScopedClosureRunner(); + explicit ScopedClosureRunner(const Closure& closure); + ~ScopedClosureRunner(); + + void Reset(); + void Reset(const Closure& closure); + Closure Release() WARN_UNUSED_RESULT; + + private: + Closure closure_; + + DISALLOW_COPY_AND_ASSIGN(ScopedClosureRunner); +}; + } // namespace base #endif // BASE_CALLBACK_HELPERS_H_ |