Chromium Code Reviews| Index: base/task.h |
| diff --git a/base/task.h b/base/task.h |
| index b698576ef899e3d4c0faad1c8845f13b22bbe4e1..3ab7bc93c7a7693e6d3b215142e24862f54db449 100644 |
| --- a/base/task.h |
| +++ b/base/task.h |
| @@ -546,4 +546,24 @@ inline Task* NewRunnableFunction(Function function, const A& a, const B& b, |
| function, MakeTuple(a, b, c, d, e, f, g, h)); |
| } |
| +namespace base { |
| + |
| +// ScopedTaskRunner is akin to scoped_ptr for Tasks. It ensures that the Task |
| +// is executed and deleted no matter how the current scope exits. |
| +class ScopedTaskRunner { |
| + public: |
| + // Takes ownership of the task. |
| + explicit ScopedTaskRunner(Task* task); |
| + ~ScopedTaskRunner(); |
| + |
| + Task* Release(); |
| + |
| + private: |
| + Task* task_; |
| + |
| + DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedTaskRunner); |
| +}; |
| + |
| +} // namespace base |
|
brettw
2011/05/26 20:59:05
Two spaces before end-of-line comments.
|
| + |
| #endif // BASE_TASK_H_ |