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

Unified Diff: third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp

Issue 2513413003: Worker: Provide a way to access parent frame task runners from a worker thread (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
index 7591ab68a8f0c3f3d07609d647235adadecabd07..f3629cbfb33ba1ca1d99869bfe10cc4105a80139 100644
--- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
@@ -250,7 +250,13 @@ void WebSharedWorkerImpl::postMessageToPageInspectorOnMainThread(
m_workerInspectorProxy->dispatchMessageFromWorker(message);
}
+ParentFrameTaskRunners* WebSharedWorkerImpl::getParentFrameTaskRunners() {
+ return m_parentFrameTaskRunners.get();
+}
+
void WebSharedWorkerImpl::didCloseWorkerGlobalScope() {
+ // TODO(nhiroki): Replace this with getParentFrameTaskRunners().
+ // (https://crbug.com/667310)
Platform::current()->mainThread()->getWebTaskRunner()->postTask(
BLINK_FROM_HERE,
crossThreadBind(
@@ -265,6 +271,8 @@ void WebSharedWorkerImpl::didCloseWorkerGlobalScopeOnMainThread() {
}
void WebSharedWorkerImpl::didTerminateWorkerThread() {
+ // TODO(nhiroki): Replace this with getParentFrameTaskRunners().
+ // (https://crbug.com/667310)
Platform::current()->mainThread()->getWebTaskRunner()->postTask(
BLINK_FROM_HERE,
crossThreadBind(
@@ -284,7 +292,7 @@ void WebSharedWorkerImpl::postTaskToLoader(
const WebTraceLocation& location,
std::unique_ptr<ExecutionContextTask> task) {
// TODO(hiroshige,yuryu): Make this not use ExecutionContextTask and
- // consider using m_mainThreadTaskRunners->get(TaskType::Networking)
+ // consider using m_parentFrameTaskRunners->get(TaskType::Networking)
// instead.
m_mainFrame->frame()->document()->postTask(location, std::move(task));
}
@@ -380,7 +388,7 @@ void WebSharedWorkerImpl::onScriptLoaderFinished() {
// the document/frame of associated document(s) for this worker. Here we
// populate the task runners with null document not to confuse the frame
// scheduler (which will end up using the thread's default task runner).
- m_mainThreadTaskRunners = ParentFrameTaskRunners::create(nullptr);
+ m_parentFrameTaskRunners = ParentFrameTaskRunners::create(nullptr);
haraken 2016/11/22 01:26:17 When is the correct document set to m_parentFrameT
nhiroki 2016/11/22 03:27:21 Ditto. A shared worker can be associated with mult
m_loaderProxy = WorkerLoaderProxy::create(this);
m_workerThread = SharedWorkerThread::create(m_name, m_loaderProxy, *this);

Powered by Google App Engine
This is Rietveld 408576698