OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 10 matching lines...) Expand all Loading... |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 * | 24 * |
25 */ | 25 */ |
26 | 26 |
27 #ifndef WorkerEventQueue_h | 27 #ifndef WorkerEventQueue_h |
28 #define WorkerEventQueue_h | 28 #define WorkerEventQueue_h |
29 | 29 |
30 #include "core/events/EventQueue.h" | 30 #include "core/events/EventQueue.h" |
31 #include "wtf/HashMap.h" | |
32 #include "wtf/HashSet.h" | 31 #include "wtf/HashSet.h" |
33 | 32 |
34 namespace blink { | 33 namespace blink { |
35 | 34 |
36 class Event; | 35 class Event; |
37 class ExecutionContext; | 36 class ExecutionContext; |
38 | 37 |
39 class WorkerEventQueue final : public EventQueue { | 38 class WorkerEventQueue final : public EventQueue { |
40 public: | 39 public: |
41 | 40 |
42 static WorkerEventQueue* create(ExecutionContext*); | 41 static WorkerEventQueue* create(ExecutionContext*); |
43 ~WorkerEventQueue() override; | 42 ~WorkerEventQueue() override; |
44 DECLARE_TRACE(); | 43 DECLARE_TRACE(); |
45 | 44 |
46 // EventQueue | 45 // EventQueue |
47 bool enqueueEvent(Event*) override; | 46 bool enqueueEvent(Event*) override; |
48 bool cancelEvent(Event*) override; | 47 bool cancelEvent(Event*) override; |
49 void close() override; | 48 void close() override; |
50 | 49 |
51 private: | 50 private: |
52 explicit WorkerEventQueue(ExecutionContext*); | 51 explicit WorkerEventQueue(ExecutionContext*); |
| 52 bool removeEvent(Event*); |
| 53 void dispatchEvent(Event*, ExecutionContext*); |
53 | 54 |
54 Member<ExecutionContext> m_executionContext; | 55 Member<ExecutionContext> m_executionContext; |
55 bool m_isClosed; | 56 bool m_isClosed; |
56 | 57 |
57 class EventDispatcherTask; | 58 HeapHashSet<Member<Event>> m_pendingEvents; |
58 using EventTaskMap = HeapHashMap<Member<Event>, EventDispatcherTask*>; | |
59 EventTaskMap m_eventTaskMap; | |
60 }; | 59 }; |
61 | 60 |
62 } // namespace blink | 61 } // namespace blink |
63 | 62 |
64 #endif // WorkerEventQueue_h | 63 #endif // WorkerEventQueue_h |
OLD | NEW |