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

Unified Diff: Source/modules/mediastream/RTCPeerConnection.h

Issue 329093002: Allow PeerConnection to be garbage collected after close(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Code review. Created 6 years, 6 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/modules/mediastream/RTCPeerConnection.h
diff --git a/Source/modules/mediastream/RTCPeerConnection.h b/Source/modules/mediastream/RTCPeerConnection.h
index 03c6137400bfefde3f731e99e64024106e89e41d..6725ef24243dc0af44e79645d0ce07140c95b08c 100644
--- a/Source/modules/mediastream/RTCPeerConnection.h
+++ b/Source/modules/mediastream/RTCPeerConnection.h
@@ -104,6 +104,10 @@ public:
void close(ExceptionState&);
+ // We allow getStats after close, but not other calls or callbacks.
+ bool shouldFireDefaultCallbacks() { return !m_closed && !m_stopped; }
+ bool shouldFireGetStatsCallback() { return !m_stopped; }
+
DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded);
DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate);
DEFINE_ATTRIBUTE_EVENT_LISTENER(signalingstatechange);
@@ -131,7 +135,11 @@ public:
virtual void suspend() OVERRIDE;
virtual void resume() OVERRIDE;
virtual void stop() OVERRIDE;
- virtual bool hasPendingActivity() const OVERRIDE { return !m_stopped; }
+ // We keep the this object alive until either stopped or closed.
+ virtual bool hasPendingActivity() const OVERRIDE
+ {
+ return !m_closed && !m_stopped;
+ }
virtual void trace(Visitor*) OVERRIDE;
@@ -162,6 +170,7 @@ private:
WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents;
bool m_stopped;
+ bool m_closed;
};
} // namespace WebCore
« no previous file with comments | « LayoutTests/fast/mediastream/RTCPeerConnection-stats-expected.txt ('k') | Source/modules/mediastream/RTCPeerConnection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698