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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 } | 65 } |
66 static PassRefPtrWillBeRawPtr<MessageEvent> create(Blob* data, const String&
origin = String()) | 66 static PassRefPtrWillBeRawPtr<MessageEvent> create(Blob* data, const String&
origin = String()) |
67 { | 67 { |
68 return adoptRefWillBeNoop(new MessageEvent(data, origin)); | 68 return adoptRefWillBeNoop(new MessageEvent(data, origin)); |
69 } | 69 } |
70 static PassRefPtrWillBeRawPtr<MessageEvent> create(PassRefPtr<DOMArrayBuffer
> data, const String& origin = String()) | 70 static PassRefPtrWillBeRawPtr<MessageEvent> create(PassRefPtr<DOMArrayBuffer
> data, const String& origin = String()) |
71 { | 71 { |
72 return adoptRefWillBeNoop(new MessageEvent(data, origin)); | 72 return adoptRefWillBeNoop(new MessageEvent(data, origin)); |
73 } | 73 } |
74 static PassRefPtrWillBeRawPtr<MessageEvent> create(const AtomicString& type,
const MessageEventInit& initializer, ExceptionState&); | 74 static PassRefPtrWillBeRawPtr<MessageEvent> create(const AtomicString& type,
const MessageEventInit& initializer, ExceptionState&); |
75 virtual ~MessageEvent(); | 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& lastEventId() const { return m_lastEventId; } | 81 const String& lastEventId() const { return m_lastEventId; } |
82 EventTarget* source() const { return m_source.get(); } | 82 EventTarget* source() const { return m_source.get(); } |
83 MessagePortArray ports(bool& isNull) const; | 83 MessagePortArray ports(bool& isNull) const; |
84 MessagePortArray ports() const; | 84 MessagePortArray ports() const; |
85 MessagePortChannelArray* channels() const { return m_channels ? m_channels.g
et() : 0; } | 85 MessagePortChannelArray* channels() const { return m_channels ? m_channels.g
et() : 0; } |
86 | 86 |
87 virtual const AtomicString& interfaceName() const override; | 87 const AtomicString& interfaceName() const override; |
88 | 88 |
89 enum DataType { | 89 enum DataType { |
90 DataTypeScriptValue, | 90 DataTypeScriptValue, |
91 DataTypeSerializedScriptValue, | 91 DataTypeSerializedScriptValue, |
92 DataTypeString, | 92 DataTypeString, |
93 DataTypeBlob, | 93 DataTypeBlob, |
94 DataTypeArrayBuffer | 94 DataTypeArrayBuffer |
95 }; | 95 }; |
96 DataType dataType() const { return m_dataType; } | 96 DataType dataType() const { return m_dataType; } |
97 ScriptValue dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptV
alue); return m_dataAsScriptValue; } | 97 ScriptValue dataAsScriptValue() const { ASSERT(m_dataType == DataTypeScriptV
alue); return m_dataAsScriptValue; } |
98 SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataTy
pe == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue.get()
; } | 98 SerializedScriptValue* dataAsSerializedScriptValue() const { ASSERT(m_dataTy
pe == DataTypeSerializedScriptValue); return m_dataAsSerializedScriptValue.get()
; } |
99 String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m
_dataAsString; } | 99 String dataAsString() const { ASSERT(m_dataType == DataTypeString); return m
_dataAsString; } |
100 Blob* dataAsBlob() const { ASSERT(m_dataType == DataTypeBlob); return m_data
AsBlob.get(); } | 100 Blob* dataAsBlob() const { ASSERT(m_dataType == DataTypeBlob); return m_data
AsBlob.get(); } |
101 DOMArrayBuffer* dataAsArrayBuffer() const { ASSERT(m_dataType == DataTypeArr
ayBuffer); return m_dataAsArrayBuffer.get(); } | 101 DOMArrayBuffer* dataAsArrayBuffer() const { ASSERT(m_dataType == DataTypeArr
ayBuffer); return m_dataAsArrayBuffer.get(); } |
102 | 102 |
103 void setSerializedData(PassRefPtr<SerializedScriptValue> data) | 103 void setSerializedData(PassRefPtr<SerializedScriptValue> data) |
104 { | 104 { |
105 ASSERT(!m_dataAsSerializedScriptValue); | 105 ASSERT(!m_dataAsSerializedScriptValue); |
106 m_dataAsSerializedScriptValue = data; | 106 m_dataAsSerializedScriptValue = data; |
107 } | 107 } |
108 | 108 |
109 void entangleMessagePorts(ExecutionContext*); | 109 void entangleMessagePorts(ExecutionContext*); |
110 | 110 |
111 DECLARE_VIRTUAL_TRACE(); | 111 DECLARE_VIRTUAL_TRACE(); |
112 | 112 |
113 virtual v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const Wrapp
erTypeInfo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; | 113 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; |
114 | 114 |
115 private: | 115 private: |
116 MessageEvent(); | 116 MessageEvent(); |
117 MessageEvent(const AtomicString&, const MessageEventInit&); | 117 MessageEvent(const AtomicString&, const MessageEventInit&); |
118 MessageEvent(const String& origin, const String& lastEventId, PassRefPtrWill
BeRawPtr<EventTarget> source, MessagePortArray*); | 118 MessageEvent(const String& origin, const String& lastEventId, PassRefPtrWill
BeRawPtr<EventTarget> source, MessagePortArray*); |
119 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, MessagePor
tArray*); | 119 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, MessagePor
tArray*); |
120 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr
<MessagePortChannelArray>); | 120 MessageEvent(PassRefPtr<SerializedScriptValue> data, const String& origin, c
onst String& lastEventId, PassRefPtrWillBeRawPtr<EventTarget> source, PassOwnPtr
<MessagePortChannelArray>); |
121 | 121 |
122 MessageEvent(const String& data, const String& origin); | 122 MessageEvent(const String& data, const String& origin); |
123 MessageEvent(Blob* data, const String& origin); | 123 MessageEvent(Blob* data, const String& origin); |
(...skipping 11 matching lines...) Expand all Loading... |
135 // m_ports are the MessagePorts in an engtangled state, and m_channels are | 135 // m_ports are the MessagePorts in an engtangled state, and m_channels are |
136 // the MessageChannels in a disentangled state. Only one of them can be | 136 // the MessageChannels in a disentangled state. Only one of them can be |
137 // non-empty at a time. entangleMessagePorts() moves between the states. | 137 // non-empty at a time. entangleMessagePorts() moves between the states. |
138 PersistentWillBeMember<MessagePortArray> m_ports; | 138 PersistentWillBeMember<MessagePortArray> m_ports; |
139 OwnPtr<MessagePortChannelArray> m_channels; | 139 OwnPtr<MessagePortChannelArray> m_channels; |
140 }; | 140 }; |
141 | 141 |
142 } // namespace blink | 142 } // namespace blink |
143 | 143 |
144 #endif // MessageEvent_h | 144 #endif // MessageEvent_h |
OLD | NEW |