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/debug/alias.h" | 10 #include "base/debug/alias.h" |
11 #include "base/memory/raw_scoped_refptr_mismatch_checker.h" | 11 #include "base/memory/raw_scoped_refptr_mismatch_checker.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/tracked.h" | |
14 #include "base/tuple.h" | 13 #include "base/tuple.h" |
15 | 14 |
16 namespace base { | 15 namespace base { |
17 const size_t kDeadTask = 0xDEAD7A53; | 16 const size_t kDeadTask = 0xDEAD7A53; |
18 } | 17 } |
19 | 18 |
20 // Task ------------------------------------------------------------------------ | 19 // Task ------------------------------------------------------------------------ |
21 // | 20 // |
22 // A task is a generic runnable thingy, usually used for running code on a | 21 // A task is a generic runnable thingy, usually used for running code on a |
23 // different thread or for scheduling future tasks off of the message loop. | 22 // different thread or for scheduling future tasks off of the message loop. |
24 | 23 |
25 class BASE_EXPORT Task : public tracked_objects::Tracked { | 24 class BASE_EXPORT Task { |
26 public: | 25 public: |
27 Task(); | 26 Task(); |
28 virtual ~Task(); | 27 virtual ~Task(); |
29 | 28 |
30 // Tasks are automatically deleted after Run is called. | 29 // Tasks are automatically deleted after Run is called. |
31 virtual void Run() = 0; | 30 virtual void Run() = 0; |
32 }; | 31 }; |
33 | 32 |
34 class BASE_EXPORT CancelableTask : public Task { | 33 class BASE_EXPORT CancelableTask : public Task { |
35 public: | 34 public: |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 Task* task_; | 600 Task* task_; |
602 bool* should_leak_task_; | 601 bool* should_leak_task_; |
603 static bool kTaskLeakingDefault; | 602 static bool kTaskLeakingDefault; |
604 }; | 603 }; |
605 | 604 |
606 } // namespace subtle | 605 } // namespace subtle |
607 | 606 |
608 } // namespace base | 607 } // namespace base |
609 | 608 |
610 #endif // BASE_TASK_H_ | 609 #endif // BASE_TASK_H_ |
OLD | NEW |