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

Unified Diff: third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.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
« no previous file with comments | « third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.cpp
index e189c85e20c333bf21aa171b9e4ab68b2fb830f3..7dde9e66ac20d11cefe4b61756250e961906c3e0 100644
--- a/third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.cpp
+++ b/third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.cpp
@@ -5,6 +5,7 @@
#include "web/WebSharedWorkerReportingProxyImpl.h"
#include "bindings/core/v8/SourceLocation.h"
+#include "core/dom/TaskRunnerHelper.h"
#include "platform/CrossThreadFunctional.h"
#include "public/platform/WebTraceLocation.h"
#include "web/WebSharedWorkerImpl.h"
@@ -13,9 +14,8 @@
namespace blink {
WebSharedWorkerReportingProxyImpl::WebSharedWorkerReportingProxyImpl(
- WebSharedWorkerImpl* worker,
- ParentFrameTaskRunners* parentFrameTaskRunners)
- : m_worker(worker), m_parentFrameTaskRunners(parentFrameTaskRunners) {
+ WebSharedWorkerImpl* worker)
+ : m_worker(worker) {
DCHECK(isMainThread());
}
@@ -25,8 +25,8 @@ WebSharedWorkerReportingProxyImpl::~WebSharedWorkerReportingProxyImpl() {
void WebSharedWorkerReportingProxyImpl::countFeature(
UseCounter::Feature feature) {
- DCHECK(!isMainThread());
- m_parentFrameTaskRunners->get(TaskType::UnspecedTimer)
+ DCHECK(m_globalScope->isContextThread());
+ FrameTaskRunnerHelper::get(TaskType::UnspecedTimer, m_globalScope.get())
->postTask(BLINK_FROM_HERE,
crossThreadBind(&WebSharedWorkerImpl::countFeature,
crossThreadUnretained(m_worker), feature));
@@ -34,7 +34,7 @@ void WebSharedWorkerReportingProxyImpl::countFeature(
void WebSharedWorkerReportingProxyImpl::countDeprecation(
UseCounter::Feature feature) {
- DCHECK(!isMainThread());
+ DCHECK(m_globalScope->isContextThread());
// Go through the same code path with countFeature() because a deprecation
// message is already shown on the worker console and a remaining work is just
// to record an API use.
@@ -45,7 +45,7 @@ void WebSharedWorkerReportingProxyImpl::reportException(
const String& errorMessage,
std::unique_ptr<SourceLocation>,
int exceptionId) {
- DCHECK(!isMainThread());
+ DCHECK(m_globalScope->isContextThread());
// Not suppported in SharedWorker.
}
@@ -54,25 +54,31 @@ void WebSharedWorkerReportingProxyImpl::reportConsoleMessage(
MessageLevel,
const String& message,
SourceLocation*) {
- DCHECK(!isMainThread());
+ DCHECK(m_globalScope->isContextThread());
// Not supported in SharedWorker.
}
void WebSharedWorkerReportingProxyImpl::postMessageToPageInspector(
const String& message) {
- DCHECK(!isMainThread());
+ DCHECK(m_globalScope->isContextThread());
// The TaskType of Inspector tasks need to be Unthrottled because they need to
// run even on a suspended page.
- m_parentFrameTaskRunners->get(TaskType::Unthrottled)
+ FrameTaskRunnerHelper::get(TaskType::Unthrottled, m_globalScope.get())
->postTask(
BLINK_FROM_HERE,
crossThreadBind(&WebSharedWorkerImpl::postMessageToPageInspector,
crossThreadUnretained(m_worker), message));
}
+void WebSharedWorkerReportingProxyImpl::didCreateWorkerGlobalScope(
+ WorkerOrWorkletGlobalScope* globalScope) {
+ DCHECK(globalScope->isContextThread());
+ m_globalScope = globalScope;
+}
+
void WebSharedWorkerReportingProxyImpl::didCloseWorkerGlobalScope() {
- DCHECK(!isMainThread());
- m_parentFrameTaskRunners->get(TaskType::UnspecedTimer)
+ DCHECK(m_globalScope->isContextThread());
+ FrameTaskRunnerHelper::get(TaskType::UnspecedTimer, m_globalScope.get())
->postTask(
BLINK_FROM_HERE,
crossThreadBind(&WebSharedWorkerImpl::didCloseWorkerGlobalScope,
@@ -80,15 +86,14 @@ void WebSharedWorkerReportingProxyImpl::didCloseWorkerGlobalScope() {
}
void WebSharedWorkerReportingProxyImpl::didTerminateWorkerThread() {
- DCHECK(!isMainThread());
- m_parentFrameTaskRunners->get(TaskType::UnspecedTimer)
+ DCHECK(m_globalScope->isContextThread());
+ FrameTaskRunnerHelper::get(TaskType::UnspecedTimer, m_globalScope.get())
->postTask(BLINK_FROM_HERE,
crossThreadBind(&WebSharedWorkerImpl::didTerminateWorkerThread,
crossThreadUnretained(m_worker)));
}
DEFINE_TRACE(WebSharedWorkerReportingProxyImpl) {
- visitor->trace(m_parentFrameTaskRunners);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/web/WebSharedWorkerReportingProxyImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698