| Index: third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
|
| diff --git a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
|
| index 9306f804f414698210b623780a34d3e1f414470a..1a79822579153f1b162750fe0a14b5f0bbc49494 100644
|
| --- a/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
|
| +++ b/third_party/WebKit/Source/core/workers/WorkerOrWorkletGlobalScope.cpp
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "core/frame/Deprecation.h"
|
| #include "core/inspector/ConsoleMessage.h"
|
| +#include "core/inspector/InspectorInstrumentation.h"
|
| #include "core/workers/WorkerReportingProxy.h"
|
| #include "core/workers/WorkerThread.h"
|
|
|
| @@ -39,8 +40,27 @@ void WorkerOrWorkletGlobalScope::postTask(
|
| const String& taskNameForInstrumentation) {
|
| if (!thread())
|
| return;
|
| - thread()->postTask(location, std::move(task),
|
| - !taskNameForInstrumentation.isEmpty());
|
| +
|
| + bool isInstrumented = !taskNameForInstrumentation.isEmpty();
|
| + if (isInstrumented) {
|
| + InspectorInstrumentation::asyncTaskScheduled(this, "Worker task",
|
| + task.get());
|
| + }
|
| +
|
| + std::unique_ptr<ExecutionContextTask> wrappedTask = createCrossThreadTask(
|
| + &WorkerOrWorkletGlobalScope::runTask, wrapCrossThreadWeakPersistent(this),
|
| + WTF::passed(std::move(task)), isInstrumented);
|
| + thread()->postTask(location, std::move(wrappedTask));
|
| +}
|
| +
|
| +void WorkerOrWorkletGlobalScope::runTask(
|
| + std::unique_ptr<ExecutionContextTask> task,
|
| + bool isInstrumented,
|
| + ExecutionContext*) {
|
| + DCHECK(thread()->isCurrentThread());
|
| + InspectorInstrumentation::AsyncTask asyncTask(this, task.get(),
|
| + isInstrumented);
|
| + task->performTask(this);
|
| }
|
|
|
| } // namespace blink
|
|
|