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

Side by Side Diff: base/task.h

Issue 8120015: Add ScopedClosureRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: unittests Created 9 years, 2 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 | base/task.cc » ('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) 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_export.h" 9 #include "base/base_export.h"
10 #include "base/callback.h"
10 #include "base/debug/alias.h" 11 #include "base/debug/alias.h"
11 #include "base/memory/raw_scoped_refptr_mismatch_checker.h" 12 #include "base/memory/raw_scoped_refptr_mismatch_checker.h"
12 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
13 #include "base/tuple.h" 14 #include "base/tuple.h"
14 15
15 namespace base { 16 namespace base {
16 const size_t kDeadTask = 0xDEAD7A53; 17 const size_t kDeadTask = 0xDEAD7A53;
17 } 18 }
18 19
19 // Task ------------------------------------------------------------------------ 20 // Task ------------------------------------------------------------------------
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 ~ScopedTaskRunner(); 560 ~ScopedTaskRunner();
560 561
561 Task* Release(); 562 Task* Release();
562 563
563 private: 564 private:
564 Task* task_; 565 Task* task_;
565 566
566 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedTaskRunner); 567 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedTaskRunner);
567 }; 568 };
568 569
570 class BASE_EXPORT ScopedClosureRunner {
571 public:
572 explicit ScopedClosureRunner(const Closure& closure);
573 ~ScopedClosureRunner();
574
575 Closure Release();
576
577 private:
578 Closure closure_;
579
580 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedClosureRunner);
581 };
582
569 namespace subtle { 583 namespace subtle {
570 584
571 // This class is meant for use in the implementation of MessageLoop classes 585 // This class is meant for use in the implementation of MessageLoop classes
572 // such as MessageLoop, MessageLoopProxy, BrowserThread, and WorkerPool to 586 // such as MessageLoop, MessageLoopProxy, BrowserThread, and WorkerPool to
573 // implement the compatibility APIs while we are transitioning from Task to 587 // implement the compatibility APIs while we are transitioning from Task to
574 // Callback. 588 // Callback.
575 // 589 //
576 // It should NOT be used anywhere else! 590 // It should NOT be used anywhere else!
577 // 591 //
578 // In particular, notice that this is RefCounted instead of 592 // In particular, notice that this is RefCounted instead of
(...skipping 21 matching lines...) Expand all
600 Task* task_; 614 Task* task_;
601 bool* should_leak_task_; 615 bool* should_leak_task_;
602 static bool kTaskLeakingDefault; 616 static bool kTaskLeakingDefault;
603 }; 617 };
604 618
605 } // namespace subtle 619 } // namespace subtle
606 620
607 } // namespace base 621 } // namespace base
608 622
609 #endif // BASE_TASK_H_ 623 #endif // BASE_TASK_H_
OLDNEW
« no previous file with comments | « no previous file | base/task.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698