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

Unified Diff: media/base/callback.h

Issue 7062013: Move media library AutoTaskRunner to base and rename ScopedTaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add innocuous but critical BASE_API modifier to ScopedTaskRunner declaration. Created 9 years, 7 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 | « content/renderer/media/video_capture_impl.cc ('k') | media/base/callback.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/callback.h
diff --git a/media/base/callback.h b/media/base/callback.h
index 460af244b0061d087acd2fc31b77dc11fd7af8da..49488296f2a01b27c6d76be422332b2cdcab1ef6 100644
--- a/media/base/callback.h
+++ b/media/base/callback.h
@@ -4,9 +4,9 @@
// Some basic utilities for aiding in the management of Tasks and Callbacks.
//
-// AutoTaskRunner, and its brother AutoCallbackRunner are the scoped_ptr
-// equivalents for callbacks. They are useful for ensuring a callback is
-// executed and delete in the face of multiple return points in a function.
+// AutoCallbackRunner is akin to scoped_ptr for callbacks. It is useful for
+// ensuring a callback is executed and delete in the face of multiple return
+// points in a function.
//
// TaskToCallbackAdapter converts a Task to a Callback0::Type since the two type
// hierarchies are strangely separate.
@@ -27,23 +27,6 @@
namespace media {
-class AutoTaskRunner {
- public:
- // Takes ownership of the task.
- explicit AutoTaskRunner(Task* task)
- : task_(task) {
- }
-
- ~AutoTaskRunner();
-
- Task* release() { return task_.release(); }
-
- private:
- scoped_ptr<Task> task_;
-
- DISALLOW_COPY_AND_ASSIGN(AutoTaskRunner);
-};
-
class AutoCallbackRunner {
public:
// Takes ownership of the callback.
@@ -77,38 +60,6 @@ class TaskToCallbackAdapter : public Callback0::Type {
DISALLOW_COPY_AND_ASSIGN(TaskToCallbackAdapter);
};
-template <typename CallbackType>
-class CleanupCallback : public CallbackType {
- public:
- explicit CleanupCallback(CallbackType* callback) : callback_(callback) {}
-
- virtual ~CleanupCallback() {
- for (size_t i = 0; i < run_when_done_.size(); i++) {
- run_when_done_[i]->Run();
- delete run_when_done_[i];
- }
- }
-
- virtual void RunWithParams(const typename CallbackType::TupleType& params) {
- callback_->RunWithParams(params);
- }
-
- template <typename T>
- void DeleteWhenDone(T* ptr) {
- RunWhenDone(new DeleteTask<T>(ptr));
- }
-
- void RunWhenDone(Task* ptr) {
- run_when_done_.push_back(ptr);
- }
-
- private:
- scoped_ptr<CallbackType> callback_;
- std::vector<Task*> run_when_done_;
-
- DISALLOW_COPY_AND_ASSIGN(CleanupCallback);
-};
-
} // namespace media
#endif // MEDIA_BASE_CALLBACK_
« no previous file with comments | « content/renderer/media/video_capture_impl.cc ('k') | media/base/callback.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698