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

Unified Diff: base/task.h

Issue 8960011: base::Bind: Remove NewRunnableFunction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win build fix. Created 9 years 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: base/task.h
diff --git a/base/task.h b/base/task.h
index 7e87ff72abc4067e94190f2c459b0363707c83a2..4f79c6ad44e9d961b12aabb8f589a1498e4103cf 100644
--- a/base/task.h
+++ b/base/task.h
@@ -327,12 +327,12 @@ struct RunnableMethodTraits {
void ReleaseCallee(TypeName* manager) {} \
}
-// RunnableMethod and RunnableFunction -----------------------------------------
+// RunnableMethod --------------------------------------------------------------
//
// Runnable methods are a type of task that call a function on an object when
-// they are run. We implement both an object and a set of NewRunnableMethod and
-// NewRunnableFunction functions for convenience. These functions are
-// overloaded and will infer the template types, simplifying calling code.
+// they are run. We implement both an object and a set of NewRunnableMethod
+// functions for convenience. These functions are overloaded and will infer the
+// template types, simplifying calling code.
//
// The template definitions all use the following names:
// T - the class type of the object you're supplying
@@ -349,7 +349,6 @@ struct RunnableMethodTraits {
//
// Usage:
// PostTask(FROM_HERE, NewRunnableMethod(object, &Object::method[, a[, b]])
-// PostTask(FROM_HERE, NewRunnableFunction(&function[, a[, b]])
// RunnableMethod and NewRunnableMethod implementation -------------------------
@@ -481,99 +480,6 @@ inline CancelableTask* NewRunnableMethod(T* object, Method method,
g, h));
}
-// RunnableFunction and NewRunnableFunction implementation ---------------------
-
-template <class Function, class Params>
-class RunnableFunction : public Task {
- public:
- RunnableFunction(Function function, const Params& params)
- : function_(function), params_(params) {
- COMPILE_ASSERT(
- (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value),
- badrunnablefunctionparams);
- }
-
- ~RunnableFunction() {
- function_ = reinterpret_cast<Function>(base::kDeadTask);
- }
-
- virtual void Run() {
- if (function_)
- DispatchToFunction(function_, params_);
- }
-
- private:
- Function function_;
- Params params_;
-};
-
-template <class Function>
-inline Task* NewRunnableFunction(Function function) {
- return new RunnableFunction<Function, Tuple0>(function, MakeTuple());
-}
-
-template <class Function, class A>
-inline Task* NewRunnableFunction(Function function, const A& a) {
- return new RunnableFunction<Function, Tuple1<A> >(function, MakeTuple(a));
-}
-
-template <class Function, class A, class B>
-inline Task* NewRunnableFunction(Function function, const A& a, const B& b) {
- return new RunnableFunction<Function, Tuple2<A, B> >(function,
- MakeTuple(a, b));
-}
-
-template <class Function, class A, class B, class C>
-inline Task* NewRunnableFunction(Function function, const A& a, const B& b,
- const C& c) {
- return new RunnableFunction<Function, Tuple3<A, B, C> >(function,
- MakeTuple(a, b, c));
-}
-
-template <class Function, class A, class B, class C, class D>
-inline Task* NewRunnableFunction(Function function, const A& a, const B& b,
- const C& c, const D& d) {
- return new RunnableFunction<Function, Tuple4<A, B, C, D> >(function,
- MakeTuple(a, b,
- c, d));
-}
-
-template <class Function, class A, class B, class C, class D, class E>
-inline Task* NewRunnableFunction(Function function, const A& a, const B& b,
- const C& c, const D& d, const E& e) {
- return new RunnableFunction<Function, Tuple5<A, B, C, D, E> >(function,
- MakeTuple(a, b,
- c, d,
- e));
-}
-
-template <class Function, class A, class B, class C, class D, class E,
- class F>
-inline Task* NewRunnableFunction(Function function, const A& a, const B& b,
- const C& c, const D& d, const E& e,
- const F& f) {
- return new RunnableFunction<Function, Tuple6<A, B, C, D, E, F> >(function,
- MakeTuple(a, b, c, d, e, f));
-}
-
-template <class Function, class A, class B, class C, class D, class E,
- class F, class G>
-inline Task* NewRunnableFunction(Function function, const A& a, const B& b,
- const C& c, const D& d, const E& e, const F& f,
- const G& g) {
- return new RunnableFunction<Function, Tuple7<A, B, C, D, E, F, G> >(function,
- MakeTuple(a, b, c, d, e, f, g));
-}
-
-template <class Function, class A, class B, class C, class D, class E,
- class F, class G, class H>
-inline Task* NewRunnableFunction(Function function, const A& a, const B& b,
- const C& c, const D& d, const E& e, const F& f,
- const G& g, const H& h) {
- return new RunnableFunction<Function, Tuple8<A, B, C, D, E, F, G, H> >(
- 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

Powered by Google App Engine
This is Rietveld 408576698