| 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 "bindings/core/v8/SerializedScriptValue.h" | 7 #include "bindings/core/v8/SerializedScriptValue.h" |
| 8 #include "core/workers/InProcessWorkerObjectProxy.h" | 8 #include "core/workers/InProcessWorkerObjectProxy.h" |
| 9 #include "core/workers/WorkerThreadStartupData.h" | 9 #include "core/workers/WorkerThreadStartupData.h" |
| 10 #include "modules/EventTargetModules.h" | 10 #include "modules/EventTargetModules.h" |
| 11 #include "modules/compositorworker/CompositorWorkerThread.h" | 11 #include "modules/compositorworker/CompositorWorkerThread.h" |
| 12 #include "wtf/AutoReset.h" |
| 12 #include <memory> | 13 #include <memory> |
| 13 | 14 |
| 14 namespace blink { | 15 namespace blink { |
| 15 | 16 |
| 16 CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::create(CompositorWorke
rThread* thread, std::unique_ptr<WorkerThreadStartupData> startupData, double ti
meOrigin) | 17 CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::create(CompositorWorke
rThread* thread, std::unique_ptr<WorkerThreadStartupData> startupData, double ti
meOrigin) |
| 17 { | 18 { |
| 18 // Note: startupData is finalized on return. After the relevant parts has be
en | 19 // Note: startupData is finalized on return. After the relevant parts has be
en |
| 19 // passed along to the created 'context'. | 20 // passed along to the created 'context'. |
| 20 CompositorWorkerGlobalScope* context = new CompositorWorkerGlobalScope(start
upData->m_scriptURL, startupData->m_userAgent, thread, timeOrigin, std::move(sta
rtupData->m_starterOriginPrivilegeData), startupData->m_workerClients.release())
; | 21 CompositorWorkerGlobalScope* context = new CompositorWorkerGlobalScope(start
upData->m_scriptURL, startupData->m_userAgent, thread, timeOrigin, std::move(sta
rtupData->m_starterOriginPrivilegeData), startupData->m_workerClients.release())
; |
| 21 context->applyContentSecurityPolicyFromVector(*startupData->m_contentSecurit
yPolicyHeaders); | 22 context->applyContentSecurityPolicyFromVector(*startupData->m_contentSecurit
yPolicyHeaders); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return m_callbackCollection.registerCallback(callback); | 66 return m_callbackCollection.registerCallback(callback); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void CompositorWorkerGlobalScope::cancelAnimationFrame(int id) | 69 void CompositorWorkerGlobalScope::cancelAnimationFrame(int id) |
| 69 { | 70 { |
| 70 m_callbackCollection.cancelCallback(id); | 71 m_callbackCollection.cancelCallback(id); |
| 71 } | 72 } |
| 72 | 73 |
| 73 bool CompositorWorkerGlobalScope::executeAnimationFrameCallbacks(double highResT
imeMs) | 74 bool CompositorWorkerGlobalScope::executeAnimationFrameCallbacks(double highResT
imeMs) |
| 74 { | 75 { |
| 75 TemporaryChange<bool> temporaryChange(m_executingAnimationFrameCallbacks, tr
ue); | 76 AutoReset<bool> temporaryChange(&m_executingAnimationFrameCallbacks, true); |
| 76 m_callbackCollection.executeCallbacks(highResTimeMs, highResTimeMs); | 77 m_callbackCollection.executeCallbacks(highResTimeMs, highResTimeMs); |
| 77 return !m_callbackCollection.isEmpty(); | 78 return !m_callbackCollection.isEmpty(); |
| 78 } | 79 } |
| 79 | 80 |
| 80 CompositorWorkerThread* CompositorWorkerGlobalScope::thread() const | 81 CompositorWorkerThread* CompositorWorkerGlobalScope::thread() const |
| 81 { | 82 { |
| 82 return static_cast<CompositorWorkerThread*>(WorkerGlobalScope::thread()); | 83 return static_cast<CompositorWorkerThread*>(WorkerGlobalScope::thread()); |
| 83 } | 84 } |
| 84 | 85 |
| 85 } // namespace blink | 86 } // namespace blink |
| OLD | NEW |