| 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 27 matching lines...) Expand all Loading... |
| 38 if (m_loaderProxy) | 38 if (m_loaderProxy) |
| 39 m_loaderProxy->detachProvider(this); | 39 m_loaderProxy->detachProvider(this); |
| 40 s_liveMessagingProxyCount--; | 40 s_liveMessagingProxyCount--; |
| 41 } | 41 } |
| 42 | 42 |
| 43 int ThreadedMessagingProxyBase::proxyCount() { | 43 int ThreadedMessagingProxyBase::proxyCount() { |
| 44 DCHECK(isMainThread()); | 44 DCHECK(isMainThread()); |
| 45 return s_liveMessagingProxyCount; | 45 return s_liveMessagingProxyCount; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void ThreadedMessagingProxyBase::setWorkerThreadForTest( |
| 49 std::unique_ptr<WorkerThread> workerThread) { |
| 50 m_workerThread = std::move(workerThread); |
| 51 } |
| 52 |
| 48 void ThreadedMessagingProxyBase::initializeWorkerThread( | 53 void ThreadedMessagingProxyBase::initializeWorkerThread( |
| 49 std::unique_ptr<WorkerThreadStartupData> startupData) { | 54 std::unique_ptr<WorkerThreadStartupData> startupData) { |
| 50 DCHECK(isParentContextThread()); | 55 DCHECK(isParentContextThread()); |
| 51 | 56 |
| 52 Document* document = toDocument(getExecutionContext()); | 57 Document* document = toDocument(getExecutionContext()); |
| 53 double originTime = | 58 double originTime = |
| 54 document->loader() ? document->loader()->timing().referenceMonotonicTime() | 59 document->loader() ? document->loader()->timing().referenceMonotonicTime() |
| 55 : monotonicallyIncreasingTime(); | 60 : monotonicallyIncreasingTime(); |
| 56 | 61 |
| 57 m_loaderProxy = WorkerLoaderProxy::create(this); | 62 m_loaderProxy = WorkerLoaderProxy::create(this); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 } | 175 } |
| 171 | 176 |
| 172 bool ThreadedMessagingProxyBase::isParentContextThread() const { | 177 bool ThreadedMessagingProxyBase::isParentContextThread() const { |
| 173 // TODO(nhiroki): Nested worker is not supported yet, so the parent context | 178 // TODO(nhiroki): Nested worker is not supported yet, so the parent context |
| 174 // thread should be equal to the main thread (http://crbug.com/31666). | 179 // thread should be equal to the main thread (http://crbug.com/31666). |
| 175 DCHECK(m_executionContext->isDocument()); | 180 DCHECK(m_executionContext->isDocument()); |
| 176 return isMainThread(); | 181 return isMainThread(); |
| 177 } | 182 } |
| 178 | 183 |
| 179 } // namespace blink | 184 } // namespace blink |
| OLD | NEW |