| 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 12 matching lines...) Expand all Loading... |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 * | 24 * |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/dom/MessagePort.h" | 28 #include "core/dom/MessagePort.h" |
| 29 | 29 |
| 30 #include "bindings/core/v8/ExceptionState.h" | 30 #include "bindings/core/v8/ExceptionState.h" |
| 31 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 31 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 32 #include "bindings/core/v8/SerializedScriptValue.h" | 32 #include "bindings/core/v8/SerializedScriptValue.h" |
| 33 #include "bindings/core/v8/SerializedScriptValueFactory.h" |
| 33 #include "core/dom/CrossThreadTask.h" | 34 #include "core/dom/CrossThreadTask.h" |
| 34 #include "core/dom/ExceptionCode.h" | 35 #include "core/dom/ExceptionCode.h" |
| 35 #include "core/dom/ExecutionContext.h" | 36 #include "core/dom/ExecutionContext.h" |
| 36 #include "core/events/MessageEvent.h" | 37 #include "core/events/MessageEvent.h" |
| 37 #include "core/frame/LocalDOMWindow.h" | 38 #include "core/frame/LocalDOMWindow.h" |
| 38 #include "core/workers/WorkerGlobalScope.h" | 39 #include "core/workers/WorkerGlobalScope.h" |
| 39 #include "public/platform/WebString.h" | 40 #include "public/platform/WebString.h" |
| 40 #include "wtf/Functional.h" | 41 #include "wtf/Functional.h" |
| 41 #include "wtf/text/AtomicString.h" | 42 #include "wtf/text/AtomicString.h" |
| 42 | 43 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 WebString messageString; | 171 WebString messageString; |
| 171 WebMessagePortChannelArray webChannels; | 172 WebMessagePortChannelArray webChannels; |
| 172 if (!webChannel.tryGetMessage(&messageString, webChannels)) | 173 if (!webChannel.tryGetMessage(&messageString, webChannels)) |
| 173 return false; | 174 return false; |
| 174 | 175 |
| 175 if (webChannels.size()) { | 176 if (webChannels.size()) { |
| 176 channels = adoptPtr(new MessagePortChannelArray(webChannels.size())); | 177 channels = adoptPtr(new MessagePortChannelArray(webChannels.size())); |
| 177 for (size_t i = 0; i < webChannels.size(); ++i) | 178 for (size_t i = 0; i < webChannels.size(); ++i) |
| 178 (*channels)[i] = adoptPtr(webChannels[i]); | 179 (*channels)[i] = adoptPtr(webChannels[i]); |
| 179 } | 180 } |
| 180 message = SerializedScriptValue::createFromWire(messageString); | 181 message = SerializedScriptValueFactory::factory().createFromWire(messageStri
ng); |
| 181 return true; | 182 return true; |
| 182 } | 183 } |
| 183 | 184 |
| 184 void MessagePort::dispatchMessages() | 185 void MessagePort::dispatchMessages() |
| 185 { | 186 { |
| 186 // Because close() doesn't cancel any in flight calls to dispatchMessages()
we need to check if the port is still open before dispatch. | 187 // Because close() doesn't cancel any in flight calls to dispatchMessages()
we need to check if the port is still open before dispatch. |
| 187 if (m_closed) | 188 if (m_closed) |
| 188 return; | 189 return; |
| 189 | 190 |
| 190 // Messages for contexts that are not fully active get dispatched too, but J
SAbstractEventListener::handleEvent() doesn't call handlers for these. | 191 // Messages for contexts that are not fully active get dispatched too, but J
SAbstractEventListener::handleEvent() doesn't call handlers for these. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 OwnPtrWillBeRawPtr<MessagePortArray> portArray = adoptPtrWillBeNoop(new Mess
agePortArray(channels->size())); | 254 OwnPtrWillBeRawPtr<MessagePortArray> portArray = adoptPtrWillBeNoop(new Mess
agePortArray(channels->size())); |
| 254 for (unsigned i = 0; i < channels->size(); ++i) { | 255 for (unsigned i = 0; i < channels->size(); ++i) { |
| 255 RefPtrWillBeRawPtr<MessagePort> port = MessagePort::create(context); | 256 RefPtrWillBeRawPtr<MessagePort> port = MessagePort::create(context); |
| 256 port->entangle((*channels)[i].release()); | 257 port->entangle((*channels)[i].release()); |
| 257 (*portArray)[i] = port.release(); | 258 (*portArray)[i] = port.release(); |
| 258 } | 259 } |
| 259 return portArray.release(); | 260 return portArray.release(); |
| 260 } | 261 } |
| 261 | 262 |
| 262 } // namespace blink | 263 } // namespace blink |
| OLD | NEW |