Chromium Code Reviews| Index: third_party/WebKit/Source/core/workers/WorkletModuleTreeClient.cpp |
| diff --git a/third_party/WebKit/Source/core/workers/WorkletModuleTreeClient.cpp b/third_party/WebKit/Source/core/workers/WorkletModuleTreeClient.cpp |
| index 829ecd52081120cf4cd53f150332206e0d3460d3..132368ac3cf6355c0b6aed2676870369bebca281 100644 |
| --- a/third_party/WebKit/Source/core/workers/WorkletModuleTreeClient.cpp |
| +++ b/third_party/WebKit/Source/core/workers/WorkletModuleTreeClient.cpp |
| @@ -5,26 +5,33 @@ |
| #include "core/workers/WorkletModuleTreeClient.h" |
| #include "core/dom/ModuleScript.h" |
| +#include "core/dom/TaskRunnerHelper.h" |
| +#include "platform/CrossThreadFunctional.h" |
| namespace blink { |
| WorkletModuleTreeClient::WorkletModuleTreeClient( |
| Modulator* modulator, |
| + ParentFrameTaskRunners* task_runners, |
| WorkletPendingTasks* pending_tasks) |
| - : modulator_(modulator), pending_tasks_(pending_tasks) {} |
| + : modulator_(modulator), |
| + task_runners_(task_runners), |
| + pending_tasks_(pending_tasks) {} |
| // Implementation of the second half of the "fetch and invoke a worklet script" |
| // algorithm: |
| // https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script |
| void WorkletModuleTreeClient::NotifyModuleTreeLoadFinished( |
| ModuleScript* module_script) { |
| - DCHECK(IsMainThread()); |
| if (!module_script) { |
| // Step 3: "If script is null, then queue a task on outsideSettings's |
| // responsible event loop to run these steps:" |
| // The steps are implemented in WorkletPendingTasks::Abort(). |
|
kinuko
2017/05/30 02:32:58
The spec seems to say 'responsible event loop' is
nhiroki
2017/05/30 04:03:40
According to [1], "workletEventLoop" is the messag
|
| - // TODO(nhiroki): Queue a task instead of executing this here. |
| - pending_tasks_->Abort(); |
| + task_runners_->Get(TaskType::kUnspecedLoading) |
| + ->PostTask( |
| + BLINK_FROM_HERE, |
| + CrossThreadBind(&WorkletPendingTasks::Abort, |
| + WrapCrossThreadPersistent(pending_tasks_.Get()))); |
| return; |
| } |
| @@ -34,13 +41,15 @@ void WorkletModuleTreeClient::NotifyModuleTreeLoadFinished( |
| // Step 5: "Queue a task on outsideSettings's responsible event loop to run |
| // these steps:" |
| // The steps are implemented in WorkletPendingTasks::DecrementCounter(). |
| - // TODO(nhiroki): Queue a task instead of executing this here. |
| - pending_tasks_->DecrementCounter(); |
| + task_runners_->Get(TaskType::kUnspecedLoading) |
| + ->PostTask( |
| + BLINK_FROM_HERE, |
| + CrossThreadBind(&WorkletPendingTasks::DecrementCounter, |
| + WrapCrossThreadPersistent(pending_tasks_.Get()))); |
| }; |
| DEFINE_TRACE(WorkletModuleTreeClient) { |
| visitor->Trace(modulator_); |
| - visitor->Trace(pending_tasks_); |
| ModuleTreeClient::Trace(visitor); |
| } |