| Index: base/task.h
|
| ===================================================================
|
| --- base/task.h (revision 27386)
|
| +++ base/task.h (working copy)
|
| @@ -205,33 +205,12 @@
|
|
|
| template <class T>
|
| struct RunnableMethodTraits {
|
| - RunnableMethodTraits() {
|
| -#ifndef NDEBUG
|
| - origin_thread_id_ = PlatformThread::CurrentId();
|
| -#endif
|
| - }
|
| -
|
| - ~RunnableMethodTraits() {
|
| -#ifndef NDEBUG
|
| - // If destroyed on a separate thread, then we had better have been using
|
| - // thread-safe reference counting!
|
| - if (origin_thread_id_ != PlatformThread::CurrentId())
|
| - DCHECK(T::ImplementsThreadSafeReferenceCounting());
|
| -#endif
|
| - }
|
| -
|
| - void RetainCallee(T* obj) {
|
| + static void RetainCallee(T* obj) {
|
| obj->AddRef();
|
| }
|
| -
|
| - void ReleaseCallee(T* obj) {
|
| + static void ReleaseCallee(T* obj) {
|
| obj->Release();
|
| }
|
| -
|
| - private:
|
| -#ifndef NDEBUG
|
| - PlatformThreadId origin_thread_id_;
|
| -#endif
|
| };
|
|
|
| // RunnableMethod and RunnableFunction -----------------------------------------
|
| @@ -261,13 +240,13 @@
|
| // RunnableMethod and NewRunnableMethod implementation -------------------------
|
|
|
| template <class T, class Method, class Params>
|
| -class RunnableMethod : public CancelableTask {
|
| +class RunnableMethod : public CancelableTask,
|
| + public RunnableMethodTraits<T> {
|
| public:
|
| RunnableMethod(T* obj, Method meth, const Params& params)
|
| : obj_(obj), meth_(meth), params_(params) {
|
| - traits_.RetainCallee(obj_);
|
| + RetainCallee(obj_);
|
| }
|
| -
|
| ~RunnableMethod() {
|
| ReleaseCallee();
|
| }
|
| @@ -284,7 +263,7 @@
|
| private:
|
| void ReleaseCallee() {
|
| if (obj_) {
|
| - traits_.ReleaseCallee(obj_);
|
| + RunnableMethodTraits<T>::ReleaseCallee(obj_);
|
| obj_ = NULL;
|
| }
|
| }
|
| @@ -292,7 +271,6 @@
|
| T* obj_;
|
| Method meth_;
|
| Params params_;
|
| - RunnableMethodTraits<T> traits_;
|
| };
|
|
|
| template <class T, class Method>
|
|
|