| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/workers/ThreadedWorkletMessagingProxy.h" | 5 #include "core/workers/ThreadedWorkletMessagingProxy.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptSourceCode.h" | 7 #include "bindings/core/v8/ScriptSourceCode.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/SecurityContext.h" | 9 #include "core/dom/SecurityContext.h" |
| 10 #include "core/frame/csp/ContentSecurityPolicy.h" | 10 #include "core/frame/csp/ContentSecurityPolicy.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 std::unique_ptr<WorkerSettings> workerSettings = | 42 std::unique_ptr<WorkerSettings> workerSettings = |
| 43 WTF::wrapUnique(new WorkerSettings(document->settings())); | 43 WTF::wrapUnique(new WorkerSettings(document->settings())); |
| 44 | 44 |
| 45 // TODO(ikilpatrick): Decide on sensible a value for referrerPolicy. | 45 // TODO(ikilpatrick): Decide on sensible a value for referrerPolicy. |
| 46 std::unique_ptr<WorkerThreadStartupData> startupData = | 46 std::unique_ptr<WorkerThreadStartupData> startupData = |
| 47 WorkerThreadStartupData::create( | 47 WorkerThreadStartupData::create( |
| 48 scriptURL, document->userAgent(), String(), nullptr, startMode, | 48 scriptURL, document->userAgent(), String(), nullptr, startMode, |
| 49 csp->headers().get(), /* referrerPolicy */ String(), starterOrigin, | 49 csp->headers().get(), /* referrerPolicy */ String(), starterOrigin, |
| 50 nullptr, document->addressSpace(), | 50 nullptr, document->addressSpace(), |
| 51 OriginTrialContext::getTokens(document).get(), | 51 OriginTrialContext::getTokens(document).get(), |
| 52 std::move(workerSettings), WorkerV8Settings::Default(), | 52 std::move(workerSettings), WorkerV8Settings::Default()); |
| 53 false /* inspectorNetworkCapability */); | |
| 54 | 53 |
| 55 initializeWorkerThread(std::move(startupData)); | 54 initializeWorkerThread(std::move(startupData)); |
| 56 workerInspectorProxy()->workerThreadCreated(document, workerThread(), | 55 workerInspectorProxy()->workerThreadCreated(document, workerThread(), |
| 57 scriptURL); | 56 scriptURL); |
| 58 } | 57 } |
| 59 | 58 |
| 60 void ThreadedWorkletMessagingProxy::evaluateScript( | 59 void ThreadedWorkletMessagingProxy::evaluateScript( |
| 61 const ScriptSourceCode& scriptSourceCode) { | 60 const ScriptSourceCode& scriptSourceCode) { |
| 62 postTaskToWorkerGlobalScope( | 61 postTaskToWorkerGlobalScope( |
| 63 BLINK_FROM_HERE, | 62 BLINK_FROM_HERE, |
| 64 crossThreadBind(&ThreadedWorkletObjectProxy::evaluateScript, | 63 crossThreadBind(&ThreadedWorkletObjectProxy::evaluateScript, |
| 65 crossThreadUnretained(m_workletObjectProxy.get()), | 64 crossThreadUnretained(m_workletObjectProxy.get()), |
| 66 scriptSourceCode.source(), scriptSourceCode.url(), | 65 scriptSourceCode.source(), scriptSourceCode.url(), |
| 67 crossThreadUnretained(workerThread()))); | 66 crossThreadUnretained(workerThread()))); |
| 68 } | 67 } |
| 69 | 68 |
| 70 void ThreadedWorkletMessagingProxy::terminateWorkletGlobalScope() { | 69 void ThreadedWorkletMessagingProxy::terminateWorkletGlobalScope() { |
| 71 terminateGlobalScope(); | 70 terminateGlobalScope(); |
| 72 } | 71 } |
| 73 | 72 |
| 74 } // namespace blink | 73 } // namespace blink |
| OLD | NEW |