| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 OwnPtr<MessagePortChannelArray> channels; | 163 OwnPtr<MessagePortChannelArray> channels; |
| 164 while (m_entangledChannel && m_entangledChannel->tryGetMessageFromRemote(mes
sage, channels)) { | 164 while (m_entangledChannel && m_entangledChannel->tryGetMessageFromRemote(mes
sage, channels)) { |
| 165 | 165 |
| 166 // close() in Worker onmessage handler should prevent next message from
dispatching. | 166 // close() in Worker onmessage handler should prevent next message from
dispatching. |
| 167 if (m_scriptExecutionContext->isWorkerGlobalScope() && toWorkerGlobalSco
pe(m_scriptExecutionContext)->isClosing()) | 167 if (m_scriptExecutionContext->isWorkerGlobalScope() && toWorkerGlobalSco
pe(m_scriptExecutionContext)->isClosing()) |
| 168 return; | 168 return; |
| 169 | 169 |
| 170 OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_scriptExe
cutionContext, channels.release()); | 170 OwnPtr<MessagePortArray> ports = MessagePort::entanglePorts(*m_scriptExe
cutionContext, channels.release()); |
| 171 RefPtr<Event> evt = MessageEvent::create(ports.release(), message.releas
e()); | 171 RefPtr<Event> evt = MessageEvent::create(ports.release(), message.releas
e()); |
| 172 | 172 |
| 173 dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION_STATE); | 173 dispatchEvent(evt.release(), ASSERT_NO_EXCEPTION); |
| 174 } | 174 } |
| 175 } | 175 } |
| 176 | 176 |
| 177 bool MessagePort::hasPendingActivity() | 177 bool MessagePort::hasPendingActivity() |
| 178 { | 178 { |
| 179 // The spec says that entangled message ports should always be treated as if
they have a strong reference. | 179 // The spec says that entangled message ports should always be treated as if
they have a strong reference. |
| 180 // 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). | 180 // 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). |
| 181 if (m_started && m_entangledChannel && m_entangledChannel->hasPendingActivit
y()) | 181 if (m_started && m_entangledChannel && m_entangledChannel->hasPendingActivit
y()) |
| 182 return true; | 182 return true; |
| 183 if (isEntangled() && !locallyEntangledPort()) | 183 if (isEntangled() && !locallyEntangledPort()) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 { | 235 { |
| 236 return &m_eventTargetData; | 236 return &m_eventTargetData; |
| 237 } | 237 } |
| 238 | 238 |
| 239 EventTargetData* MessagePort::ensureEventTargetData() | 239 EventTargetData* MessagePort::ensureEventTargetData() |
| 240 { | 240 { |
| 241 return &m_eventTargetData; | 241 return &m_eventTargetData; |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace WebCore | 244 } // namespace WebCore |
| OLD | NEW |