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/ContextLifecycleObserver.h" | 9 #include "core/dom/ContextLifecycleObserver.h" |
10 #include "core/dom/TaskRunnerHelper.h" | 10 #include "core/dom/TaskRunnerHelper.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 public ContextLifecycleObserver { | 31 public ContextLifecycleObserver { |
32 USING_GARBAGE_COLLECTED_MIXIN(ParentFrameTaskRunners); | 32 USING_GARBAGE_COLLECTED_MIXIN(ParentFrameTaskRunners); |
33 WTF_MAKE_NONCOPYABLE(ParentFrameTaskRunners); | 33 WTF_MAKE_NONCOPYABLE(ParentFrameTaskRunners); |
34 | 34 |
35 public: | 35 public: |
36 static ParentFrameTaskRunners* create(LocalFrame* frame) { | 36 static ParentFrameTaskRunners* create(LocalFrame* frame) { |
37 return new ParentFrameTaskRunners(frame); | 37 return new ParentFrameTaskRunners(frame); |
38 } | 38 } |
39 | 39 |
40 // Might return nullptr for unsupported task types. | 40 // Might return nullptr for unsupported task types. |
41 WebTaskRunner* get(TaskType); | 41 RefPtr<WebTaskRunner> get(TaskType); |
42 | 42 |
43 DECLARE_VIRTUAL_TRACE(); | 43 DECLARE_VIRTUAL_TRACE(); |
44 | 44 |
45 private: | 45 private: |
46 using TaskRunnerHashMap = | 46 using TaskRunnerHashMap = HashMap<TaskType, |
47 HashMap<TaskType, WebTaskRunner*, WTF::IntHash<TaskType>, TaskTypeTraits>; | 47 RefPtr<WebTaskRunner>, |
| 48 WTF::IntHash<TaskType>, |
| 49 TaskTypeTraits>; |
48 | 50 |
49 // LocalFrame could be nullptr if the worker is not associated with a | 51 // LocalFrame could be nullptr if the worker is not associated with a |
50 // particular local frame. | 52 // particular local frame. |
51 explicit ParentFrameTaskRunners(LocalFrame*); | 53 explicit ParentFrameTaskRunners(LocalFrame*); |
52 | 54 |
53 void contextDestroyed() override; | 55 void contextDestroyed() override; |
54 | 56 |
55 Mutex m_taskRunnersMutex; | 57 Mutex m_taskRunnersMutex; |
56 TaskRunnerHashMap m_taskRunners; | 58 TaskRunnerHashMap m_taskRunners; |
57 }; | 59 }; |
58 | 60 |
59 } // namespace blink | 61 } // namespace blink |
60 | 62 |
61 #endif // ParentFrameTaskRunners_h | 63 #endif // ParentFrameTaskRunners_h |
OLD | NEW |