| 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 25 matching lines...) Expand all Loading... |
| 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 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class CORE_EXPORT MessageEvent final : public Event { | 43 class CORE_EXPORT MessageEvent final : public Event { |
| 44 DEFINE_WRAPPERTYPEINFO(); | 44 DEFINE_WRAPPERTYPEINFO(); |
| 45 public: | 45 public: |
| 46 static PassRefPtrWillBeRawPtr<MessageEvent> create() | 46 static RawPtr<MessageEvent> create() |
| 47 { | 47 { |
| 48 return adoptRefWillBeNoop(new MessageEvent); | 48 return adoptRefWillBeNoop(new MessageEvent); |
| 49 } | 49 } |
| 50 static PassRefPtrWillBeRawPtr<MessageEvent> create(MessagePortArray* ports,
const String& origin = String(), const String& lastEventId = String(), PassRefPt
rWillBeRawPtr<EventTarget> source = nullptr, const String& suborigin = String()) | 50 static RawPtr<MessageEvent> create(MessagePortArray* ports, const String& or
igin = String(), const String& lastEventId = String(), RawPtr<EventTarget> sourc
e = nullptr, const String& suborigin = String()) |
| 51 { | 51 { |
| 52 return adoptRefWillBeNoop(new MessageEvent(origin, lastEventId, source,
ports, suborigin)); | 52 return new MessageEvent(origin, lastEventId, source, ports, suborigin); |
| 53 } | 53 } |
| 54 static PassRefPtrWillBeRawPtr<MessageEvent> create(MessagePortArray* ports,
PassRefPtr<SerializedScriptValue> data, const String& origin = String(), const S
tring& lastEventId = String(), PassRefPtrWillBeRawPtr<EventTarget> source = null
ptr, const String& suborigin = String()) | 54 static RawPtr<MessageEvent> create(MessagePortArray* ports, PassRefPtr<Seria
lizedScriptValue> data, const String& origin = String(), const String& lastEvent
Id = String(), RawPtr<EventTarget> source = nullptr, const String& suborigin = S
tring()) |
| 55 { | 55 { |
| 56 return adoptRefWillBeNoop(new MessageEvent(data, origin, lastEventId, so
urce, ports, suborigin)); | 56 return new MessageEvent(data, origin, lastEventId, source, ports, subori
gin); |
| 57 } | 57 } |
| 58 static PassRefPtrWillBeRawPtr<MessageEvent> create(PassOwnPtr<MessagePortCha
nnelArray> channels, PassRefPtr<SerializedScriptValue> data, const String& origi
n = String(), const String& lastEventId = String(), PassRefPtrWillBeRawPtr<Event
Target> source = nullptr, const String& suborigin = String()) | 58 static RawPtr<MessageEvent> create(PassOwnPtr<MessagePortChannelArray> chann
els, PassRefPtr<SerializedScriptValue> data, const String& origin = String(), co
nst String& lastEventId = String(), RawPtr<EventTarget> source = nullptr, const
String& suborigin = String()) |
| 59 { | 59 { |
| 60 return adoptRefWillBeNoop(new MessageEvent(data, origin, lastEventId, so
urce, std::move(channels), suborigin)); | 60 return new MessageEvent(data, origin, lastEventId, source, std::move(cha
nnels), suborigin); |
| 61 } | 61 } |
| 62 static PassRefPtrWillBeRawPtr<MessageEvent> create(const String& data, const
String& origin = String(), const String& suborigin = String()) | 62 static RawPtr<MessageEvent> create(const String& data, const String& origin
= String(), const String& suborigin = String()) |
| 63 { | 63 { |
| 64 return adoptRefWillBeNoop(new MessageEvent(data, origin, suborigin)); | 64 return new MessageEvent(data, origin, suborigin); |
| 65 } | 65 } |
| 66 static PassRefPtrWillBeRawPtr<MessageEvent> create(Blob* data, const String&
origin = String(), const String& suborigin = String()) | 66 static RawPtr<MessageEvent> create(Blob* data, const String& origin = String
(), const String& suborigin = String()) |
| 67 { | 67 { |
| 68 return adoptRefWillBeNoop(new MessageEvent(data, origin, suborigin)); | 68 return new MessageEvent(data, origin, suborigin); |
| 69 } | 69 } |
| 70 static PassRefPtrWillBeRawPtr<MessageEvent> create(PassRefPtr<DOMArrayBuffer
> data, const String& origin = String(), const String& suborigin = String()) | 70 static RawPtr<MessageEvent> create(PassRefPtr<DOMArrayBuffer> data, const St
ring& origin = String(), const String& suborigin = String()) |
| 71 { | 71 { |
| 72 return adoptRefWillBeNoop(new MessageEvent(data, origin, suborigin)); | 72 return new MessageEvent(data, origin, suborigin); |
| 73 } | 73 } |
| 74 static PassRefPtrWillBeRawPtr<MessageEvent> create(const AtomicString& type,
const MessageEventInit& initializer, ExceptionState&); | 74 static RawPtr<MessageEvent> create(const AtomicString& type, const MessageEv
entInit& initializer, ExceptionState&); |
| 75 ~MessageEvent() override; | 75 ~MessageEvent() override; |
| 76 | 76 |
| 77 void initMessageEvent(const AtomicString& type, bool canBubble, bool cancela
ble, ScriptValue data, const String& origin, const String& lastEventId, DOMWindo
w* source, MessagePortArray*); | 77 void initMessageEvent(const AtomicString& type, bool canBubble, bool cancela
ble, ScriptValue data, const String& origin, const String& lastEventId, DOMWindo
w* source, MessagePortArray*); |
| 78 void initMessageEvent(const AtomicString& type, bool canBubble, bool cancela
ble, PassRefPtr<SerializedScriptValue> data, const String& origin, const String&
lastEventId, DOMWindow* source, MessagePortArray*); | 78 void initMessageEvent(const AtomicString& type, bool canBubble, bool cancela
ble, PassRefPtr<SerializedScriptValue> data, const String& origin, const String&
lastEventId, DOMWindow* source, MessagePortArray*); |
| 79 | 79 |
| 80 const String& origin() const { return m_origin; } | 80 const String& origin() const { return m_origin; } |
| 81 const String& suborigin() const { return m_suborigin; } | 81 const String& suborigin() const { return m_suborigin; } |
| 82 const String& lastEventId() const { return m_lastEventId; } | 82 const String& lastEventId() const { return m_lastEventId; } |
| 83 EventTarget* source() const { return m_source.get(); } | 83 EventTarget* source() const { return m_source.get(); } |
| 84 MessagePortArray ports(bool& isNull) const; | 84 MessagePortArray ports(bool& isNull) const; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 109 | 109 |
| 110 void entangleMessagePorts(ExecutionContext*); | 110 void entangleMessagePorts(ExecutionContext*); |
| 111 | 111 |
| 112 DECLARE_VIRTUAL_TRACE(); | 112 DECLARE_VIRTUAL_TRACE(); |
| 113 | 113 |
| 114 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; |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 MessageEvent(); | 117 MessageEvent(); |
| 118 MessageEvent(const AtomicString&, const MessageEventInit&); | 118 MessageEvent(const AtomicString&, const MessageEventInit&); |
| 119 MessageEvent(const String& origin, const String& lastEventId, PassRefPtrWill
BeRawPtr<EventTarget> source, MessagePortArray*, const String& suborigin); | 119 MessageEvent(const String& origin, const String& lastEventId, RawPtr<EventTa
rget> source, MessagePortArray*, const String& suborigin); |
| 120 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, MessagePor
tArray*, const String& suborigin); | 120 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, RawPtr<EventTarget> source, MessagePortArray*, const S
tring& suborigin); |
| 121 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr
<MessagePortChannelArray>, const String& suborigin); | 121 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, RawPtr<EventTarget> source, PassOwnPtr<MessagePortChan
nelArray>, const String& suborigin); |
| 122 | 122 |
| 123 MessageEvent(const String& data, const String& origin, const String& suborig
in); | 123 MessageEvent(const String& data, const String& origin, const String& suborig
in); |
| 124 MessageEvent(Blob* data, const String& origin, const String& suborigin); | 124 MessageEvent(Blob* data, const String& origin, const String& suborigin); |
| 125 MessageEvent(PassRefPtr<DOMArrayBuffer> data, const String& origin, const St
ring& suborigin); | 125 MessageEvent(PassRefPtr<DOMArrayBuffer> data, const String& origin, const St
ring& suborigin); |
| 126 | 126 |
| 127 DataType m_dataType; | 127 DataType m_dataType; |
| 128 ScriptValue m_dataAsScriptValue; | 128 ScriptValue m_dataAsScriptValue; |
| 129 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; | 129 RefPtr<SerializedScriptValue> m_dataAsSerializedScriptValue; |
| 130 String m_dataAsString; | 130 String m_dataAsString; |
| 131 PersistentWillBeMember<Blob> m_dataAsBlob; | 131 Member<Blob> m_dataAsBlob; |
| 132 RefPtr<DOMArrayBuffer> m_dataAsArrayBuffer; | 132 RefPtr<DOMArrayBuffer> m_dataAsArrayBuffer; |
| 133 String m_origin; | 133 String m_origin; |
| 134 String m_lastEventId; | 134 String m_lastEventId; |
| 135 RefPtrWillBeMember<EventTarget> m_source; | 135 Member<EventTarget> m_source; |
| 136 // 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 |
| 137 // 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 |
| 138 // non-empty at a time. entangleMessagePorts() moves between the states. | 138 // non-empty at a time. entangleMessagePorts() moves between the states. |
| 139 PersistentWillBeMember<MessagePortArray> m_ports; | 139 Member<MessagePortArray> m_ports; |
| 140 OwnPtr<MessagePortChannelArray> m_channels; | 140 OwnPtr<MessagePortChannelArray> m_channels; |
| 141 String m_suborigin; | 141 String m_suborigin; |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 } // namespace blink | 144 } // namespace blink |
| 145 | 145 |
| 146 #endif // MessageEvent_h | 146 #endif // MessageEvent_h |
| OLD | NEW |