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