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

Unified Diff: base/task.h

Issue 802004: Change the ScopedRunnableMethodFactory to use CancelableTasks so that... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task.h
===================================================================
--- base/task.h (revision 40643)
+++ base/task.h (working copy)
@@ -83,25 +83,26 @@
}
template <class Method>
- inline Task* NewRunnableMethod(Method method) {
+ inline CancelableTask* NewRunnableMethod(Method method) {
return new RunnableMethod<Method, Tuple0>(
weak_factory_.GetWeakPtr(), method, MakeTuple());
}
template <class Method, class A>
- inline Task* NewRunnableMethod(Method method, const A& a) {
+ inline CancelableTask* NewRunnableMethod(Method method, const A& a) {
return new RunnableMethod<Method, Tuple1<A> >(
weak_factory_.GetWeakPtr(), method, MakeTuple(a));
}
template <class Method, class A, class B>
- inline Task* NewRunnableMethod(Method method, const A& a, const B& b) {
+ inline CancelableTask* NewRunnableMethod(Method method, const A& a,
+ const B& b) {
return new RunnableMethod<Method, Tuple2<A, B> >(
weak_factory_.GetWeakPtr(), method, MakeTuple(a, b));
}
template <class Method, class A, class B, class C>
- inline Task* NewRunnableMethod(Method method,
+ inline CancelableTask* NewRunnableMethod(Method method,
const A& a,
const B& b,
const C& c) {
@@ -110,7 +111,7 @@
}
template <class Method, class A, class B, class C, class D>
- inline Task* NewRunnableMethod(Method method,
+ inline CancelableTask* NewRunnableMethod(Method method,
const A& a,
const B& b,
const C& c,
@@ -120,7 +121,7 @@
}
template <class Method, class A, class B, class C, class D, class E>
- inline Task* NewRunnableMethod(Method method,
+ inline CancelableTask* NewRunnableMethod(Method method,
const A& a,
const B& b,
const C& c,
@@ -136,9 +137,10 @@
protected:
template <class Method, class Params>
- class RunnableMethod : public Task {
+ class RunnableMethod : public CancelableTask {
public:
- RunnableMethod(const base::WeakPtr<T>& obj, Method meth, const Params& params)
+ RunnableMethod(const base::WeakPtr<T>& obj, Method meth,
+ const Params& params)
: obj_(obj),
meth_(meth),
params_(params) {
@@ -151,6 +153,10 @@
DispatchToMethod(obj_.get(), meth_, params_);
}
+ virtual void Cancel() {
+ obj_.reset();
+ }
+
private:
base::WeakPtr<T> obj_;
Method meth_;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698