| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/workers/InProcessWorkerBase.h" | 5 #include "core/workers/InProcessWorkerBase.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptState.h" | 9 #include "bindings/core/v8/ScriptState.h" |
| 10 #include "core/events/MessageEvent.h" | 10 #include "core/events/MessageEvent.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 return; | 26 return; |
| 27 m_contextProxy->parentObjectDestroyed(); | 27 m_contextProxy->parentObjectDestroyed(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void InProcessWorkerBase::postMessage(ScriptState* scriptState, | 30 void InProcessWorkerBase::postMessage(ScriptState* scriptState, |
| 31 PassRefPtr<SerializedScriptValue> message, | 31 PassRefPtr<SerializedScriptValue> message, |
| 32 const MessagePortArray& ports, | 32 const MessagePortArray& ports, |
| 33 ExceptionState& exceptionState) { | 33 ExceptionState& exceptionState) { |
| 34 DCHECK(m_contextProxy); | 34 DCHECK(m_contextProxy); |
| 35 // Disentangle the port in preparation for sending it to the remote context. | 35 // Disentangle the port in preparation for sending it to the remote context. |
| 36 std::unique_ptr<MessagePortChannelArray> channels = | 36 MessagePortChannelArray channels = |
| 37 MessagePort::disentanglePorts(scriptState->getExecutionContext(), ports, | 37 MessagePort::disentanglePorts(scriptState->getExecutionContext(), ports, |
| 38 exceptionState); | 38 exceptionState); |
| 39 if (exceptionState.hadException()) | 39 if (exceptionState.hadException()) |
| 40 return; | 40 return; |
| 41 m_contextProxy->postMessageToWorkerGlobalScope(std::move(message), | 41 m_contextProxy->postMessageToWorkerGlobalScope(std::move(message), |
| 42 std::move(channels)); | 42 std::move(channels)); |
| 43 } | 43 } |
| 44 | 44 |
| 45 bool InProcessWorkerBase::initialize(ExecutionContext* context, | 45 bool InProcessWorkerBase::initialize(ExecutionContext* context, |
| 46 const String& url, | 46 const String& url, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 m_scriptLoader->script()); | 107 m_scriptLoader->script()); |
| 108 } | 108 } |
| 109 m_scriptLoader = nullptr; | 109 m_scriptLoader = nullptr; |
| 110 } | 110 } |
| 111 | 111 |
| 112 DEFINE_TRACE(InProcessWorkerBase) { | 112 DEFINE_TRACE(InProcessWorkerBase) { |
| 113 AbstractWorker::trace(visitor); | 113 AbstractWorker::trace(visitor); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace blink | 116 } // namespace blink |
| OLD | NEW |