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

Unified Diff: third_party/WebKit/Source/web/CompositorProxyClientImpl.cpp

Issue 2204183002: Prepare CompositorWorker for per thread heap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 3 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/CompositorProxyClientImpl.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/CompositorProxyClientImpl.cpp
diff --git a/third_party/WebKit/Source/web/CompositorProxyClientImpl.cpp b/third_party/WebKit/Source/web/CompositorProxyClientImpl.cpp
index 4a621c5f1ab5d7c8d7e5e260394e8bf827287093..8cc8a83246e7b2a6457ff84dab4cd2a90cd5aa00 100644
--- a/third_party/WebKit/Source/web/CompositorProxyClientImpl.cpp
+++ b/third_party/WebKit/Source/web/CompositorProxyClientImpl.cpp
@@ -40,13 +40,12 @@ CompositorProxyClientImpl::CompositorProxyClientImpl(CompositorMutatorImpl* muta
: m_mutator(mutator)
, m_globalScope(nullptr)
{
+ DCHECK(isMainThread());
}
DEFINE_TRACE(CompositorProxyClientImpl)
{
CompositorProxyClient::trace(visitor);
- visitor->trace(m_mutator);
- visitor->trace(m_globalScope);
visitor->trace(m_proxies);
}
@@ -59,6 +58,17 @@ void CompositorProxyClientImpl::setGlobalScope(WorkerGlobalScope* scope)
m_mutator->registerProxyClient(this);
}
+void CompositorProxyClientImpl::dispose()
+{
+ // CompositorProxyClientImpl and CompositorMutatorImpl form a reference
+ // cycle. CompositorWorkerGlobalScope and CompositorProxyClientImpl
+ // also form another big reference cycle. So dispose needs to be called on
+ // Worker termination to break these cycles. If not, layout test leak
+ // detection will report a WorkerGlobalScope leak.
+ m_mutator->unregisterProxyClient(this);
+ m_globalScope = nullptr;
+}
+
void CompositorProxyClientImpl::requestAnimationFrame()
{
TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::requestAnimationFrame");
@@ -87,6 +97,7 @@ bool CompositorProxyClientImpl::executeAnimationFrameCallbacks(double monotonicT
{
TRACE_EVENT0("compositor-worker", "CompositorProxyClientImpl::executeAnimationFrameCallbacks");
+ DCHECK(m_globalScope);
// Convert to zero based document time in milliseconds consistent with requestAnimationFrame.
double highResTimeMs = 1000.0 * (monotonicTimeNow - m_globalScope->timeOrigin());
return m_globalScope->executeAnimationFrameCallbacks(highResTimeMs);
« no previous file with comments | « third_party/WebKit/Source/web/CompositorProxyClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698