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

Unified Diff: third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp

Issue 2566623002: Worker: Factor out common functions into ThreadedObjectProxyBase (Closed)
Patch Set: fix layout tests Created 4 years 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/core/workers/InProcessWorkerObjectProxy.cpp
diff --git a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
index 720bd9d378721e58bf10d7eb6dd4ba6bc7e215a5..0a5aa0915d116f5c9ec01e236d03b54b717dfed8 100644
--- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
+++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
@@ -97,6 +97,8 @@ void InProcessWorkerObjectProxy::startPendingActivityTimer() {
}
void InProcessWorkerObjectProxy::countFeature(UseCounter::Feature feature) {
+ // TODO(nhiroki): Move this to ThreadedObjectProxyBase so that
+ // ThreadedWorklets can record API use (https://crbug.com/667357).
getParentFrameTaskRunners()
->get(TaskType::Internal)
->postTask(BLINK_FROM_HERE,
@@ -105,6 +107,8 @@ void InProcessWorkerObjectProxy::countFeature(UseCounter::Feature feature) {
}
void InProcessWorkerObjectProxy::countDeprecation(UseCounter::Feature feature) {
+ // TODO(nhiroki): Move this to ThreadedObjectProxyBase so that
+ // ThreadedWorklets can record API use (https://crbug.com/667357).
getParentFrameTaskRunners()
->get(TaskType::Internal)
->postTask(
@@ -126,37 +130,6 @@ void InProcessWorkerObjectProxy::reportException(
WTF::passed(location->clone()), exceptionId));
}
-void InProcessWorkerObjectProxy::reportConsoleMessage(
- MessageSource source,
- MessageLevel level,
- const String& message,
- SourceLocation* location) {
- getParentFrameTaskRunners()
- ->get(TaskType::Internal)
- ->postTask(
- BLINK_FROM_HERE,
- crossThreadBind(&InProcessWorkerMessagingProxy::reportConsoleMessage,
- m_messagingProxyWeakPtr, source, level, message,
- WTF::passed(location->clone())));
-}
-
-void InProcessWorkerObjectProxy::postMessageToPageInspector(
- const String& message) {
- // The TaskType of Inspector tasks need to be Unthrottled because they need to
- // run even on a suspended page.
- getParentFrameTaskRunners()
- ->get(TaskType::Unthrottled)
- ->postTask(BLINK_FROM_HERE,
- crossThreadBind(
- &InProcessWorkerMessagingProxy::postMessageToPageInspector,
- m_messagingProxyWeakPtr, message));
-}
-
-ParentFrameTaskRunners*
-InProcessWorkerObjectProxy::getParentFrameTaskRunners() {
- return m_parentFrameTaskRunners.get();
-}
-
void InProcessWorkerObjectProxy::didCreateWorkerGlobalScope(
WorkerOrWorkletGlobalScope* globalScope) {
DCHECK(!m_workerGlobalScope);
@@ -169,35 +142,16 @@ void InProcessWorkerObjectProxy::didEvaluateWorkerScript(bool) {
startPendingActivityTimer();
}
-void InProcessWorkerObjectProxy::didCloseWorkerGlobalScope() {
- getParentFrameTaskRunners()
- ->get(TaskType::Internal)
- ->postTask(
- BLINK_FROM_HERE,
- crossThreadBind(&InProcessWorkerMessagingProxy::terminateGlobalScope,
- m_messagingProxyWeakPtr));
-}
-
void InProcessWorkerObjectProxy::willDestroyWorkerGlobalScope() {
m_timer.reset();
m_workerGlobalScope = nullptr;
}
-void InProcessWorkerObjectProxy::didTerminateWorkerThread() {
- // This will terminate the MessagingProxy.
- getParentFrameTaskRunners()
- ->get(TaskType::Internal)
- ->postTask(BLINK_FROM_HERE,
- crossThreadBind(
- &InProcessWorkerMessagingProxy::workerThreadTerminated,
- m_messagingProxyWeakPtr));
-}
-
InProcessWorkerObjectProxy::InProcessWorkerObjectProxy(
const WeakPtr<InProcessWorkerMessagingProxy>& messagingProxyWeakPtr,
ParentFrameTaskRunners* parentFrameTaskRunners)
- : m_messagingProxyWeakPtr(messagingProxyWeakPtr),
- m_parentFrameTaskRunners(parentFrameTaskRunners),
+ : ThreadedObjectProxyBase(parentFrameTaskRunners),
+ m_messagingProxyWeakPtr(messagingProxyWeakPtr),
m_defaultIntervalInSec(kDefaultIntervalInSec),
m_nextIntervalInSec(kDefaultIntervalInSec),
m_maxIntervalInSec(kMaxIntervalInSec) {}
@@ -224,4 +178,9 @@ void InProcessWorkerObjectProxy::checkPendingActivity(TimerBase*) {
startPendingActivityTimer();
}
+WeakPtr<ThreadedMessagingProxyBase>
+InProcessWorkerObjectProxy::messagingProxyWeakPtr() {
+ return m_messagingProxyWeakPtr;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698