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

Side by Side Diff: base/task.h

Issue 5885001: Revert 69237 - Fix raw_scoped_refptr_mismatch_checker.h.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/raw_scoped_refptr_mismatch_checker.h ('k') | base/template_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #pragma once 7 #pragma once
8 8
9 #include "base/non_thread_safe.h" 9 #include "base/non_thread_safe.h"
10 #include "base/raw_scoped_refptr_mismatch_checker.h" 10 #include "base/raw_scoped_refptr_mismatch_checker.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 protected: 142 protected:
143 template <class Method, class Params> 143 template <class Method, class Params>
144 class RunnableMethod : public CancelableTask { 144 class RunnableMethod : public CancelableTask {
145 public: 145 public:
146 RunnableMethod(const base::WeakPtr<T>& obj, 146 RunnableMethod(const base::WeakPtr<T>& obj,
147 Method meth, 147 Method meth,
148 const Params& params) 148 const Params& params)
149 : obj_(obj), 149 : obj_(obj),
150 meth_(meth), 150 meth_(meth),
151 params_(params) { 151 params_(params) {
152 COMPILE_ASSERT( 152 COMPILE_ASSERT((MethodUsesScopedRefptrCorrectly<Method, Params>::value),
153 (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value), 153 badscopedrunnablemethodparams);
154 badscopedrunnablemethodparams);
155 } 154 }
156 155
157 virtual void Run() { 156 virtual void Run() {
158 if (obj_) 157 if (obj_)
159 DispatchToMethod(obj_.get(), meth_, params_); 158 DispatchToMethod(obj_.get(), meth_, params_);
160 } 159 }
161 160
162 virtual void Cancel() { 161 virtual void Cancel() {
163 obj_.reset(); 162 obj_.reset();
164 } 163 }
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 // PostTask(FROM_HERE, NewRunnableFunction(&function[, a[, b]]) 310 // PostTask(FROM_HERE, NewRunnableFunction(&function[, a[, b]])
312 311
313 // RunnableMethod and NewRunnableMethod implementation ------------------------- 312 // RunnableMethod and NewRunnableMethod implementation -------------------------
314 313
315 template <class T, class Method, class Params> 314 template <class T, class Method, class Params>
316 class RunnableMethod : public CancelableTask { 315 class RunnableMethod : public CancelableTask {
317 public: 316 public:
318 RunnableMethod(T* obj, Method meth, const Params& params) 317 RunnableMethod(T* obj, Method meth, const Params& params)
319 : obj_(obj), meth_(meth), params_(params) { 318 : obj_(obj), meth_(meth), params_(params) {
320 traits_.RetainCallee(obj_); 319 traits_.RetainCallee(obj_);
321 COMPILE_ASSERT( 320 COMPILE_ASSERT((MethodUsesScopedRefptrCorrectly<Method, Params>::value),
322 (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value), 321 badrunnablemethodparams);
323 badrunnablemethodparams);
324 } 322 }
325 323
326 ~RunnableMethod() { 324 ~RunnableMethod() {
327 ReleaseCallee(); 325 ReleaseCallee();
328 } 326 }
329 327
330 virtual void Run() { 328 virtual void Run() {
331 if (obj_) 329 if (obj_)
332 DispatchToMethod(obj_, meth_, params_); 330 DispatchToMethod(obj_, meth_, params_);
333 } 331 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 e, f, g)); 422 e, f, g));
425 } 423 }
426 424
427 // RunnableFunction and NewRunnableFunction implementation --------------------- 425 // RunnableFunction and NewRunnableFunction implementation ---------------------
428 426
429 template <class Function, class Params> 427 template <class Function, class Params>
430 class RunnableFunction : public CancelableTask { 428 class RunnableFunction : public CancelableTask {
431 public: 429 public:
432 RunnableFunction(Function function, const Params& params) 430 RunnableFunction(Function function, const Params& params)
433 : function_(function), params_(params) { 431 : function_(function), params_(params) {
434 COMPILE_ASSERT( 432 COMPILE_ASSERT((FunctionUsesScopedRefptrCorrectly<Function, Params>::value),
435 (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value), 433 badrunnablefunctionparams);
436 badrunnablefunctionparams);
437 } 434 }
438 435
439 ~RunnableFunction() { 436 ~RunnableFunction() {
440 } 437 }
441 438
442 virtual void Run() { 439 virtual void Run() {
443 if (function_) 440 if (function_)
444 DispatchToFunction(function_, params_); 441 DispatchToFunction(function_, params_);
445 } 442 }
446 443
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 inline CancelableTask* NewRunnableFunction(Function function, 520 inline CancelableTask* NewRunnableFunction(Function function,
524 const A& a, const B& b, 521 const A& a, const B& b,
525 const C& c, const D& d, 522 const C& c, const D& d,
526 const E& e, const F& f, 523 const E& e, const F& f,
527 const G& g, const H& h) { 524 const G& g, const H& h) {
528 return new RunnableFunction<Function, Tuple8<A, B, C, D, E, F, G, H> >( 525 return new RunnableFunction<Function, Tuple8<A, B, C, D, E, F, G, H> >(
529 function, MakeTuple(a, b, c, d, e, f, g, h)); 526 function, MakeTuple(a, b, c, d, e, f, g, h));
530 } 527 }
531 528
532 #endif // BASE_TASK_H_ 529 #endif // BASE_TASK_H_
OLDNEW
« no previous file with comments | « base/raw_scoped_refptr_mismatch_checker.h ('k') | base/template_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698