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

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

Issue 2546043002: Worker: Fix cross-thread violations on ObjectProxy (Closed)
Patch Set: 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 bc60b0f65ac2f6e26394438d260062fe31c32ea5..4fd495cdcb8155c50a1388e5ce78ec6127c639d0 100644
--- a/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
+++ b/third_party/WebKit/Source/core/workers/InProcessWorkerObjectProxy.cpp
@@ -53,9 +53,11 @@ const double kDefaultIntervalInSec = 1;
const double kMaxIntervalInSec = 30;
std::unique_ptr<InProcessWorkerObjectProxy> InProcessWorkerObjectProxy::create(
- const WeakPtr<InProcessWorkerMessagingProxy>& messagingProxy) {
- DCHECK(messagingProxy);
- return wrapUnique(new InProcessWorkerObjectProxy(messagingProxy));
+ const WeakPtr<InProcessWorkerMessagingProxy>& messagingProxyWeakPtr,
+ ParentFrameTaskRunners* parentFrameTaskRunners) {
+ DCHECK(messagingProxyWeakPtr);
+ return wrapUnique(new InProcessWorkerObjectProxy(messagingProxyWeakPtr,
+ parentFrameTaskRunners));
}
InProcessWorkerObjectProxy::~InProcessWorkerObjectProxy() {}
@@ -140,7 +142,6 @@ void InProcessWorkerObjectProxy::reportConsoleMessage(
void InProcessWorkerObjectProxy::postMessageToPageInspector(
const String& message) {
- DCHECK(getExecutionContext()->isDocument());
// The TaskType of Inspector tasks need to be Unthrottled because they need to
// run even on a suspended page.
getParentFrameTaskRunners()
@@ -153,8 +154,7 @@ void InProcessWorkerObjectProxy::postMessageToPageInspector(
ParentFrameTaskRunners*
InProcessWorkerObjectProxy::getParentFrameTaskRunners() {
- DCHECK(m_messagingProxy);
- return m_messagingProxy->getParentFrameTaskRunners();
+ return m_parentFrameTaskRunners.get();
}
void InProcessWorkerObjectProxy::didCreateWorkerGlobalScope(
@@ -194,18 +194,14 @@ void InProcessWorkerObjectProxy::didTerminateWorkerThread() {
}
InProcessWorkerObjectProxy::InProcessWorkerObjectProxy(
- const WeakPtr<InProcessWorkerMessagingProxy>& messagingProxy)
- : m_messagingProxy(messagingProxy.get()),
- m_messagingProxyWeakPtr(messagingProxy),
+ const WeakPtr<InProcessWorkerMessagingProxy>& messagingProxyWeakPtr,
+ ParentFrameTaskRunners* parentFrameTaskRunners)
+ : m_messagingProxyWeakPtr(messagingProxyWeakPtr),
+ m_parentFrameTaskRunners(parentFrameTaskRunners),
m_defaultIntervalInSec(kDefaultIntervalInSec),
m_nextIntervalInSec(kDefaultIntervalInSec),
m_maxIntervalInSec(kMaxIntervalInSec) {}
-ExecutionContext* InProcessWorkerObjectProxy::getExecutionContext() {
- DCHECK(m_messagingProxy);
- return m_messagingProxy->getExecutionContext();
-}
-
void InProcessWorkerObjectProxy::checkPendingActivity(TimerBase*) {
bool hasPendingActivity = V8GCController::hasPendingActivity(
m_workerGlobalScope->thread()->isolate(), m_workerGlobalScope);

Powered by Google App Engine
This is Rietveld 408576698