Chromium Code Reviews| 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/ThreadedMessagingProxyBase.h" | 5 #include "core/workers/ThreadedMessagingProxyBase.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/SourceLocation.h" | 7 #include "bindings/core/v8/SourceLocation.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/TaskRunnerHelper.h" | |
| 9 #include "core/frame/Deprecation.h" | 10 #include "core/frame/Deprecation.h" |
| 10 #include "core/loader/DocumentLoader.h" | 11 #include "core/loader/DocumentLoader.h" |
| 11 #include "core/loader/ThreadableLoadingContext.h" | 12 #include "core/loader/ThreadableLoadingContext.h" |
| 12 #include "core/workers/WorkerInspectorProxy.h" | 13 #include "core/workers/WorkerInspectorProxy.h" |
| 13 #include "core/workers/WorkerThreadStartupData.h" | 14 #include "core/workers/WorkerThreadStartupData.h" |
| 14 #include "platform/wtf/CurrentTime.h" | 15 #include "platform/wtf/CurrentTime.h" |
| 15 | 16 |
| 16 namespace blink { | 17 namespace blink { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 WorkerThreadCreated(); | 67 WorkerThreadCreated(); |
| 67 } | 68 } |
| 68 | 69 |
| 69 void ThreadedMessagingProxyBase::PostTaskToWorkerGlobalScope( | 70 void ThreadedMessagingProxyBase::PostTaskToWorkerGlobalScope( |
| 70 const WebTraceLocation& location, | 71 const WebTraceLocation& location, |
| 71 std::unique_ptr<WTF::CrossThreadClosure> task) { | 72 std::unique_ptr<WTF::CrossThreadClosure> task) { |
| 72 if (asked_to_terminate_) | 73 if (asked_to_terminate_) |
| 73 return; | 74 return; |
| 74 | 75 |
| 75 DCHECK(worker_thread_); | 76 DCHECK(worker_thread_); |
| 76 worker_thread_->PostTask(location, std::move(task)); | 77 TaskRunnerHelper::Get(TaskType::kNetworking, worker_thread_.get()) |
|
haraken
2017/04/13 07:03:36
Why does this use kNetworking?
nhiroki
2017/04/13 08:23:50
Because this function (and PostTaskToLoader) imple
| |
| 78 ->PostTask(location, std::move(task)); | |
| 77 } | 79 } |
| 78 | 80 |
| 79 void ThreadedMessagingProxyBase::PostTaskToLoader( | 81 void ThreadedMessagingProxyBase::PostTaskToLoader( |
| 80 const WebTraceLocation& location, | 82 const WebTraceLocation& location, |
| 81 std::unique_ptr<WTF::CrossThreadClosure> task) { | 83 std::unique_ptr<WTF::CrossThreadClosure> task) { |
| 82 parent_frame_task_runners_->Get(TaskType::kNetworking) | 84 parent_frame_task_runners_->Get(TaskType::kNetworking) |
| 83 ->PostTask(BLINK_FROM_HERE, std::move(task)); | 85 ->PostTask(BLINK_FROM_HERE, std::move(task)); |
| 84 } | 86 } |
| 85 | 87 |
| 86 ThreadableLoadingContext* | 88 ThreadableLoadingContext* |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 } | 178 } |
| 177 | 179 |
| 178 bool ThreadedMessagingProxyBase::IsParentContextThread() const { | 180 bool ThreadedMessagingProxyBase::IsParentContextThread() const { |
| 179 // TODO(nhiroki): Nested worker is not supported yet, so the parent context | 181 // TODO(nhiroki): Nested worker is not supported yet, so the parent context |
| 180 // thread should be equal to the main thread (http://crbug.com/31666). | 182 // thread should be equal to the main thread (http://crbug.com/31666). |
| 181 DCHECK(execution_context_->IsDocument()); | 183 DCHECK(execution_context_->IsDocument()); |
| 182 return IsMainThread(); | 184 return IsMainThread(); |
| 183 } | 185 } |
| 184 | 186 |
| 185 } // namespace blink | 187 } // namespace blink |
| OLD | NEW |