Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp

Issue 2718643002: Worker: Pass ParentFrameTaskRunners via WorkerThread::start() instead of the ctor (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ExecutionContextTask.h" 9 #include "core/dom/ExecutionContextTask.h"
10 #include "core/frame/Deprecation.h" 10 #include "core/frame/Deprecation.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 std::unique_ptr<WorkerThreadStartupData> startupData) { 49 std::unique_ptr<WorkerThreadStartupData> startupData) {
50 DCHECK(isParentContextThread()); 50 DCHECK(isParentContextThread());
51 51
52 Document* document = toDocument(getExecutionContext()); 52 Document* document = toDocument(getExecutionContext());
53 double originTime = 53 double originTime =
54 document->loader() ? document->loader()->timing().referenceMonotonicTime() 54 document->loader() ? document->loader()->timing().referenceMonotonicTime()
55 : monotonicallyIncreasingTime(); 55 : monotonicallyIncreasingTime();
56 56
57 m_loaderProxy = WorkerLoaderProxy::create(this); 57 m_loaderProxy = WorkerLoaderProxy::create(this);
58 m_workerThread = createWorkerThread(originTime); 58 m_workerThread = createWorkerThread(originTime);
59 m_workerThread->start(std::move(startupData)); 59 m_workerThread->start(std::move(startupData), getParentFrameTaskRunners());
60 workerThreadCreated(); 60 workerThreadCreated();
61 } 61 }
62 62
63 void ThreadedMessagingProxyBase::postTaskToWorkerGlobalScope( 63 void ThreadedMessagingProxyBase::postTaskToWorkerGlobalScope(
64 const WebTraceLocation& location, 64 const WebTraceLocation& location,
65 std::unique_ptr<WTF::CrossThreadClosure> task) { 65 std::unique_ptr<WTF::CrossThreadClosure> task) {
66 if (m_askedToTerminate) 66 if (m_askedToTerminate)
67 return; 67 return;
68 68
69 DCHECK(m_workerThread); 69 DCHECK(m_workerThread);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 166
167 bool ThreadedMessagingProxyBase::isParentContextThread() const { 167 bool ThreadedMessagingProxyBase::isParentContextThread() const {
168 // TODO(nhiroki): Nested worker is not supported yet, so the parent context 168 // TODO(nhiroki): Nested worker is not supported yet, so the parent context
169 // thread should be equal to the main thread (http://crbug.com/31666). 169 // thread should be equal to the main thread (http://crbug.com/31666).
170 DCHECK(m_executionContext->isDocument()); 170 DCHECK(m_executionContext->isDocument());
171 return isMainThread(); 171 return isMainThread();
172 } 172 }
173 173
174 } // namespace blink 174 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698