diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-01 02:14:47 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-01 02:14:47 +0000 |
commit | 8f5a7e49df055f720d398e659d8f0fd1bb532ad0 (patch) | |
tree | 0cf8bfd736484a794b2d9c4127f53784ee5cdeea /base/task.h | |
parent | f182444916248f4d0612fada91b49ee672573d85 (diff) | |
download | chromium_src-8f5a7e49df055f720d398e659d8f0fd1bb532ad0.zip chromium_src-8f5a7e49df055f720d398e659d8f0fd1bb532ad0.tar.gz chromium_src-8f5a7e49df055f720d398e659d8f0fd1bb532ad0.tar.bz2 |
base::Bind: Remove NewRunnableFunction.
BUG=none
TEST=none
R=groby,ajwong
Review URL: http://codereview.chromium.org/8960011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116072 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/task.h')
-rw-r--r-- | base/task.h | 102 |
1 files changed, 4 insertions, 98 deletions
diff --git a/base/task.h b/base/task.h index b546af5..84dab97 100644 --- a/base/task.h +++ b/base/task.h @@ -304,12 +304,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 @@ -326,7 +326,6 @@ struct RunnableMethodTraits { // // Usage: // PostTask(FROM_HERE, NewRunnableMethod(object, &Object::method[, a[, b]]) -// PostTask(FROM_HERE, NewRunnableFunction(&function[, a[, b]]) // RunnableMethod and NewRunnableMethod implementation ------------------------- @@ -458,99 +457,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 |