| 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> | |
| 41 | 40 |
| 42 namespace blink { | 41 namespace blink { |
| 43 | 42 |
| 44 class CORE_EXPORT MessageEvent final : public Event { | 43 class CORE_EXPORT MessageEvent final : public Event { |
| 45 DEFINE_WRAPPERTYPEINFO(); | 44 DEFINE_WRAPPERTYPEINFO(); |
| 46 public: | 45 public: |
| 47 static MessageEvent* create() | 46 static MessageEvent* create() |
| 48 { | 47 { |
| 49 return new MessageEvent; | 48 return new MessageEvent; |
| 50 } | 49 } |
| 51 static MessageEvent* create(MessagePortArray* ports, const String& origin =
String(), const String& lastEventId = String(), EventTarget* source = nullptr, c
onst String& suborigin = String()) | 50 static MessageEvent* create(MessagePortArray* ports, const String& origin =
String(), const String& lastEventId = String(), EventTarget* source = nullptr, c
onst String& suborigin = String()) |
| 52 { | 51 { |
| 53 return new MessageEvent(origin, lastEventId, source, ports, suborigin); | 52 return new MessageEvent(origin, lastEventId, source, ports, suborigin); |
| 54 } | 53 } |
| 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()) | 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()) |
| 56 { | 55 { |
| 57 return new MessageEvent(data, origin, lastEventId, source, ports, subori
gin); | 56 return new MessageEvent(data, origin, lastEventId, source, ports, subori
gin); |
| 58 } | 57 } |
| 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()) | 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()) |
| 60 { | 59 { |
| 61 return new MessageEvent(data, origin, lastEventId, source, std::move(cha
nnels), suborigin); | 60 return new MessageEvent(data, origin, lastEventId, source, std::move(cha
nnels), suborigin); |
| 62 } | 61 } |
| 63 static MessageEvent* create(const String& data, const String& origin = Strin
g(), const String& suborigin = String()) | 62 static MessageEvent* create(const String& data, const String& origin = Strin
g(), const String& suborigin = String()) |
| 64 { | 63 { |
| 65 return new MessageEvent(data, origin, suborigin); | 64 return new MessageEvent(data, origin, suborigin); |
| 66 } | 65 } |
| 67 static MessageEvent* create(Blob* data, const String& origin = String(), con
st String& suborigin = String()) | 66 static MessageEvent* create(Blob* data, const String& origin = String(), con
st String& suborigin = String()) |
| 68 { | 67 { |
| 69 return new MessageEvent(data, origin, suborigin); | 68 return new MessageEvent(data, origin, suborigin); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 111 |
| 113 DECLARE_VIRTUAL_TRACE(); | 112 DECLARE_VIRTUAL_TRACE(); |
| 114 | 113 |
| 115 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; | 114 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; |
| 116 | 115 |
| 117 private: | 116 private: |
| 118 MessageEvent(); | 117 MessageEvent(); |
| 119 MessageEvent(const AtomicString&, const MessageEventInit&); | 118 MessageEvent(const AtomicString&, const MessageEventInit&); |
| 120 MessageEvent(const String& origin, const String& lastEventId, EventTarget* s
ource, MessagePortArray*, const String& suborigin); | 119 MessageEvent(const String& origin, const String& lastEventId, EventTarget* s
ource, MessagePortArray*, const String& suborigin); |
| 121 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, EventTarget* source, MessagePortArray*, const String&
suborigin); | 120 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, EventTarget* source, MessagePortArray*, 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); | 121 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, EventTarget* source, PassOwnPtr<MessagePortChannelArra
y>, const String& suborigin); |
| 123 | 122 |
| 124 MessageEvent(const String& data, const String& origin, const String& suborig
in); | 123 MessageEvent(const String& data, const String& origin, const String& suborig
in); |
| 125 MessageEvent(Blob* data, const String& origin, const String& suborigin); | 124 MessageEvent(Blob* data, const String& origin, const String& suborigin); |
| 126 MessageEvent(DOMArrayBuffer* data, const String& origin, const String& subor
igin); | 125 MessageEvent(DOMArrayBuffer* data, const String& origin, const String& subor
igin); |
| 127 | 126 |
| 128 DataType m_dataType; | 127 DataType m_dataType; |
| 129 ScriptValue m_dataAsScriptValue; | 128 ScriptValue m_dataAsScriptValue; |
| 130 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; | 129 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; |
| 131 String m_dataAsString; | 130 String m_dataAsString; |
| 132 Member<Blob> m_dataAsBlob; | 131 Member<Blob> m_dataAsBlob; |
| 133 Member<DOMArrayBuffer> m_dataAsArrayBuffer; | 132 Member<DOMArrayBuffer> m_dataAsArrayBuffer; |
| 134 String m_origin; | 133 String m_origin; |
| 135 String m_lastEventId; | 134 String m_lastEventId; |
| 136 Member<EventTarget> m_source; | 135 Member<EventTarget> m_source; |
| 137 // m_ports are the MessagePorts in an engtangled state, and m_channels are | 136 // m_ports are the MessagePorts in an engtangled state, and m_channels are |
| 138 // the MessageChannels in a disentangled state. Only one of them can be | 137 // the MessageChannels in a disentangled state. Only one of them can be |
| 139 // non-empty at a time. entangleMessagePorts() moves between the states. | 138 // non-empty at a time. entangleMessagePorts() moves between the states. |
| 140 Member<MessagePortArray> m_ports; | 139 Member<MessagePortArray> m_ports; |
| 141 std::unique_ptr<MessagePortChannelArray> m_channels; | 140 OwnPtr<MessagePortChannelArray> m_channels; |
| 142 String m_suborigin; | 141 String m_suborigin; |
| 143 }; | 142 }; |
| 144 | 143 |
| 145 } // namespace blink | 144 } // namespace blink |
| 146 | 145 |
| 147 #endif // MessageEvent_h | 146 #endif // MessageEvent_h |
| OLD | NEW |