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/dom/TaskRunnerHelper.h" | |
10 #include "core/frame/csp/ContentSecurityPolicy.h" | 11 #include "core/frame/csp/ContentSecurityPolicy.h" |
11 #include "core/origin_trials/OriginTrialContext.h" | 12 #include "core/origin_trials/OriginTrialContext.h" |
12 #include "core/workers/ThreadedWorkletObjectProxy.h" | 13 #include "core/workers/ThreadedWorkletObjectProxy.h" |
13 #include "core/workers/WorkerInspectorProxy.h" | 14 #include "core/workers/WorkerInspectorProxy.h" |
14 #include "core/workers/WorkerThreadStartupData.h" | 15 #include "core/workers/WorkerThreadStartupData.h" |
15 #include "core/workers/WorkletGlobalScope.h" | 16 #include "core/workers/WorkletGlobalScope.h" |
16 #include "platform/CrossThreadFunctional.h" | 17 #include "platform/CrossThreadFunctional.h" |
17 #include "platform/WebTaskRunner.h" | 18 #include "platform/WebTaskRunner.h" |
18 | 19 |
19 namespace blink { | 20 namespace blink { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 OriginTrialContext::GetTokens(document).get(), | 52 OriginTrialContext::GetTokens(document).get(), |
52 std::move(worker_settings), WorkerV8Settings::Default()); | 53 std::move(worker_settings), WorkerV8Settings::Default()); |
53 | 54 |
54 InitializeWorkerThread(std::move(startup_data)); | 55 InitializeWorkerThread(std::move(startup_data)); |
55 GetWorkerInspectorProxy()->WorkerThreadCreated(document, GetWorkerThread(), | 56 GetWorkerInspectorProxy()->WorkerThreadCreated(document, GetWorkerThread(), |
56 script_url); | 57 script_url); |
57 } | 58 } |
58 | 59 |
59 void ThreadedWorkletMessagingProxy::EvaluateScript( | 60 void ThreadedWorkletMessagingProxy::EvaluateScript( |
60 const ScriptSourceCode& script_source_code) { | 61 const ScriptSourceCode& script_source_code) { |
61 PostTaskToWorkerGlobalScope( | 62 TaskRunnerHelper::Get(TaskType::kMiscPlatformAPI, GetWorkerThread()) |
haraken
2017/04/21 09:48:49
I'm not sure if this is a speced task though.
| |
62 BLINK_FROM_HERE, | 63 ->PostTask( |
63 CrossThreadBind(&ThreadedWorkletObjectProxy::EvaluateScript, | 64 BLINK_FROM_HERE, |
64 CrossThreadUnretained(worklet_object_proxy_.get()), | 65 CrossThreadBind(&ThreadedWorkletObjectProxy::EvaluateScript, |
65 script_source_code.Source(), script_source_code.Url(), | 66 CrossThreadUnretained(worklet_object_proxy_.get()), |
66 CrossThreadUnretained(GetWorkerThread()))); | 67 script_source_code.Source(), script_source_code.Url(), |
68 CrossThreadUnretained(GetWorkerThread()))); | |
67 } | 69 } |
68 | 70 |
69 void ThreadedWorkletMessagingProxy::TerminateWorkletGlobalScope() { | 71 void ThreadedWorkletMessagingProxy::TerminateWorkletGlobalScope() { |
70 TerminateGlobalScope(); | 72 TerminateGlobalScope(); |
71 } | 73 } |
72 | 74 |
73 } // namespace blink | 75 } // namespace blink |
OLD | NEW |