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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 return; | 190 return; |
191 | 191 |
192 RefPtr<SerializedScriptValue> message; | 192 RefPtr<SerializedScriptValue> message; |
193 OwnPtr<MessagePortChannelArray> channels; | 193 OwnPtr<MessagePortChannelArray> channels; |
194 while (m_entangledChannel && tryGetMessageFrom(*m_entangledChannel, message,
channels)) { | 194 while (m_entangledChannel && tryGetMessageFrom(*m_entangledChannel, message,
channels)) { |
195 // close() in Worker onmessage handler should prevent next message from
dispatching. | 195 // close() in Worker onmessage handler should prevent next message from
dispatching. |
196 if (executionContext()->isWorkerGlobalScope() && toWorkerGlobalScope(exe
cutionContext())->isClosing()) | 196 if (executionContext()->isWorkerGlobalScope() && toWorkerGlobalScope(exe
cutionContext())->isClosing()) |
197 return; | 197 return; |
198 | 198 |
199 OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*executionCo
ntext(), channels.release()); | 199 OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*executionCo
ntext(), channels.release()); |
200 RefPtr<Event> evt = MessageEvent::create(ports.release(), message.releas
e()); | 200 RefPtrWillBeRawPtr<Event> evt = MessageEvent::create(ports.release(), me
ssage.release()); |
201 | 201 |
202 dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION); | 202 dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION); |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 bool MessagePort::hasPendingActivity() const | 206 bool MessagePort::hasPendingActivity() const |
207 { | 207 { |
208 // The spec says that entangled message ports should always be treated as if
they have a strong reference. | 208 // The spec says that entangled message ports should always be treated as if
they have a strong reference. |
209 // We'll also stipulate that the queue needs to be open (if the app drops it
s reference to the port before start()-ing it, then it's not really entangled as
it's unreachable). | 209 // We'll also stipulate that the queue needs to be open (if the app drops it
s reference to the port before start()-ing it, then it's not really entangled as
it's unreachable). |
210 return m_started && isEntangled(); | 210 return m_started && isEntangled(); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 OwnPtr<MessagePortArray> portArray = adoptPtr(new MessagePortArray(channels-
>size())); | 250 OwnPtr<MessagePortArray> portArray = adoptPtr(new MessagePortArray(channels-
>size())); |
251 for (unsigned i = 0; i < channels->size(); ++i) { | 251 for (unsigned i = 0; i < channels->size(); ++i) { |
252 RefPtr<MessagePort> port = MessagePort::create(context); | 252 RefPtr<MessagePort> port = MessagePort::create(context); |
253 port->entangle((*channels)[i].release()); | 253 port->entangle((*channels)[i].release()); |
254 (*portArray)[i] = port.release(); | 254 (*portArray)[i] = port.release(); |
255 } | 255 } |
256 return portArray.release(); | 256 return portArray.release(); |
257 } | 257 } |
258 | 258 |
259 } // namespace WebCore | 259 } // namespace WebCore |
OLD | NEW |