summaryrefslogtreecommitdiffstats
path: root/media/base
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-27 04:17:22 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-27 04:17:22 +0000
commitc9c0d079c24a02f8f9b667f3cbf06d234a586625 (patch)
tree3190175cc6bd419a1f36d3a9265c1c61e1ba9884 /media/base
parent0c12ed8f62b3691f1fee9e5abd6b6bc2fa5af14a (diff)
downloadchromium_src-c9c0d079c24a02f8f9b667f3cbf06d234a586625.zip
chromium_src-c9c0d079c24a02f8f9b667f3cbf06d234a586625.tar.gz
chromium_src-c9c0d079c24a02f8f9b667f3cbf06d234a586625.tar.bz2
Move media library AutoTaskRunner to base and rename ScopedTaskRunner.
This is needed to avoid faux dependencies on media/ creeping in to remoting/ code, and creating linker issues. BUG= TEST=Everything works as before. Review URL: http://codereview.chromium.org/7062013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86971 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base')
-rw-r--r--media/base/callback.cc8
-rw-r--r--media/base/callback.h55
2 files changed, 4 insertions, 59 deletions
diff --git a/media/base/callback.cc b/media/base/callback.cc
index 484c744..3daac8e 100644
--- a/media/base/callback.cc
+++ b/media/base/callback.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,12 +6,6 @@
namespace media {
-AutoTaskRunner::~AutoTaskRunner() {
- if (task_.get()) {
- task_->Run();
- }
-}
-
AutoCallbackRunner::~AutoCallbackRunner() {
if (callback_.get()) {
callback_->Run();
diff --git a/media/base/callback.h b/media/base/callback.h
index 460af24..4948829 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_