OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CancellableTaskFactory_h | 5 #ifndef CancellableTaskFactory_h |
6 #define CancellableTaskFactory_h | 6 #define CancellableTaskFactory_h |
7 | 7 |
8 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 #include "public/platform/WebTaskRunner.h" | 10 #include "public/platform/WebTaskRunner.h" |
11 #include "wtf/Allocator.h" | 11 #include "wtf/Allocator.h" |
12 #include "wtf/Functional.h" | 12 #include "wtf/Functional.h" |
13 #include "wtf/Noncopyable.h" | 13 #include "wtf/Noncopyable.h" |
14 #include "wtf/PtrUtil.h" | 14 #include "wtf/PtrUtil.h" |
15 #include "wtf/WeakPtr.h" | 15 #include "wtf/WeakPtr.h" |
16 #include <memory> | 16 #include <memory> |
17 #include <type_traits> | 17 #include <type_traits> |
18 | 18 |
19 namespace blink { | 19 namespace blink { |
20 | 20 |
21 class TraceLocation; | 21 class TraceLocation; |
22 | 22 |
| 23 // TODO(alexclarke): Consider removing all uses of this in favor of |
| 24 // WebTaskRunner::postCancellableDelayedTask instead. |
23 class PLATFORM_EXPORT CancellableTaskFactory { | 25 class PLATFORM_EXPORT CancellableTaskFactory { |
24 WTF_MAKE_NONCOPYABLE(CancellableTaskFactory); | 26 WTF_MAKE_NONCOPYABLE(CancellableTaskFactory); |
25 USING_FAST_MALLOC(CancellableTaskFactory); | 27 USING_FAST_MALLOC(CancellableTaskFactory); |
26 public: | 28 public: |
27 // A pair of mutually exclusive factory methods are provided for constructin
g | 29 // A pair of mutually exclusive factory methods are provided for constructin
g |
28 // a CancellableTaskFactory, one for when a Oilpan heap object owns a | 30 // a CancellableTaskFactory, one for when a Oilpan heap object owns a |
29 // CancellableTaskFactory, and one when that owning object isn't controlled | 31 // CancellableTaskFactory, and one when that owning object isn't controlled |
30 // by Oilpan. | 32 // by Oilpan. |
31 // | 33 // |
32 // In the Oilpan case, as WTF::Closure objects are off-heap, we have to cons
truct the | 34 // In the Oilpan case, as WTF::Closure objects are off-heap, we have to cons
truct the |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 WeakPtr<CancellableTaskFactory> m_weakPtr; | 87 WeakPtr<CancellableTaskFactory> m_weakPtr; |
86 }; | 88 }; |
87 | 89 |
88 std::unique_ptr<WTF::Closure> m_closure; | 90 std::unique_ptr<WTF::Closure> m_closure; |
89 WeakPtrFactory<CancellableTaskFactory> m_weakPtrFactory; | 91 WeakPtrFactory<CancellableTaskFactory> m_weakPtrFactory; |
90 }; | 92 }; |
91 | 93 |
92 } // namespace blink | 94 } // namespace blink |
93 | 95 |
94 #endif // CancellableTaskFactory_h | 96 #endif // CancellableTaskFactory_h |
OLD | NEW |