| 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" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // WTF::bind(wrapPersistent(foo), &Foo::bar); | 32 // WTF::bind(wrapPersistent(foo), &Foo::bar); |
| 33 // RefPtr<TaskHandle> handle = | 33 // RefPtr<TaskHandle> handle = |
| 34 // task_runner->postCancellableTask(BLINK_FROM_HERE, std::move(task)); | 34 // task_runner->postCancellableTask(BLINK_FROM_HERE, std::move(task)); |
| 35 // handle->cancel(); | 35 // handle->cancel(); |
| 36 // | 36 // |
| 37 // Note that the task is not automatically cancelled on the scope out of | 37 // Note that the task is not automatically cancelled on the scope out of |
| 38 // RefPtr<TaskHandle>, since the wrapped task has a reference to the TaskHandle. | 38 // RefPtr<TaskHandle>, since the wrapped task has a reference to the TaskHandle. |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class TraceLocation; | |
| 43 | |
| 44 class PLATFORM_EXPORT CancellableTaskFactory { | 42 class PLATFORM_EXPORT CancellableTaskFactory { |
| 45 WTF_MAKE_NONCOPYABLE(CancellableTaskFactory); | 43 WTF_MAKE_NONCOPYABLE(CancellableTaskFactory); |
| 46 USING_FAST_MALLOC(CancellableTaskFactory); | 44 USING_FAST_MALLOC(CancellableTaskFactory); |
| 47 | 45 |
| 48 public: | 46 public: |
| 49 // A pair of mutually exclusive factory methods are provided for constructing | 47 // A pair of mutually exclusive factory methods are provided for constructing |
| 50 // a CancellableTaskFactory, one for when a Oilpan heap object owns a | 48 // a CancellableTaskFactory, one for when a Oilpan heap object owns a |
| 51 // CancellableTaskFactory, and one when that owning object isn't controlled | 49 // CancellableTaskFactory, and one when that owning object isn't controlled |
| 52 // by Oilpan. | 50 // by Oilpan. |
| 53 // | 51 // |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 WeakPtr<CancellableTaskFactory> m_weakPtr; | 108 WeakPtr<CancellableTaskFactory> m_weakPtr; |
| 111 }; | 109 }; |
| 112 | 110 |
| 113 std::unique_ptr<WTF::Closure> m_closure; | 111 std::unique_ptr<WTF::Closure> m_closure; |
| 114 WeakPtrFactory<CancellableTaskFactory> m_weakPtrFactory; | 112 WeakPtrFactory<CancellableTaskFactory> m_weakPtrFactory; |
| 115 }; | 113 }; |
| 116 | 114 |
| 117 } // namespace blink | 115 } // namespace blink |
| 118 | 116 |
| 119 #endif // CancellableTaskFactory_h | 117 #endif // CancellableTaskFactory_h |
| OLD | NEW |