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

Unified Diff: media/base/bind_to_loop.h

Issue 66953005: Remove media::BindToLoop() in favour of media::BindToCurrentLoop(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nits Created 6 years, 11 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
Index: media/base/bind_to_loop.h
diff --git a/media/base/bind_to_loop.h b/media/base/bind_to_loop.h
index 734a529e9efa0ee87face869e4939856f14be49e..499a6d916d12543e49ca9c8a55a424f61daf3476 100644
--- a/media/base/bind_to_loop.h
+++ b/media/base/bind_to_loop.h
@@ -15,19 +15,18 @@
#include "base/message_loop/message_loop_proxy.h"
#include "base/single_thread_task_runner.h"
-// This is a helper utility for base::Bind()ing callbacks on to particular
-// MessageLoops. A typical use is when |a| (of class |A|) wants to hand a
+// This is a helper utility for base::Bind()ing callbacks to the current
+// MessageLoop. The typical use is when |a| (of class |A|) wants to hand a
// callback such as base::Bind(&A::AMethod, a) to |b|, but needs to ensure that
-// when |b| executes the callback, it does so on a particular MessageLoop.
+// when |b| executes the callback, it does so on |a|'s current MessageLoop.
//
// Typical usage: request to be called back on the current thread:
// other->StartAsyncProcessAndCallMeBack(
-// media::BindToLoop(MessageLoopProxy::current(),
-// base::Bind(&MyClass::MyMethod, this)));
+// media::BindToCurrentLoop(base::Bind(&MyClass::MyMethod, this)));
//
-// Note that like base::Bind(), BindToLoop() can't bind non-constant references,
-// and that *unlike* base::Bind(), BindToLoop() makes copies of its arguments,
-// and thus can't be used with arrays.
+// Note that like base::Bind(), BindToCurrentLoop() can't bind non-constant
+// references, and that *unlike* base::Bind(), BindToCurrentLoop() makes copies
+// of its arguments, and thus can't be used with arrays.
namespace media {
@@ -155,17 +154,13 @@ struct TrampolineHelper<void(A1, A2, A3, A4, A5, A6, A7)> {
} // namespace internal
-template<typename T>
-static base::Callback<T> BindToLoop(
- const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
- const base::Callback<T>& cb) {
- return base::Bind(&internal::TrampolineHelper<T>::Run, task_runner, cb);
-}
-
+// TODO(scherkus): Rename me to something that emphasizes the asynchrony
+// http://crbug.com/167240
template<typename T>
static base::Callback<T> BindToCurrentLoop(
const base::Callback<T>& cb) {
- return BindToLoop(base::MessageLoopProxy::current(), cb);
+ return base::Bind(&internal::TrampolineHelper<T>::Run,
+ base::MessageLoopProxy::current(), cb);
}
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698