| 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/dom/TaskRunnerHelper.h" |
| 10 #include "core/frame/Deprecation.h" | 10 #include "core/frame/Deprecation.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return; | 152 return; |
| 153 asked_to_terminate_ = true; | 153 asked_to_terminate_ = true; |
| 154 | 154 |
| 155 if (worker_thread_) | 155 if (worker_thread_) |
| 156 worker_thread_->Terminate(); | 156 worker_thread_->Terminate(); |
| 157 | 157 |
| 158 worker_inspector_proxy_->WorkerThreadTerminated(); | 158 worker_inspector_proxy_->WorkerThreadTerminated(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void ThreadedMessagingProxyBase::PostMessageToPageInspector( | 161 void ThreadedMessagingProxyBase::PostMessageToPageInspector( |
| 162 int session_id, |
| 162 const String& message) { | 163 const String& message) { |
| 163 DCHECK(IsParentContextThread()); | 164 DCHECK(IsParentContextThread()); |
| 164 if (worker_inspector_proxy_) | 165 if (worker_inspector_proxy_) |
| 165 worker_inspector_proxy_->DispatchMessageFromWorker(message); | 166 worker_inspector_proxy_->DispatchMessageFromWorker(session_id, message); |
| 166 } | 167 } |
| 167 | 168 |
| 168 ThreadableLoadingContext* | 169 ThreadableLoadingContext* |
| 169 ThreadedMessagingProxyBase::CreateThreadableLoadingContext() const { | 170 ThreadedMessagingProxyBase::CreateThreadableLoadingContext() const { |
| 170 DCHECK(IsParentContextThread()); | 171 DCHECK(IsParentContextThread()); |
| 171 return ThreadableLoadingContext::Create(*ToDocument(execution_context_)); | 172 return ThreadableLoadingContext::Create(*ToDocument(execution_context_)); |
| 172 } | 173 } |
| 173 | 174 |
| 174 ExecutionContext* ThreadedMessagingProxyBase::GetExecutionContext() const { | 175 ExecutionContext* ThreadedMessagingProxyBase::GetExecutionContext() const { |
| 175 DCHECK(IsParentContextThread()); | 176 DCHECK(IsParentContextThread()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 200 } | 201 } |
| 201 | 202 |
| 202 bool ThreadedMessagingProxyBase::IsParentContextThread() const { | 203 bool ThreadedMessagingProxyBase::IsParentContextThread() const { |
| 203 // TODO(nhiroki): Nested worker is not supported yet, so the parent context | 204 // TODO(nhiroki): Nested worker is not supported yet, so the parent context |
| 204 // thread should be equal to the main thread (http://crbug.com/31666). | 205 // thread should be equal to the main thread (http://crbug.com/31666). |
| 205 DCHECK(execution_context_->IsDocument()); | 206 DCHECK(execution_context_->IsDocument()); |
| 206 return IsMainThread(); | 207 return IsMainThread(); |
| 207 } | 208 } |
| 208 | 209 |
| 209 } // namespace blink | 210 } // namespace blink |
| OLD | NEW |