| 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/frame/Deprecation.h" | 9 #include "core/frame/Deprecation.h" |
| 10 #include "core/loader/DocumentLoader.h" | 10 #include "core/loader/DocumentLoader.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 DCHECK(m_workerThread); | 108 DCHECK(m_workerThread); |
| 109 } | 109 } |
| 110 | 110 |
| 111 void ThreadedMessagingProxyBase::parentObjectDestroyed() { | 111 void ThreadedMessagingProxyBase::parentObjectDestroyed() { |
| 112 DCHECK(isParentContextThread()); | 112 DCHECK(isParentContextThread()); |
| 113 | 113 |
| 114 m_parentFrameTaskRunners->get(TaskType::Internal) | 114 m_parentFrameTaskRunners->get(TaskType::Internal) |
| 115 ->postTask( | 115 ->postTask( |
| 116 BLINK_FROM_HERE, | 116 BLINK_FROM_HERE, |
| 117 WTF::bind(&ThreadedMessagingProxyBase::parentObjectDestroyedInternal, | 117 WTF::bind(&ThreadedMessagingProxyBase::parentObjectDestroyedInternal, |
| 118 unretained(this))); | 118 WTF::unretained(this))); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void ThreadedMessagingProxyBase::parentObjectDestroyedInternal() { | 121 void ThreadedMessagingProxyBase::parentObjectDestroyedInternal() { |
| 122 DCHECK(isParentContextThread()); | 122 DCHECK(isParentContextThread()); |
| 123 m_mayBeDestroyed = true; | 123 m_mayBeDestroyed = true; |
| 124 if (m_workerThread) | 124 if (m_workerThread) |
| 125 terminateGlobalScope(); | 125 terminateGlobalScope(); |
| 126 else | 126 else |
| 127 workerThreadTerminated(); | 127 workerThreadTerminated(); |
| 128 } | 128 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 161 } |
| 162 | 162 |
| 163 bool ThreadedMessagingProxyBase::isParentContextThread() const { | 163 bool ThreadedMessagingProxyBase::isParentContextThread() const { |
| 164 // TODO(nhiroki): Nested worker is not supported yet, so the parent context | 164 // TODO(nhiroki): Nested worker is not supported yet, so the parent context |
| 165 // thread should be equal to the main thread (http://crbug.com/31666). | 165 // thread should be equal to the main thread (http://crbug.com/31666). |
| 166 DCHECK(getExecutionContext()->isDocument()); | 166 DCHECK(getExecutionContext()->isDocument()); |
| 167 return isMainThread(); | 167 return isMainThread(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace blink | 170 } // namespace blink |
| OLD | NEW |