| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ParentFrameTaskRunners_h | 5 #ifndef ParentFrameTaskRunners_h |
| 6 #define ParentFrameTaskRunners_h | 6 #define ParentFrameTaskRunners_h |
| 7 | 7 |
| 8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
| 9 #include "core/dom/TaskRunnerHelper.h" | 9 #include "core/dom/TaskRunnerHelper.h" |
| 10 #include "core/frame/LocalFrameLifecycleObserver.h" | 10 #include "core/frame/LocalFrameLifecycleObserver.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // on the parent context thread (i.e. MainThread) on construction time, rather | 24 // on the parent context thread (i.e. MainThread) on construction time, rather |
| 25 // than being done lazily. | 25 // than being done lazily. |
| 26 // | 26 // |
| 27 // This observes LocalFrame lifecycle only for in-process worker cases (i.e. | 27 // This observes LocalFrame lifecycle only for in-process worker cases (i.e. |
| 28 // only when a non-null LocalFrame is given). | 28 // only when a non-null LocalFrame is given). |
| 29 class CORE_EXPORT ParentFrameTaskRunners final : public GarbageCollectedFinalize
d<ParentFrameTaskRunners>, public LocalFrameLifecycleObserver { | 29 class CORE_EXPORT ParentFrameTaskRunners final : public GarbageCollectedFinalize
d<ParentFrameTaskRunners>, public LocalFrameLifecycleObserver { |
| 30 USING_GARBAGE_COLLECTED_MIXIN(ParentFrameTaskRunners); | 30 USING_GARBAGE_COLLECTED_MIXIN(ParentFrameTaskRunners); |
| 31 WTF_MAKE_NONCOPYABLE(ParentFrameTaskRunners); | 31 WTF_MAKE_NONCOPYABLE(ParentFrameTaskRunners); |
| 32 | 32 |
| 33 public: | 33 public: |
| 34 // LocalFrame could be nullptr if the worker is not associated with a | 34 static ParentFrameTaskRunners* create(LocalFrame* frame) |
| 35 // particular local frame. | 35 { |
| 36 explicit ParentFrameTaskRunners(LocalFrame*); | 36 return new ParentFrameTaskRunners(frame); |
| 37 } |
| 37 | 38 |
| 38 // Might return nullptr for unsupported task types. | 39 // Might return nullptr for unsupported task types. |
| 39 WebTaskRunner* get(TaskType); | 40 WebTaskRunner* get(TaskType); |
| 40 | 41 |
| 41 DECLARE_VIRTUAL_TRACE(); | 42 DECLARE_VIRTUAL_TRACE(); |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 using TaskRunnerHashMap = HashMap<TaskType, WebTaskRunner*, WTF::IntHash<Tas
kType>, TaskTypeTraits>; | 45 using TaskRunnerHashMap = HashMap<TaskType, WebTaskRunner*, WTF::IntHash<Tas
kType>, TaskTypeTraits>; |
| 45 | 46 |
| 47 // LocalFrame could be nullptr if the worker is not associated with a |
| 48 // particular local frame. |
| 49 explicit ParentFrameTaskRunners(LocalFrame*); |
| 50 |
| 46 void contextDestroyed() override; | 51 void contextDestroyed() override; |
| 47 | 52 |
| 48 Mutex m_taskRunnersMutex; | 53 Mutex m_taskRunnersMutex; |
| 49 TaskRunnerHashMap m_taskRunners; | 54 TaskRunnerHashMap m_taskRunners; |
| 50 }; | 55 }; |
| 51 | 56 |
| 52 } // namespace blink | 57 } // namespace blink |
| 53 | 58 |
| 54 #endif // ParentFrameTaskRunners_h | 59 #endif // ParentFrameTaskRunners_h |
| OLD | NEW |