| 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, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 m_dataAsSerializedScriptValue = data; | 141 m_dataAsSerializedScriptValue = data; |
| 142 m_origin = origin; | 142 m_origin = origin; |
| 143 m_lastEventId = lastEventId; | 143 m_lastEventId = lastEventId; |
| 144 m_source = source; | 144 m_source = source; |
| 145 m_ports = ports; | 145 m_ports = ports; |
| 146 | 146 |
| 147 if (m_dataAsSerializedScriptValue) | 147 if (m_dataAsSerializedScriptValue) |
| 148 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC
ontext(); | 148 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC
ontext(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 // FIXME: Remove this when we have custom ObjC binding support. | |
| 152 SerializedScriptValue* MessageEvent::data() const | |
| 153 { | |
| 154 // WebSocket is not exposed in ObjC bindings, thus the data type should alwa
ys be SerializedScriptValue. | |
| 155 ASSERT(m_dataType == DataTypeSerializedScriptValue); | |
| 156 return m_dataAsSerializedScriptValue.get(); | |
| 157 } | |
| 158 | |
| 159 MessagePort* MessageEvent::messagePort() | |
| 160 { | |
| 161 if (!m_ports) | |
| 162 return 0; | |
| 163 ASSERT(m_ports->size() == 1); | |
| 164 return (*m_ports)[0].get(); | |
| 165 } | |
| 166 | |
| 167 void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bo
ol cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, con
st String& lastEventId, DOMWindow* source, MessagePort* port) | |
| 168 { | |
| 169 OwnPtr<MessagePortArray> ports; | |
| 170 if (port) { | |
| 171 ports = adoptPtr(new MessagePortArray); | |
| 172 ports->append(port); | |
| 173 } | |
| 174 initMessageEvent(type, canBubble, cancelable, data, origin, lastEventId, sou
rce, ports.release()); | |
| 175 } | |
| 176 | |
| 177 const AtomicString& MessageEvent::interfaceName() const | 151 const AtomicString& MessageEvent::interfaceName() const |
| 178 { | 152 { |
| 179 return eventNames().interfaceForMessageEvent; | 153 return eventNames().interfaceForMessageEvent; |
| 180 } | 154 } |
| 181 | 155 |
| 182 } // namespace WebCore | 156 } // namespace WebCore |
| OLD | NEW |