| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 if (initializer.hasData()) | 53 if (initializer.hasData()) |
| 54 m_dataAsScriptValue = initializer.data(); | 54 m_dataAsScriptValue = initializer.data(); |
| 55 if (initializer.hasOrigin()) | 55 if (initializer.hasOrigin()) |
| 56 m_origin = initializer.origin(); | 56 m_origin = initializer.origin(); |
| 57 if (initializer.hasLastEventId()) | 57 if (initializer.hasLastEventId()) |
| 58 m_lastEventId = initializer.lastEventId(); | 58 m_lastEventId = initializer.lastEventId(); |
| 59 if (initializer.hasSource() && isValidSource(initializer.source())) | 59 if (initializer.hasSource() && isValidSource(initializer.source())) |
| 60 m_source = initializer.source(); | 60 m_source = initializer.source(); |
| 61 if (initializer.hasPorts()) | 61 if (initializer.hasPorts()) |
| 62 m_ports = new MessagePortArray(initializer.ports()); | 62 m_ports = new MessagePortArray(initializer.ports()); |
| 63 ASSERT(isValidSource(m_source.get())); | 63 DCHECK(isValidSource(m_source.get())); |
| 64 } | 64 } |
| 65 | 65 |
| 66 MessageEvent::MessageEvent(const String& origin, const String& lastEventId, Even
tTarget* source, MessagePortArray* ports, const String& suborigin) | 66 MessageEvent::MessageEvent(const String& origin, const String& lastEventId, Even
tTarget* source, MessagePortArray* ports, const String& suborigin) |
| 67 : Event(EventTypeNames::message, false, false) | 67 : Event(EventTypeNames::message, false, false) |
| 68 , m_dataType(DataTypeScriptValue) | 68 , m_dataType(DataTypeScriptValue) |
| 69 , m_origin(origin) | 69 , m_origin(origin) |
| 70 , m_lastEventId(lastEventId) | 70 , m_lastEventId(lastEventId) |
| 71 , m_source(source) | 71 , m_source(source) |
| 72 , m_ports(ports) | 72 , m_ports(ports) |
| 73 { | 73 { |
| 74 ASSERT(isValidSource(m_source.get())); | 74 DCHECK(isValidSource(m_source.get())); |
| 75 } | 75 } |
| 76 | 76 |
| 77 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String&
origin, const String& lastEventId, EventTarget* source, MessagePortArray* ports
, const String& suborigin) | 77 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String&
origin, const String& lastEventId, EventTarget* source, MessagePortArray* ports
, const String& suborigin) |
| 78 : Event(EventTypeNames::message, false, false) | 78 : Event(EventTypeNames::message, false, false) |
| 79 , m_dataType(DataTypeSerializedScriptValue) | 79 , m_dataType(DataTypeSerializedScriptValue) |
| 80 , m_dataAsSerializedScriptValue(data) | 80 , m_dataAsSerializedScriptValue(data) |
| 81 , m_origin(origin) | 81 , m_origin(origin) |
| 82 , m_lastEventId(lastEventId) | 82 , m_lastEventId(lastEventId) |
| 83 , m_source(source) | 83 , m_source(source) |
| 84 , m_ports(ports) | 84 , m_ports(ports) |
| 85 { | 85 { |
| 86 if (m_dataAsSerializedScriptValue) | 86 if (m_dataAsSerializedScriptValue) |
| 87 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC
ontext(); | 87 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC
ontext(); |
| 88 ASSERT(isValidSource(m_source.get())); | 88 DCHECK(isValidSource(m_source.get())); |
| 89 } | 89 } |
| 90 | 90 |
| 91 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String&
origin, const String& lastEventId, EventTarget* source, std::unique_ptr<Message
PortChannelArray> channels, const String& suborigin) | 91 MessageEvent::MessageEvent(PassRefPtr<SerializedScriptValue> data, const String&
origin, const String& lastEventId, EventTarget* source, std::unique_ptr<Message
PortChannelArray> channels, const String& suborigin) |
| 92 : Event(EventTypeNames::message, false, false) | 92 : Event(EventTypeNames::message, false, false) |
| 93 , m_dataType(DataTypeSerializedScriptValue) | 93 , m_dataType(DataTypeSerializedScriptValue) |
| 94 , m_dataAsSerializedScriptValue(data) | 94 , m_dataAsSerializedScriptValue(data) |
| 95 , m_origin(origin) | 95 , m_origin(origin) |
| 96 , m_lastEventId(lastEventId) | 96 , m_lastEventId(lastEventId) |
| 97 , m_source(source) | 97 , m_source(source) |
| 98 , m_channels(std::move(channels)) | 98 , m_channels(std::move(channels)) |
| 99 , m_suborigin(suborigin) | 99 , m_suborigin(suborigin) |
| 100 { | 100 { |
| 101 if (m_dataAsSerializedScriptValue) | 101 if (m_dataAsSerializedScriptValue) |
| 102 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC
ontext(); | 102 m_dataAsSerializedScriptValue->registerMemoryAllocatedWithCurrentScriptC
ontext(); |
| 103 ASSERT(isValidSource(m_source.get())); | 103 DCHECK(isValidSource(m_source.get())); |
| 104 } | 104 } |
| 105 | 105 |
| 106 MessageEvent::MessageEvent(const String& data, const String& origin, const Strin
g& suborigin) | 106 MessageEvent::MessageEvent(const String& data, const String& origin, const Strin
g& suborigin) |
| 107 : Event(EventTypeNames::message, false, false) | 107 : Event(EventTypeNames::message, false, false) |
| 108 , m_dataType(DataTypeString) | 108 , m_dataType(DataTypeString) |
| 109 , m_dataAsString(data) | 109 , m_dataAsString(data) |
| 110 , m_origin(origin) | 110 , m_origin(origin) |
| 111 { | 111 { |
| 112 } | 112 } |
| 113 | 113 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 break; | 232 break; |
| 233 case MessageEvent::DataTypeArrayBuffer: | 233 case MessageEvent::DataTypeArrayBuffer: |
| 234 V8PrivateProperty::getMessageEventCachedData(isolate).set(isolate->GetCu
rrentContext(), wrapper, toV8(dataAsArrayBuffer(), wrapper, isolate)); | 234 V8PrivateProperty::getMessageEventCachedData(isolate).set(isolate->GetCu
rrentContext(), wrapper, toV8(dataAsArrayBuffer(), wrapper, isolate)); |
| 235 break; | 235 break; |
| 236 } | 236 } |
| 237 | 237 |
| 238 return wrapper; | 238 return wrapper; |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace blink | 241 } // namespace blink |
| OLD | NEW |