OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Henry Mason (hmason@mac.com) | 2 * Copyright (C) 2007 Henry Mason (hmason@mac.com) |
3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserv
ed. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "bindings/core/v8/SerializedScriptValue.h" | 31 #include "bindings/core/v8/SerializedScriptValue.h" |
32 #include "core/CoreExport.h" | 32 #include "core/CoreExport.h" |
33 #include "core/dom/DOMArrayBuffer.h" | 33 #include "core/dom/DOMArrayBuffer.h" |
34 #include "core/dom/MessagePort.h" | 34 #include "core/dom/MessagePort.h" |
35 #include "core/events/Event.h" | 35 #include "core/events/Event.h" |
36 #include "core/events/EventTarget.h" | 36 #include "core/events/EventTarget.h" |
37 #include "core/events/MessageEventInit.h" | 37 #include "core/events/MessageEventInit.h" |
38 #include "core/fileapi/Blob.h" | 38 #include "core/fileapi/Blob.h" |
39 #include "core/frame/DOMWindow.h" | 39 #include "core/frame/DOMWindow.h" |
| 40 #include <memory> |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
43 class CORE_EXPORT MessageEvent final : public Event { | 44 class CORE_EXPORT MessageEvent final : public Event { |
44 DEFINE_WRAPPERTYPEINFO(); | 45 DEFINE_WRAPPERTYPEINFO(); |
45 public: | 46 public: |
46 static MessageEvent* create() | 47 static MessageEvent* create() |
47 { | 48 { |
48 return new MessageEvent; | 49 return new MessageEvent; |
49 } | 50 } |
50 static MessageEvent* create(MessagePortArray* ports, const String& origin =
String(), const String& lastEventId = String(), EventTarget* source = nullptr, c
onst String& suborigin = String()) | 51 static MessageEvent* create(MessagePortArray* ports, const String& origin =
String(), const String& lastEventId = String(), EventTarget* source = nullptr, c
onst String& suborigin = String()) |
51 { | 52 { |
52 return new MessageEvent(origin, lastEventId, source, ports, suborigin); | 53 return new MessageEvent(origin, lastEventId, source, ports, suborigin); |
53 } | 54 } |
54 static MessageEvent* create(MessagePortArray* ports, PassRefPtr<SerializedSc
riptValue> data, const String& origin = String(), const String& lastEventId = St
ring(), EventTarget* source = nullptr, const String& suborigin = String()) | 55 static MessageEvent* create(MessagePortArray* ports, PassRefPtr<SerializedSc
riptValue> data, const String& origin = String(), const String& lastEventId = St
ring(), EventTarget* source = nullptr, const String& suborigin = String()) |
55 { | 56 { |
56 return new MessageEvent(data, origin, lastEventId, source, ports, subori
gin); | 57 return new MessageEvent(data, origin, lastEventId, source, ports, subori
gin); |
57 } | 58 } |
58 static MessageEvent* create(PassOwnPtr<MessagePortChannelArray> channels, Pa
ssRefPtr<SerializedScriptValue> data, const String& origin = String(), const Str
ing& lastEventId = String(), EventTarget* source = nullptr, const String& subori
gin = String()) | 59 static MessageEvent* create(std::unique_ptr<MessagePortChannelArray> channel
s, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), cons
t String& lastEventId = String(), EventTarget* source = nullptr, const String& s
uborigin = String()) |
59 { | 60 { |
60 return new MessageEvent(data, origin, lastEventId, source, std::move(cha
nnels), suborigin); | 61 return new MessageEvent(data, origin, lastEventId, source, std::move(cha
nnels), suborigin); |
61 } | 62 } |
62 static MessageEvent* create(const String& data, const String& origin = Strin
g(), const String& suborigin = String()) | 63 static MessageEvent* create(const String& data, const String& origin = Strin
g(), const String& suborigin = String()) |
63 { | 64 { |
64 return new MessageEvent(data, origin, suborigin); | 65 return new MessageEvent(data, origin, suborigin); |
65 } | 66 } |
66 static MessageEvent* create(Blob* data, const String& origin = String(), con
st String& suborigin = String()) | 67 static MessageEvent* create(Blob* data, const String& origin = String(), con
st String& suborigin = String()) |
67 { | 68 { |
68 return new MessageEvent(data, origin, suborigin); | 69 return new MessageEvent(data, origin, suborigin); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 112 |
112 DECLARE_VIRTUAL_TRACE(); | 113 DECLARE_VIRTUAL_TRACE(); |
113 | 114 |
114 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; | 115 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; |
115 | 116 |
116 private: | 117 private: |
117 MessageEvent(); | 118 MessageEvent(); |
118 MessageEvent(const AtomicString&, const MessageEventInit&); | 119 MessageEvent(const AtomicString&, const MessageEventInit&); |
119 MessageEvent(const String& origin, const String& lastEventId, EventTarget* s
ource, MessagePortArray*, const String& suborigin); | 120 MessageEvent(const String& origin, const String& lastEventId, EventTarget* s
ource, MessagePortArray*, const String& suborigin); |
120 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, EventTarget* source, MessagePortArray*, const String&
suborigin); | 121 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, EventTarget* source, MessagePortArray*, const String&
suborigin); |
121 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, EventTarget* source, PassOwnPtr<MessagePortChannelArra
y>, const String& suborigin); | 122 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, EventTarget* source, std::unique_ptr<MessagePortChanne
lArray>, const String& suborigin); |
122 | 123 |
123 MessageEvent(const String& data, const String& origin, const String& suborig
in); | 124 MessageEvent(const String& data, const String& origin, const String& suborig
in); |
124 MessageEvent(Blob* data, const String& origin, const String& suborigin); | 125 MessageEvent(Blob* data, const String& origin, const String& suborigin); |
125 MessageEvent(DOMArrayBuffer* data, const String& origin, const String& subor
igin); | 126 MessageEvent(DOMArrayBuffer* data, const String& origin, const String& subor
igin); |
126 | 127 |
127 DataType m_dataType; | 128 DataType m_dataType; |
128 ScriptValue m_dataAsScriptValue; | 129 ScriptValue m_dataAsScriptValue; |
129 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; | 130 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; |
130 String m_dataAsString; | 131 String m_dataAsString; |
131 Member<Blob> m_dataAsBlob; | 132 Member<Blob> m_dataAsBlob; |
132 Member<DOMArrayBuffer> m_dataAsArrayBuffer; | 133 Member<DOMArrayBuffer> m_dataAsArrayBuffer; |
133 String m_origin; | 134 String m_origin; |
134 String m_lastEventId; | 135 String m_lastEventId; |
135 Member<EventTarget> m_source; | 136 Member<EventTarget> m_source; |
136 // m_ports are the MessagePorts in an engtangled state, and m_channels are | 137 // m_ports are the MessagePorts in an engtangled state, and m_channels are |
137 // the MessageChannels in a disentangled state. Only one of them can be | 138 // the MessageChannels in a disentangled state. Only one of them can be |
138 // non-empty at a time. entangleMessagePorts() moves between the states. | 139 // non-empty at a time. entangleMessagePorts() moves between the states. |
139 Member<MessagePortArray> m_ports; | 140 Member<MessagePortArray> m_ports; |
140 OwnPtr<MessagePortChannelArray> m_channels; | 141 std::unique_ptr<MessagePortChannelArray> m_channels; |
141 String m_suborigin; | 142 String m_suborigin; |
142 }; | 143 }; |
143 | 144 |
144 } // namespace blink | 145 } // namespace blink |
145 | 146 |
146 #endif // MessageEvent_h | 147 #endif // MessageEvent_h |
OLD | NEW |