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

Unified Diff: third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp

Issue 1876703002: Oilpan: Replace EAGERLY_FINALIZE in EventTarget's hierarchy with pre-finalizers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/modules/mediastream/RTCPeerConnection.cpp
diff --git a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
index b77dd2f8ae5540744ef64cc33e49bd450fbe26e6..8bfd9bc601afb519021353d4d1e58b50ff8a0a77 100644
--- a/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
+++ b/third_party/WebKit/Source/modules/mediastream/RTCPeerConnection.cpp
@@ -413,6 +413,7 @@ RTCPeerConnection::RTCPeerConnection(ExecutionContext* context, RTCConfiguration
, m_stopped(false)
, m_closed(false)
{
+ ThreadState::current()->registerPreFinalizer(this);
Document* document = toDocument(getExecutionContext());
// If we fail, set |m_closed| and |m_stopped| to true, to avoid hitting the assert in the destructor.
@@ -449,6 +450,13 @@ RTCPeerConnection::~RTCPeerConnection()
DCHECK(m_closed || m_stopped);
}
+void RTCPeerConnection::dispose()
+{
+ // Promptly clears a raw reference from content/ to an on-heap object
+ // so that content/ doesn't access it in a lazy sweeping phase.
+ m_peerHandler.clear();
+}
+
ScriptPromise RTCPeerConnection::createOffer(ScriptState* scriptState, const RTCOfferOptions& options)
{
if (m_signalingState == SignalingStateClosed)

Powered by Google App Engine
This is Rietveld 408576698