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

Side by Side Diff: base/task.h

Issue 7013014: Added release build assert on attempt to create a RunnableFunction for a function pointer with ad... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/base_api.h" 9 #include "base/base_api.h"
10 #include "base/memory/raw_scoped_refptr_mismatch_checker.h" 10 #include "base/memory/raw_scoped_refptr_mismatch_checker.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 // RunnableFunction and NewRunnableFunction implementation --------------------- 442 // RunnableFunction and NewRunnableFunction implementation ---------------------
443 443
444 template <class Function, class Params> 444 template <class Function, class Params>
445 class RunnableFunction : public Task { 445 class RunnableFunction : public Task {
446 public: 446 public:
447 RunnableFunction(Function function, const Params& params) 447 RunnableFunction(Function function, const Params& params)
448 : function_(function), params_(params) { 448 : function_(function), params_(params) {
449 COMPILE_ASSERT( 449 COMPILE_ASSERT(
450 (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value), 450 (base::internal::ParamsUseScopedRefptrCorrectly<Params>::value),
451 badrunnablefunctionparams); 451 badrunnablefunctionparams);
452 #if defined(OS_WIN)
453 // TODO(apatrick): Remove this ASAP. I think somewhere in the code we're
454 // posting a task to call a function pointer with this value. Step 1 is
455 // to find the site it is posted from. http://crbug.com/81449.
456 CHECK(reinterpret_cast<int>(function) != 0x00000001);
457 #endif
452 } 458 }
453 459
454 ~RunnableFunction() { 460 ~RunnableFunction() {
455 } 461 }
456 462
457 virtual void Run() { 463 virtual void Run() {
458 if (function_) 464 if (function_)
459 DispatchToFunction(function_, params_); 465 DispatchToFunction(function_, params_);
460 } 466 }
461 467
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 template <class Function, class A, class B, class C, class D, class E, 531 template <class Function, class A, class B, class C, class D, class E,
526 class F, class G, class H> 532 class F, class G, class H>
527 inline Task* NewRunnableFunction(Function function, const A& a, const B& b, 533 inline Task* NewRunnableFunction(Function function, const A& a, const B& b,
528 const C& c, const D& d, const E& e, const F& f, 534 const C& c, const D& d, const E& e, const F& f,
529 const G& g, const H& h) { 535 const G& g, const H& h) {
530 return new RunnableFunction<Function, Tuple8<A, B, C, D, E, F, G, H> >( 536 return new RunnableFunction<Function, Tuple8<A, B, C, D, E, F, G, H> >(
531 function, MakeTuple(a, b, c, d, e, f, g, h)); 537 function, MakeTuple(a, b, c, d, e, f, g, h));
532 } 538 }
533 539
534 #endif // BASE_TASK_H_ 540 #endif // BASE_TASK_H_
OLDNEW
« 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