| 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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 m_lastEventId = lastEventId; | 191 m_lastEventId = lastEventId; |
| 192 m_source = source; | 192 m_source = source; |
| 193 m_ports = ports; | 193 m_ports = ports; |
| 194 m_suborigin = ""; | 194 m_suborigin = ""; |
| 195 | 195 |
| 196 if (m_dataAsSerializedScriptValue) | 196 if (m_dataAsSerializedScriptValue) |
| 197 m_dataAsSerializedScriptValue | 197 m_dataAsSerializedScriptValue |
| 198 ->registerMemoryAllocatedWithCurrentScriptContext(); | 198 ->registerMemoryAllocatedWithCurrentScriptContext(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 void MessageEvent::initMessageEvent(const AtomicString& type, |
| 202 bool canBubble, |
| 203 bool cancelable, |
| 204 const String& data, |
| 205 const String& origin, |
| 206 const String& lastEventId, |
| 207 EventTarget* source, |
| 208 MessagePortArray* ports) { |
| 209 if (isBeingDispatched()) |
| 210 return; |
| 211 |
| 212 initEvent(type, canBubble, cancelable); |
| 213 |
| 214 m_dataType = DataTypeString; |
| 215 m_dataAsString = data; |
| 216 m_origin = origin; |
| 217 m_lastEventId = lastEventId; |
| 218 m_source = source; |
| 219 m_ports = ports; |
| 220 m_suborigin = ""; |
| 221 } |
| 222 |
| 201 const AtomicString& MessageEvent::interfaceName() const { | 223 const AtomicString& MessageEvent::interfaceName() const { |
| 202 return EventNames::MessageEvent; | 224 return EventNames::MessageEvent; |
| 203 } | 225 } |
| 204 | 226 |
| 205 MessagePortArray MessageEvent::ports(bool& isNull) const { | 227 MessagePortArray MessageEvent::ports(bool& isNull) const { |
| 206 // TODO(bashi): Currently we return a copied array because the binding | 228 // TODO(bashi): Currently we return a copied array because the binding |
| 207 // layer could modify the content of the array while executing JS callbacks. | 229 // layer could modify the content of the array while executing JS callbacks. |
| 208 // Avoid copying once we can make sure that the binding layer won't | 230 // Avoid copying once we can make sure that the binding layer won't |
| 209 // modify the content. | 231 // modify the content. |
| 210 if (m_ports) { | 232 if (m_ports) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 V8PrivateProperty::getMessageEventCachedData(isolate).set( | 278 V8PrivateProperty::getMessageEventCachedData(isolate).set( |
| 257 isolate->GetCurrentContext(), wrapper, | 279 isolate->GetCurrentContext(), wrapper, |
| 258 ToV8(dataAsArrayBuffer(), wrapper, isolate)); | 280 ToV8(dataAsArrayBuffer(), wrapper, isolate)); |
| 259 break; | 281 break; |
| 260 } | 282 } |
| 261 | 283 |
| 262 return wrapper; | 284 return wrapper; |
| 263 } | 285 } |
| 264 | 286 |
| 265 } // namespace blink | 287 } // namespace blink |
| OLD | NEW |