Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Side by Side Diff: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerGlobalScope.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory>
13 12
14 namespace blink { 13 namespace blink {
15 14
16 CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::create(CompositorWorke rThread* thread, std::unique_ptr<WorkerThreadStartupData> startupData, double ti meOrigin) 15 CompositorWorkerGlobalScope* CompositorWorkerGlobalScope::create(CompositorWorke rThread* thread, PassOwnPtr<WorkerThreadStartupData> startupData, double timeOri gin)
17 { 16 {
18 // Note: startupData is finalized on return. After the relevant parts has be en 17 // Note: startupData is finalized on return. After the relevant parts has be en
19 // passed along to the created 'context'. 18 // 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()) ; 19 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); 20 context->applyContentSecurityPolicyFromVector(*startupData->m_contentSecurit yPolicyHeaders);
22 context->setAddressSpace(startupData->m_addressSpace); 21 context->setAddressSpace(startupData->m_addressSpace);
23 return context; 22 return context;
24 } 23 }
25 24
26 CompositorWorkerGlobalScope::CompositorWorkerGlobalScope(const KURL& url, const String& userAgent, CompositorWorkerThread* thread, double timeOrigin, std::uniqu e_ptr<SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* workerClients) 25 CompositorWorkerGlobalScope::CompositorWorkerGlobalScope(const KURL& url, const String& userAgent, CompositorWorkerThread* thread, double timeOrigin, PassOwnPtr <SecurityOrigin::PrivilegeData> starterOriginPrivilegeData, WorkerClients* worke rClients)
27 : WorkerGlobalScope(url, userAgent, thread, timeOrigin, std::move(starterOri ginPrivilegeData), workerClients) 26 : WorkerGlobalScope(url, userAgent, thread, timeOrigin, std::move(starterOri ginPrivilegeData), workerClients)
28 , m_executingAnimationFrameCallbacks(false) 27 , m_executingAnimationFrameCallbacks(false)
29 , m_callbackCollection(this) 28 , m_callbackCollection(this)
30 { 29 {
31 CompositorProxyClient::from(clients())->setGlobalScope(this); 30 CompositorProxyClient::from(clients())->setGlobalScope(this);
32 } 31 }
33 32
34 CompositorWorkerGlobalScope::~CompositorWorkerGlobalScope() 33 CompositorWorkerGlobalScope::~CompositorWorkerGlobalScope()
35 { 34 {
36 } 35 }
37 36
38 DEFINE_TRACE(CompositorWorkerGlobalScope) 37 DEFINE_TRACE(CompositorWorkerGlobalScope)
39 { 38 {
40 visitor->trace(m_callbackCollection); 39 visitor->trace(m_callbackCollection);
41 WorkerGlobalScope::trace(visitor); 40 WorkerGlobalScope::trace(visitor);
42 } 41 }
43 42
44 const AtomicString& CompositorWorkerGlobalScope::interfaceName() const 43 const AtomicString& CompositorWorkerGlobalScope::interfaceName() const
45 { 44 {
46 return EventTargetNames::CompositorWorkerGlobalScope; 45 return EventTargetNames::CompositorWorkerGlobalScope;
47 } 46 }
48 47
49 void CompositorWorkerGlobalScope::postMessage(ExecutionContext* executionContext , PassRefPtr<SerializedScriptValue> message, const MessagePortArray& ports, Exce ptionState& exceptionState) 48 void CompositorWorkerGlobalScope::postMessage(ExecutionContext* executionContext , PassRefPtr<SerializedScriptValue> message, const MessagePortArray& ports, Exce ptionState& exceptionState)
50 { 49 {
51 // Disentangle the port in preparation for sending it to the remote context. 50 // Disentangle the port in preparation for sending it to the remote context.
52 std::unique_ptr<MessagePortChannelArray> channels = MessagePort::disentangle Ports(executionContext, ports, exceptionState); 51 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(exe cutionContext, ports, exceptionState);
53 if (exceptionState.hadException()) 52 if (exceptionState.hadException())
54 return; 53 return;
55 thread()->workerObjectProxy().postMessageToWorkerObject(message, std::move(c hannels)); 54 thread()->workerObjectProxy().postMessageToWorkerObject(message, std::move(c hannels));
56 } 55 }
57 56
58 int CompositorWorkerGlobalScope::requestAnimationFrame(FrameRequestCallback* cal lback) 57 int CompositorWorkerGlobalScope::requestAnimationFrame(FrameRequestCallback* cal lback)
59 { 58 {
60 const bool shouldSignal = !m_executingAnimationFrameCallbacks && m_callbackC ollection.isEmpty(); 59 const bool shouldSignal = !m_executingAnimationFrameCallbacks && m_callbackC ollection.isEmpty();
61 if (shouldSignal) 60 if (shouldSignal)
62 CompositorProxyClient::from(clients())->requestAnimationFrame(); 61 CompositorProxyClient::from(clients())->requestAnimationFrame();
(...skipping 11 matching lines...) Expand all
74 m_callbackCollection.executeCallbacks(highResTimeMs, highResTimeMs); 73 m_callbackCollection.executeCallbacks(highResTimeMs, highResTimeMs);
75 return !m_callbackCollection.isEmpty(); 74 return !m_callbackCollection.isEmpty();
76 } 75 }
77 76
78 CompositorWorkerThread* CompositorWorkerGlobalScope::thread() const 77 CompositorWorkerThread* CompositorWorkerGlobalScope::thread() const
79 { 78 {
80 return static_cast<CompositorWorkerThread*>(WorkerGlobalScope::thread()); 79 return static_cast<CompositorWorkerThread*>(WorkerGlobalScope::thread());
81 } 80 }
82 81
83 } // namespace blink 82 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698