OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 16 matching lines...) Expand all Loading... |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "core/workers/DedicatedWorkerGlobalScope.h" | 31 #include "core/workers/DedicatedWorkerGlobalScope.h" |
32 | 32 |
33 #include "bindings/core/v8/ExceptionState.h" | 33 #include "bindings/core/v8/ExceptionState.h" |
34 #include "bindings/core/v8/SerializedScriptValue.h" | 34 #include "bindings/core/v8/SerializedScriptValue.h" |
35 #include "core/dom/CrossThreadTask.h" | 35 #include "core/dom/CrossThreadTask.h" |
36 #include "core/frame/Deprecation.h" | 36 #include "core/frame/Deprecation.h" |
37 #include "core/frame/LocalDOMWindow.h" | 37 #include "core/frame/UseCounter.h" |
| 38 #include "core/frame/csp/ContentSecurityPolicy.h" |
38 #include "core/workers/DedicatedWorkerThread.h" | 39 #include "core/workers/DedicatedWorkerThread.h" |
| 40 #include "core/workers/InProcessWorkerObjectProxy.h" |
39 #include "core/workers/WorkerClients.h" | 41 #include "core/workers/WorkerClients.h" |
40 #include "core/workers/WorkerObjectProxy.h" | |
41 #include "core/workers/WorkerThreadStartupData.h" | 42 #include "core/workers/WorkerThreadStartupData.h" |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 DedicatedWorkerGlobalScope* DedicatedWorkerGlobalScope::create(DedicatedWorkerTh
read* thread, PassOwnPtr<WorkerThreadStartupData> startupData, double timeOrigin
) | 46 DedicatedWorkerGlobalScope* DedicatedWorkerGlobalScope::create(DedicatedWorkerTh
read* thread, PassOwnPtr<WorkerThreadStartupData> startupData, double timeOrigin
) |
46 { | 47 { |
47 // Note: startupData is finalized on return. After the relevant parts has be
en | 48 // Note: startupData is finalized on return. After the relevant parts has be
en |
48 // passed along to the created 'context'. | 49 // passed along to the created 'context'. |
49 DedicatedWorkerGlobalScope* context = new DedicatedWorkerGlobalScope(startup
Data->m_scriptURL, startupData->m_userAgent, thread, timeOrigin, startupData->m_
starterOriginPrivilegeData.release(), startupData->m_workerClients.release()); | 50 DedicatedWorkerGlobalScope* context = new DedicatedWorkerGlobalScope(startup
Data->m_scriptURL, startupData->m_userAgent, thread, timeOrigin, startupData->m_
starterOriginPrivilegeData.release(), startupData->m_workerClients.release()); |
50 context->applyContentSecurityPolicyFromVector(*startupData->m_contentSecurit
yPolicyHeaders); | 51 context->applyContentSecurityPolicyFromVector(*startupData->m_contentSecurit
yPolicyHeaders); |
(...skipping 19 matching lines...) Expand all Loading... |
70 { | 71 { |
71 // Disentangle the port in preparation for sending it to the remote context. | 72 // Disentangle the port in preparation for sending it to the remote context. |
72 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(con
text, ports, exceptionState); | 73 OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(con
text, ports, exceptionState); |
73 if (exceptionState.hadException()) | 74 if (exceptionState.hadException()) |
74 return; | 75 return; |
75 thread()->workerObjectProxy().postMessageToWorkerObject(message, channels.re
lease()); | 76 thread()->workerObjectProxy().postMessageToWorkerObject(message, channels.re
lease()); |
76 } | 77 } |
77 | 78 |
78 DedicatedWorkerThread* DedicatedWorkerGlobalScope::thread() const | 79 DedicatedWorkerThread* DedicatedWorkerGlobalScope::thread() const |
79 { | 80 { |
80 return static_cast<DedicatedWorkerThread*>(Base::thread()); | 81 return static_cast<DedicatedWorkerThread*>(WorkerGlobalScope::thread()); |
81 } | 82 } |
82 | 83 |
83 static void countOnDocument(UseCounter::Feature feature, ExecutionContext* conte
xt) | 84 static void countOnDocument(UseCounter::Feature feature, ExecutionContext* conte
xt) |
84 { | 85 { |
85 ASSERT(context->isDocument()); | 86 ASSERT(context->isDocument()); |
86 UseCounter::count(context, feature); | 87 UseCounter::count(context, feature); |
87 } | 88 } |
88 | 89 |
89 static void countDeprecationOnDocument(UseCounter::Feature feature, ExecutionCon
text* context) | 90 static void countDeprecationOnDocument(UseCounter::Feature feature, ExecutionCon
text* context) |
90 { | 91 { |
(...skipping 10 matching lines...) Expand all Loading... |
101 { | 102 { |
102 thread()->workerObjectProxy().postTaskToMainExecutionContext(createCrossThre
adTask(&countDeprecationOnDocument, feature)); | 103 thread()->workerObjectProxy().postTaskToMainExecutionContext(createCrossThre
adTask(&countDeprecationOnDocument, feature)); |
103 } | 104 } |
104 | 105 |
105 DEFINE_TRACE(DedicatedWorkerGlobalScope) | 106 DEFINE_TRACE(DedicatedWorkerGlobalScope) |
106 { | 107 { |
107 WorkerGlobalScope::trace(visitor); | 108 WorkerGlobalScope::trace(visitor); |
108 } | 109 } |
109 | 110 |
110 } // namespace blink | 111 } // namespace blink |
OLD | NEW |