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 ServiceWorkerMessageEvent_h | 5 #ifndef ServiceWorkerMessageEvent_h |
6 #define ServiceWorkerMessageEvent_h | 6 #define ServiceWorkerMessageEvent_h |
7 | 7 |
8 #include "core/dom/DOMArrayBuffer.h" | 8 #include "core/dom/DOMArrayBuffer.h" |
9 #include "core/dom/MessagePort.h" | 9 #include "core/dom/MessagePort.h" |
10 #include "modules/EventModules.h" | 10 #include "modules/EventModules.h" |
11 #include "modules/ModulesExport.h" | 11 #include "modules/ModulesExport.h" |
12 #include "modules/serviceworkers/ServiceWorkerMessageEventInit.h" | 12 #include "modules/serviceworkers/ServiceWorkerMessageEventInit.h" |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 class MODULES_EXPORT ServiceWorkerMessageEvent final : public Event { | 16 class MODULES_EXPORT ServiceWorkerMessageEvent final : public Event { |
17 DEFINE_WRAPPERTYPEINFO(); | 17 DEFINE_WRAPPERTYPEINFO(); |
18 public: | 18 public: |
19 static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create() | 19 static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create() |
20 { | 20 { |
21 return adoptRefWillBeNoop(new ServiceWorkerMessageEvent); | 21 return adoptRefWillBeNoop(new ServiceWorkerMessageEvent); |
22 } | 22 } |
23 | 23 |
24 static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create(const Atomic
String& type, const ServiceWorkerMessageEventInit& initializer) | 24 static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create(const Atomic
String& type, const ServiceWorkerMessageEventInit& initializer) |
25 { | 25 { |
26 return adoptRefWillBeNoop(new ServiceWorkerMessageEvent(type, initialize
r)); | 26 return adoptRefWillBeNoop(new ServiceWorkerMessageEvent(type, initialize
r)); |
27 } | 27 } |
28 | 28 |
29 static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create(MessagePortA
rray* ports, PassRefPtr<SerializedScriptValue> data, PassRefPtrWillBeRawPtr<Serv
iceWorker> source, const String& origin) | 29 static PassRefPtrWillBeRawPtr<ServiceWorkerMessageEvent> create(MessagePortA
rray* ports, PassRefPtr<SerializedScriptValue> data, ServiceWorker* source, cons
t String& origin) |
30 { | 30 { |
31 return adoptRefWillBeNoop(new ServiceWorkerMessageEvent(data, origin, St
ring(), source, ports)); | 31 return adoptRefWillBeNoop(new ServiceWorkerMessageEvent(data, origin, St
ring(), source, ports)); |
32 } | 32 } |
33 | 33 |
34 ~ServiceWorkerMessageEvent() override; | 34 ~ServiceWorkerMessageEvent() override; |
35 | 35 |
36 ScriptValue data() const { return m_data; } | 36 ScriptValue data() const { return m_data; } |
37 SerializedScriptValue* serializedData() const { return m_serializedData.get(
); } | 37 SerializedScriptValue* serializedData() const { return m_serializedData.get(
); } |
38 const String& origin() const { return m_origin; } | 38 const String& origin() const { return m_origin; } |
39 const String& lastEventId() const { return m_lastEventId; } | 39 const String& lastEventId() const { return m_lastEventId; } |
40 MessagePortArray ports(bool& isNull) const; | 40 MessagePortArray ports(bool& isNull) const; |
41 MessagePortArray ports() const; | 41 MessagePortArray ports() const; |
42 void source(ServiceWorkerOrMessagePort& result) const; | 42 void source(ServiceWorkerOrMessagePort& result) const; |
43 | 43 |
44 const AtomicString& interfaceName() const override; | 44 const AtomicString& interfaceName() const override; |
45 | 45 |
46 DECLARE_VIRTUAL_TRACE(); | 46 DECLARE_VIRTUAL_TRACE(); |
47 | 47 |
48 private: | 48 private: |
49 ServiceWorkerMessageEvent(); | 49 ServiceWorkerMessageEvent(); |
50 ServiceWorkerMessageEvent(const AtomicString& type, const ServiceWorkerMessa
geEventInit& initializer); | 50 ServiceWorkerMessageEvent(const AtomicString& type, const ServiceWorkerMessa
geEventInit& initializer); |
51 ServiceWorkerMessageEvent(PassRefPtr<SerializedScriptValue> data, const Stri
ng& origin, const String& lastEventId, PassRefPtrWillBeRawPtr<ServiceWorker> sou
rce, MessagePortArray* ports); | 51 ServiceWorkerMessageEvent(PassRefPtr<SerializedScriptValue> data, const Stri
ng& origin, const String& lastEventId, ServiceWorker* source, MessagePortArray*
ports); |
52 | 52 |
53 ScriptValue m_data; | 53 ScriptValue m_data; |
54 RefPtr<SerializedScriptValue> m_serializedData; | 54 RefPtr<SerializedScriptValue> m_serializedData; |
55 String m_origin; | 55 String m_origin; |
56 String m_lastEventId; | 56 String m_lastEventId; |
57 RefPtrWillBeMember<ServiceWorker> m_sourceAsServiceWorker; | 57 PersistentWillBeMember<ServiceWorker> m_sourceAsServiceWorker; |
58 PersistentWillBeMember<MessagePort> m_sourceAsMessagePort; | 58 PersistentWillBeMember<MessagePort> m_sourceAsMessagePort; |
59 PersistentWillBeMember<MessagePortArray> m_ports; | 59 PersistentWillBeMember<MessagePortArray> m_ports; |
60 }; | 60 }; |
61 | 61 |
62 } // namespace blink | 62 } // namespace blink |
63 | 63 |
64 #endif // ServiceWorkerMessageEvent_h | 64 #endif // ServiceWorkerMessageEvent_h |
OLD | NEW |