| 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 "modules/compositorworker/CompositorWorkerGlobalScope.h" | 5 #include "modules/compositorworker/CompositorWorkerGlobalScope.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "bindings/core/v8/ScriptState.h" | 8 #include "bindings/core/v8/ScriptState.h" |
| 9 #include "bindings/core/v8/SerializedScriptValue.h" | 9 #include "bindings/core/v8/SerializedScriptValue.h" |
| 10 #include "core/dom/CompositorWorkerProxyClient.h" | 10 #include "core/dom/CompositorWorkerProxyClient.h" |
| 11 #include "core/dom/ExecutionContext.h" | |
| 12 #include "core/workers/InProcessWorkerObjectProxy.h" | 11 #include "core/workers/InProcessWorkerObjectProxy.h" |
| 13 #include "core/workers/WorkerThreadStartupData.h" | 12 #include "core/workers/WorkerThreadStartupData.h" |
| 14 #include "modules/EventTargetModules.h" | 13 #include "modules/EventTargetModules.h" |
| 15 #include "modules/compositorworker/CompositorWorkerThread.h" | 14 #include "modules/compositorworker/CompositorWorkerThread.h" |
| 16 #include "platform/wtf/AutoReset.h" | 15 #include "platform/wtf/AutoReset.h" |
| 17 | 16 |
| 18 namespace blink { | 17 namespace blink { |
| 19 | 18 |
| 20 CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::Create( | 19 CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::Create( |
| 21 CompositorWorkerThread* thread, | 20 CompositorWorkerThread* thread, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return EventTargetNames::CompositorWorkerGlobalScope; | 69 return EventTargetNames::CompositorWorkerGlobalScope; |
| 71 } | 70 } |
| 72 | 71 |
| 73 void CompositorWorkerGlobalScope::postMessage( | 72 void CompositorWorkerGlobalScope::postMessage( |
| 74 ScriptState* script_state, | 73 ScriptState* script_state, |
| 75 PassRefPtr<SerializedScriptValue> message, | 74 PassRefPtr<SerializedScriptValue> message, |
| 76 const MessagePortArray& ports, | 75 const MessagePortArray& ports, |
| 77 ExceptionState& exception_state) { | 76 ExceptionState& exception_state) { |
| 78 // Disentangle the port in preparation for sending it to the remote context. | 77 // Disentangle the port in preparation for sending it to the remote context. |
| 79 MessagePortChannelArray channels = MessagePort::DisentanglePorts( | 78 MessagePortChannelArray channels = MessagePort::DisentanglePorts( |
| 80 ExecutionContext::From(script_state), ports, exception_state); | 79 script_state->GetExecutionContext(), ports, exception_state); |
| 81 if (exception_state.HadException()) | 80 if (exception_state.HadException()) |
| 82 return; | 81 return; |
| 83 WorkerObjectProxy().PostMessageToWorkerObject(std::move(message), | 82 WorkerObjectProxy().PostMessageToWorkerObject(std::move(message), |
| 84 std::move(channels)); | 83 std::move(channels)); |
| 85 } | 84 } |
| 86 | 85 |
| 87 int CompositorWorkerGlobalScope::requestAnimationFrame( | 86 int CompositorWorkerGlobalScope::requestAnimationFrame( |
| 88 FrameRequestCallback* callback) { | 87 FrameRequestCallback* callback) { |
| 89 const bool should_signal = | 88 const bool should_signal = |
| 90 !executing_animation_frame_callbacks_ && callback_collection_.IsEmpty(); | 89 !executing_animation_frame_callbacks_ && callback_collection_.IsEmpty(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 103 callback_collection_.ExecuteCallbacks(high_res_time_ms, high_res_time_ms); | 102 callback_collection_.ExecuteCallbacks(high_res_time_ms, high_res_time_ms); |
| 104 return !callback_collection_.IsEmpty(); | 103 return !callback_collection_.IsEmpty(); |
| 105 } | 104 } |
| 106 | 105 |
| 107 InProcessWorkerObjectProxy& CompositorWorkerGlobalScope::WorkerObjectProxy() | 106 InProcessWorkerObjectProxy& CompositorWorkerGlobalScope::WorkerObjectProxy() |
| 108 const { | 107 const { |
| 109 return static_cast<CompositorWorkerThread*>(GetThread())->WorkerObjectProxy(); | 108 return static_cast<CompositorWorkerThread*>(GetThread())->WorkerObjectProxy(); |
| 110 } | 109 } |
| 111 | 110 |
| 112 } // namespace blink | 111 } // namespace blink |
| OLD | NEW |