OLD | NEW |
---|---|
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 Loading... | |
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 // Takes ownership of the task. | |
awong
2011/10/04 00:22:42
Comment is stale.
Sergey Ulanov
2011/10/04 00:25:10
Done.
| |
573 explicit ScopedClosureRunner(const Closure& closure); | |
574 ~ScopedClosureRunner(); | |
575 | |
576 Closure Release(); | |
577 | |
578 private: | |
579 Closure closure_; | |
580 | |
581 DISALLOW_IMPLICIT_CONSTRUCTORS(ScopedClosureRunner); | |
582 }; | |
583 | |
569 namespace subtle { | 584 namespace subtle { |
570 | 585 |
571 // This class is meant for use in the implementation of MessageLoop classes | 586 // This class is meant for use in the implementation of MessageLoop classes |
572 // such as MessageLoop, MessageLoopProxy, BrowserThread, and WorkerPool to | 587 // such as MessageLoop, MessageLoopProxy, BrowserThread, and WorkerPool to |
573 // implement the compatibility APIs while we are transitioning from Task to | 588 // implement the compatibility APIs while we are transitioning from Task to |
574 // Callback. | 589 // Callback. |
575 // | 590 // |
576 // It should NOT be used anywhere else! | 591 // It should NOT be used anywhere else! |
577 // | 592 // |
578 // In particular, notice that this is RefCounted instead of | 593 // In particular, notice that this is RefCounted instead of |
(...skipping 21 matching lines...) Expand all Loading... | |
600 Task* task_; | 615 Task* task_; |
601 bool* should_leak_task_; | 616 bool* should_leak_task_; |
602 static bool kTaskLeakingDefault; | 617 static bool kTaskLeakingDefault; |
603 }; | 618 }; |
604 | 619 |
605 } // namespace subtle | 620 } // namespace subtle |
606 | 621 |
607 } // namespace base | 622 } // namespace base |
608 | 623 |
609 #endif // BASE_TASK_H_ | 624 #endif // BASE_TASK_H_ |
OLD | NEW |