OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_TASK_H__ | 5 #ifndef BASE_TASK_H__ |
6 #define BASE_TASK_H__ | 6 #define BASE_TASK_H__ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 const C& c, const D& d, const E& e, | 380 const C& c, const D& d, const E& e, |
381 const F& f) { | 381 const F& f) { |
382 return new RunnableMethod<T, | 382 return new RunnableMethod<T, |
383 Method, | 383 Method, |
384 Tuple6<A, B, C, D, E, F> >(object, | 384 Tuple6<A, B, C, D, E, F> >(object, |
385 method, | 385 method, |
386 MakeTuple(a, b, c, d, e, | 386 MakeTuple(a, b, c, d, e, |
387 f)); | 387 f)); |
388 } | 388 } |
389 | 389 |
| 390 template <class T, class Method, class A, class B, class C, class D, class E, |
| 391 class F, class G> |
| 392 inline CancelableTask* NewRunnableMethod(T* object, Method method, |
| 393 const A& a, const B& b, |
| 394 const C& c, const D& d, const E& e, |
| 395 const F& f, const G& g) { |
| 396 return new RunnableMethod<T, |
| 397 Method, |
| 398 Tuple7<A, B, C, D, E, F, G> >(object, |
| 399 method, |
| 400 MakeTuple(a, b, c, d, |
| 401 e, f, g)); |
| 402 } |
| 403 |
390 // RunnableFunction and NewRunnableFunction implementation --------------------- | 404 // RunnableFunction and NewRunnableFunction implementation --------------------- |
391 | 405 |
392 template <class Function, class Params> | 406 template <class Function, class Params> |
393 class RunnableFunction : public CancelableTask { | 407 class RunnableFunction : public CancelableTask { |
394 public: | 408 public: |
395 RunnableFunction(Function function, const Params& params) | 409 RunnableFunction(Function function, const Params& params) |
396 : function_(function), params_(params) { | 410 : function_(function), params_(params) { |
397 } | 411 } |
398 | 412 |
399 ~RunnableFunction() { | 413 ~RunnableFunction() { |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 void Run(T* obj) const { | 662 void Run(T* obj) const { |
649 DispatchToMethod(obj, m_, p_); | 663 DispatchToMethod(obj, m_, p_); |
650 } | 664 } |
651 private: | 665 private: |
652 Method m_; | 666 Method m_; |
653 Params p_; | 667 Params p_; |
654 }; | 668 }; |
655 | 669 |
656 #endif // BASE_TASK_H__ | 670 #endif // BASE_TASK_H__ |
657 | 671 |
OLD | NEW |