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

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

Issue 2716853002: (WIP) Worker: Merge ParentFrameTaskRunners into TaskRunnerHelper
Patch Set: WIP Created 3 years, 10 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 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 bbeff5191ed000b5c793392c4f66a85ff6857709..608d578a2075a819665a17f3d173e587ac73387e 100644
--- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
@@ -30,13 +30,14 @@
#include "web/WebSharedWorkerImpl.h"
+#include <memory>
#include "core/dom/Document.h"
+#include "core/dom/TaskRunnerHelper.h"
#include "core/events/MessageEvent.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/inspector/InspectorInstrumentation.h"
#include "core/loader/FrameLoadRequest.h"
#include "core/loader/FrameLoader.h"
-#include "core/workers/ParentFrameTaskRunners.h"
#include "core/workers/SharedWorkerGlobalScope.h"
#include "core/workers/SharedWorkerThread.h"
#include "core/workers/WorkerClients.h"
@@ -70,7 +71,6 @@
#include "web/WorkerContentSettingsClient.h"
#include "wtf/Functional.h"
#include "wtf/PtrUtil.h"
-#include <memory>
namespace blink {
@@ -265,7 +265,7 @@ void WebSharedWorkerImpl::postTaskToLoader(
const WebTraceLocation& location,
std::unique_ptr<WTF::CrossThreadClosure> task) {
DCHECK(m_workerThread->isCurrentThread());
- m_parentFrameTaskRunners->get(TaskType::Networking)
+ FrameTaskRunnerHelper::get(TaskType::Networking, m_workerThread.get())
->postTask(FROM_HERE, std::move(task));
}
@@ -371,17 +371,8 @@ void WebSharedWorkerImpl::onScriptLoaderFinished() {
m_mainScriptLoader->originTrialTokens(), std::move(workerSettings),
WorkerV8Settings::Default());
- // SharedWorker can sometimes run tasks that are initiated by/associated with
- // a document's frame but these documents can be from a different process. So
- // we intentionally populate the task runners with null document in order to
- // use the thread's default task runner. Note that |m_document| should not be
- // used as it's a dummy document for loading that doesn't represent the frame
- // of any associated document.
- m_parentFrameTaskRunners = ParentFrameTaskRunners::create(nullptr);
-
m_loaderProxy = WorkerLoaderProxy::create(this);
- m_reportingProxy = new WebSharedWorkerReportingProxyImpl(
- this, m_parentFrameTaskRunners.get());
+ m_reportingProxy = new WebSharedWorkerReportingProxyImpl(this);
m_workerThread =
SharedWorkerThread::create(m_name, m_loaderProxy, *m_reportingProxy);
InspectorInstrumentation::scriptImported(m_loadingDocument,
@@ -389,7 +380,14 @@ void WebSharedWorkerImpl::onScriptLoaderFinished() {
m_mainScriptLoader->script());
m_mainScriptLoader.clear();
- workerThread()->start(std::move(startupData), m_parentFrameTaskRunners.get());
+ // SharedWorker can sometimes run tasks that are initiated by/associated with
+ // a document's frame but these documents can be from a different process. So
+ // we intentionally populate the task runners with null document in order to
+ // use the thread's default task runner. Note that |m_document| should not be
+ // used as it's a dummy document for loading that doesn't represent the frame
+ // of any associated document.
+ workerThread()->start(std::move(startupData),
+ FrameTaskRunnersHolder::create(nullptr));
m_workerInspectorProxy->workerThreadCreated(toDocument(m_loadingDocument),
workerThread(), m_url);
m_client->workerScriptLoaded();
« no previous file with comments | « third_party/WebKit/Source/web/WebSharedWorkerImpl.h ('k') | third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698