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

Unified Diff: Source/core/workers/WorkerMessagingProxy.cpp

Issue 1257653007: Oilpan: Remove raw pointer to InProcessWorkerBase from WorkerMessagingProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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: Source/core/workers/WorkerMessagingProxy.cpp
diff --git a/Source/core/workers/WorkerMessagingProxy.cpp b/Source/core/workers/WorkerMessagingProxy.cpp
index 228b63f2c06ab3701369fcccec7e8befc0ea8e05..2305a09d16256ec913558b9d830deea28c3d90d7 100644
--- a/Source/core/workers/WorkerMessagingProxy.cpp
+++ b/Source/core/workers/WorkerMessagingProxy.cpp
@@ -81,13 +81,18 @@ WorkerMessagingProxy::WorkerMessagingProxy(InProcessWorkerBase* workerObject, Pa
ASSERT((m_executionContext->isDocument() && isMainThread())
|| (m_executionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_executionContext.get())->thread()->isCurrentThread()));
m_workerInspectorProxy->setWorkerGlobalScopeProxy(this);
+#if ENABLE(OILPAN)
+ m_keepAlive = adoptPtr(new Persistent<WorkerMessagingProxy>(this));
+#endif
}
WorkerMessagingProxy::~WorkerMessagingProxy()
{
ASSERT(!m_workerObject);
+#if !ENABLE(OILPAN)
ASSERT((m_executionContext->isDocument() && isMainThread())
|| (m_executionContext->isWorkerGlobalScope() && toWorkerGlobalScope(m_executionContext.get())->thread()->isCurrentThread()));
+#endif
if (m_loaderProxy)
m_loaderProxy->detachProvider(this);
}
@@ -222,8 +227,13 @@ void WorkerMessagingProxy::workerThreadTerminated()
m_askedToTerminate = true;
m_workerThread = nullptr;
terminateInternally();
- if (m_mayBeDestroyed)
+ if (m_mayBeDestroyed) {
+#if ENABLE(OILPAN)
+ m_keepAlive.release();
+#else
delete this;
+#endif
+ }
}
void WorkerMessagingProxy::terminateWorkerGlobalScope()
@@ -292,4 +302,19 @@ void WorkerMessagingProxy::terminateInternally()
frame->console().adoptWorkerMessagesAfterTermination(this);
}
+void WorkerMessagingProxy::clearWeakMembers(Visitor* visitor)
+{
+ if (Heap::isHeapObjectAlive(m_workerObject))
+ return;
+ workerObjectDestroyed();
haraken 2015/07/30 11:46:31 It is not nice to call workerObjectDestroyed() in
+}
+
+DEFINE_TRACE(WorkerMessagingProxy)
+{
+ visitor->trace(m_executionContext);
+ visitor->trace(m_workerClients);
+ visitor->template registerWeakMembers<WorkerMessagingProxy, &WorkerMessagingProxy::clearWeakMembers>(this);
+ WorkerGlobalScopeProxy::trace(visitor);
+}
+
} // namespace blink
« Source/core/workers/WorkerMessagingProxy.h ('K') | « Source/core/workers/WorkerMessagingProxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698