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

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

Issue 2196133002: Revert of Pass per-frame task runners to Workers (when possible) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: crud Created 4 years, 5 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/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 11dcf4d63be9ed93f745f5bcac93cbe92bfaee3f..67331812f1d1c2d8eb3341dc5a17c750b01a645c 100644
--- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
+++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
@@ -37,9 +37,6 @@
#include "core/dom/ExecutionContext.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/workers/InProcessWorkerMessagingProxy.h"
-#include "core/workers/ParentFrameTaskRunners.h"
-#include "platform/CrossThreadFunctional.h"
-#include "public/platform/WebTaskRunner.h"
#include "wtf/Functional.h"
#include "wtf/PtrUtil.h"
#include <memory>
@@ -54,55 +51,51 @@ std::unique_ptr<InProcessWorkerObjectProxy> InProcessWorkerObjectProxy::create(I
void InProcessWorkerObjectProxy::postMessageToWorkerObject(PassRefPtr<SerializedScriptValue> message, std::unique_ptr<MessagePortChannelArray> channels)
{
- getParentFrameTaskRunners()->getUnthrottledTaskRunner()->postTask(BLINK_FROM_HERE, crossThreadBind(&InProcessWorkerMessagingProxy::postMessageToWorkerObject, crossThreadUnretained(m_messagingProxy), message, passed(std::move(channels))));
+ getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::postMessageToWorkerObject, crossThreadUnretained(m_messagingProxy), message, passed(std::move(channels))));
}
void InProcessWorkerObjectProxy::postTaskToMainExecutionContext(std::unique_ptr<ExecutionContextTask> task)
{
- // TODO(hiroshige,yuryu): Make this not use ExecutionContextTask and use
- // getParentFrameTaskRunners() instead.
getExecutionContext()->postTask(BLINK_FROM_HERE, std::move(task));
}
void InProcessWorkerObjectProxy::confirmMessageFromWorkerObject(bool hasPendingActivity)
{
- getParentFrameTaskRunners()->getUnthrottledTaskRunner()->postTask(BLINK_FROM_HERE, crossThreadBind(&InProcessWorkerMessagingProxy::confirmMessageFromWorkerObject, crossThreadUnretained(m_messagingProxy), hasPendingActivity));
+ getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::confirmMessageFromWorkerObject, crossThreadUnretained(m_messagingProxy), hasPendingActivity));
}
void InProcessWorkerObjectProxy::reportPendingActivity(bool hasPendingActivity)
{
- getParentFrameTaskRunners()->getUnthrottledTaskRunner()->postTask(BLINK_FROM_HERE, crossThreadBind(&InProcessWorkerMessagingProxy::reportPendingActivity, crossThreadUnretained(m_messagingProxy), hasPendingActivity));
+ getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportPendingActivity, crossThreadUnretained(m_messagingProxy), hasPendingActivity));
}
void InProcessWorkerObjectProxy::reportException(const String& errorMessage, std::unique_ptr<SourceLocation> location, int exceptionId)
{
- getParentFrameTaskRunners()->getUnthrottledTaskRunner()->postTask(BLINK_FROM_HERE, crossThreadBind(&InProcessWorkerMessagingProxy::reportException, crossThreadUnretained(m_messagingProxy), errorMessage, passed(std::move(location)), exceptionId));
+ // TODO(kinuko): Pass exceptionId through to reland reverted parts of r408863.
+ getExecutionContext()->postTask(BLINK_FROM_HERE, crossThreadBind(&InProcessWorkerMessagingProxy::reportException, crossThreadUnretained(m_messagingProxy), errorMessage, passed(std::move(location))));
}
void InProcessWorkerObjectProxy::reportConsoleMessage(ConsoleMessage* consoleMessage)
{
- getParentFrameTaskRunners()->getUnthrottledTaskRunner()->postTask(BLINK_FROM_HERE, crossThreadBind(&InProcessWorkerMessagingProxy::reportConsoleMessage, crossThreadUnretained(m_messagingProxy), consoleMessage->source(), consoleMessage->level(), consoleMessage->message(), passed(consoleMessage->location()->clone())));
+ getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::reportConsoleMessage, crossThreadUnretained(m_messagingProxy), consoleMessage->source(), consoleMessage->level(), consoleMessage->message(), passed(consoleMessage->location()->clone())));
}
void InProcessWorkerObjectProxy::postMessageToPageInspector(const String& message)
{
ExecutionContext* context = getExecutionContext();
- if (context->isDocument()) {
- // TODO(hiroshige): consider using getParentFrameTaskRunners() here
- // too.
+ if (context->isDocument())
toDocument(context)->postInspectorTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::postMessageToPageInspector, crossThreadUnretained(m_messagingProxy), message));
- }
}
void InProcessWorkerObjectProxy::workerGlobalScopeClosed()
{
- getParentFrameTaskRunners()->getUnthrottledTaskRunner()->postTask(BLINK_FROM_HERE, crossThreadBind(&InProcessWorkerMessagingProxy::terminateWorkerGlobalScope, crossThreadUnretained(m_messagingProxy)));
+ getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::terminateWorkerGlobalScope, crossThreadUnretained(m_messagingProxy)));
}
void InProcessWorkerObjectProxy::workerThreadTerminated()
{
// This will terminate the MessagingProxy.
- getParentFrameTaskRunners()->getUnthrottledTaskRunner()->postTask(BLINK_FROM_HERE, crossThreadBind(&InProcessWorkerMessagingProxy::workerThreadTerminated, crossThreadUnretained(m_messagingProxy)));
+ getExecutionContext()->postTask(BLINK_FROM_HERE, createCrossThreadTask(&InProcessWorkerMessagingProxy::workerThreadTerminated, crossThreadUnretained(m_messagingProxy)));
}
InProcessWorkerObjectProxy::InProcessWorkerObjectProxy(InProcessWorkerMessagingProxy* messagingProxy)
@@ -110,12 +103,6 @@ InProcessWorkerObjectProxy::InProcessWorkerObjectProxy(InProcessWorkerMessagingP
{
}
-ParentFrameTaskRunners* InProcessWorkerObjectProxy::getParentFrameTaskRunners()
-{
- DCHECK(m_messagingProxy);
- return m_messagingProxy->getParentFrameTaskRunners();
-}
-
ExecutionContext* InProcessWorkerObjectProxy::getExecutionContext()
{
DCHECK(m_messagingProxy);

Powered by Google App Engine
This is Rietveld 408576698