| 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/WorkerOrWorkletGlobalScope.h" | 5 #include "core/workers/WorkerOrWorkletGlobalScope.h" |
| 6 | 6 |
| 7 #include "core/dom/ExecutionContextTask.h" | 7 #include "core/dom/ExecutionContextTask.h" |
| 8 #include "core/frame/Deprecation.h" | 8 #include "core/frame/Deprecation.h" |
| 9 #include "core/inspector/ConsoleMessage.h" | 9 #include "core/inspector/ConsoleMessage.h" |
| 10 #include "core/inspector/InspectorInstrumentation.h" | 10 #include "core/inspector/InspectorInstrumentation.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 if (!thread()) | 44 if (!thread()) |
| 45 return; | 45 return; |
| 46 | 46 |
| 47 bool isInstrumented = !taskNameForInstrumentation.isEmpty(); | 47 bool isInstrumented = !taskNameForInstrumentation.isEmpty(); |
| 48 if (isInstrumented) { | 48 if (isInstrumented) { |
| 49 InspectorInstrumentation::asyncTaskScheduled(this, "Worker task", | 49 InspectorInstrumentation::asyncTaskScheduled(this, "Worker task", |
| 50 task.get()); | 50 task.get()); |
| 51 } | 51 } |
| 52 | 52 |
| 53 thread()->postTask( | 53 thread()->postTask( |
| 54 location, crossThreadBind(&WorkerOrWorkletGlobalScope::runTask, | 54 location, |
| 55 wrapCrossThreadWeakPersistent(this), | 55 crossThreadBind(&WorkerOrWorkletGlobalScope::runTask, |
| 56 WTF::passed(std::move(task)), isInstrumented)); | 56 wrapCrossThreadWeakPersistent(this), |
| 57 WTF::passed(std::move(task)), isInstrumented)); |
| 57 } | 58 } |
| 58 | 59 |
| 59 void WorkerOrWorkletGlobalScope::runTask( | 60 void WorkerOrWorkletGlobalScope::runTask( |
| 60 std::unique_ptr<ExecutionContextTask> task, | 61 std::unique_ptr<ExecutionContextTask> task, |
| 61 bool isInstrumented) { | 62 bool isInstrumented) { |
| 62 DCHECK(thread()->isCurrentThread()); | 63 DCHECK(thread()->isCurrentThread()); |
| 63 InspectorInstrumentation::AsyncTask asyncTask(this, task.get(), | 64 InspectorInstrumentation::AsyncTask asyncTask(this, task.get(), |
| 64 isInstrumented); | 65 isInstrumented); |
| 65 task->performTask(this); | 66 task->performTask(this); |
| 66 } | 67 } |
| 67 | 68 |
| 68 } // namespace blink | 69 } // namespace blink |
| OLD | NEW |