OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 MessagePortChannelArray channels = | 80 MessagePortChannelArray channels = |
81 MessagePort::disentanglePorts(scriptState->getExecutionContext(), ports, | 81 MessagePort::disentanglePorts(scriptState->getExecutionContext(), ports, |
82 exceptionState); | 82 exceptionState); |
83 if (exceptionState.hadException()) | 83 if (exceptionState.hadException()) |
84 return; | 84 return; |
85 | 85 |
86 WebString messageString = message->toWireString(); | 86 WebString messageString = message->toWireString(); |
87 WebMessagePortChannelArray webChannels = | 87 WebMessagePortChannelArray webChannels = |
88 toWebMessagePortChannelArray(std::move(channels)); | 88 toWebMessagePortChannelArray(std::move(channels)); |
89 m_entangledChannel->postMessage(messageString, std::move(webChannels)); | 89 WebVector<mojo::ScopedHandle> handles; |
| 90 m_entangledChannel->postMessage(messageString, std::move(webChannels), |
| 91 std::move(handles)); |
90 } | 92 } |
91 | 93 |
92 // static | 94 // static |
93 WebMessagePortChannelArray MessagePort::toWebMessagePortChannelArray( | 95 WebMessagePortChannelArray MessagePort::toWebMessagePortChannelArray( |
94 MessagePortChannelArray channels) { | 96 MessagePortChannelArray channels) { |
95 WebMessagePortChannelArray webChannels(channels.size()); | 97 WebMessagePortChannelArray webChannels(channels.size()); |
96 for (size_t i = 0; i < channels.size(); ++i) | 98 for (size_t i = 0; i < channels.size(); ++i) |
97 webChannels[i] = std::move(channels[i]); | 99 webChannels[i] = std::move(channels[i]); |
98 return webChannels; | 100 return webChannels; |
99 } | 101 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 164 |
163 const AtomicString& MessagePort::interfaceName() const { | 165 const AtomicString& MessagePort::interfaceName() const { |
164 return EventTargetNames::MessagePort; | 166 return EventTargetNames::MessagePort; |
165 } | 167 } |
166 | 168 |
167 static bool tryGetMessageFrom(WebMessagePortChannel& webChannel, | 169 static bool tryGetMessageFrom(WebMessagePortChannel& webChannel, |
168 RefPtr<SerializedScriptValue>& message, | 170 RefPtr<SerializedScriptValue>& message, |
169 MessagePortChannelArray& channels) { | 171 MessagePortChannelArray& channels) { |
170 WebString messageString; | 172 WebString messageString; |
171 WebMessagePortChannelArray webChannels; | 173 WebMessagePortChannelArray webChannels; |
172 if (!webChannel.tryGetMessage(&messageString, webChannels)) | 174 WebVector<mojo::ScopedHandle> handles; |
| 175 if (!webChannel.tryGetMessage(&messageString, webChannels, handles)) |
173 return false; | 176 return false; |
174 | 177 |
175 if (webChannels.size()) { | 178 if (webChannels.size()) { |
176 channels.resize(webChannels.size()); | 179 channels.resize(webChannels.size()); |
177 for (size_t i = 0; i < webChannels.size(); ++i) | 180 for (size_t i = 0; i < webChannels.size(); ++i) |
178 channels[i] = std::move(webChannels[i]); | 181 channels[i] = std::move(webChannels[i]); |
179 } | 182 } |
180 message = SerializedScriptValue::create(messageString); | 183 message = SerializedScriptValue::create(messageString); |
181 return true; | 184 return true; |
182 } | 185 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 } | 290 } |
288 return portArray; | 291 return portArray; |
289 } | 292 } |
290 | 293 |
291 DEFINE_TRACE(MessagePort) { | 294 DEFINE_TRACE(MessagePort) { |
292 ContextLifecycleObserver::trace(visitor); | 295 ContextLifecycleObserver::trace(visitor); |
293 EventTargetWithInlineData::trace(visitor); | 296 EventTargetWithInlineData::trace(visitor); |
294 } | 297 } |
295 | 298 |
296 } // namespace blink | 299 } // namespace blink |
OLD | NEW |