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

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

Issue 329093002: Allow PeerConnection to be garbage collected after close(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Data channel now has a weak ptr to the peer connection that created it. Stops itself if creator goe… 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/RTCDataChannel.h
diff --git a/Source/modules/mediastream/RTCDataChannel.h b/Source/modules/mediastream/RTCDataChannel.h
index 8cd17b7b7034a3c878273012e3463aa72d3c2af7..42946d66d6e68344e00bb88fa02c764f956b7dab 100644
--- a/Source/modules/mediastream/RTCDataChannel.h
+++ b/Source/modules/mediastream/RTCDataChannel.h
@@ -43,13 +43,14 @@ namespace WebCore {
class Blob;
class ExceptionState;
+class RTCPeerConnection;
class RTCDataChannel FINAL : public RefCountedWillBeRefCountedGarbageCollected<RTCDataChannel>, public ScriptWrappable, public EventTargetWithInlineData, public blink::WebRTCDataChannelHandlerClient {
REFCOUNTED_EVENT_TARGET(RTCDataChannel);
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(RTCDataChannel);
public:
- static PassRefPtrWillBeRawPtr<RTCDataChannel> create(ExecutionContext*, PassOwnPtr<blink::WebRTCDataChannelHandler>);
- static PassRefPtrWillBeRawPtr<RTCDataChannel> create(ExecutionContext*, blink::WebRTCPeerConnectionHandler*, const String& label, const blink::WebRTCDataChannelInit&, ExceptionState&);
+ static PassRefPtrWillBeRawPtr<RTCDataChannel> create(ExecutionContext*, WeakPtrWillBeRawPtr<RTCPeerConnection>, PassOwnPtr<blink::WebRTCDataChannelHandler>);
+ static PassRefPtrWillBeRawPtr<RTCDataChannel> create(ExecutionContext*, WeakPtrWillBeRawPtr<RTCPeerConnection>, blink::WebRTCPeerConnectionHandler*, const String& label, const blink::WebRTCDataChannelInit&, ExceptionState&);
virtual ~RTCDataChannel();
String label() const;
@@ -90,7 +91,7 @@ public:
virtual void trace(Visitor*) OVERRIDE;
private:
- RTCDataChannel(ExecutionContext*, PassOwnPtr<blink::WebRTCDataChannelHandler>);
+ RTCDataChannel(ExecutionContext*, WeakPtrWillBeRawPtr<RTCPeerConnection>, PassOwnPtr<blink::WebRTCDataChannelHandler>);
void scheduleDispatchEvent(PassRefPtrWillBeRawPtr<Event>);
void scheduledEventTimerFired(Timer<RTCDataChannel>*);
@@ -103,6 +104,8 @@ private:
virtual void didReceiveRawData(const char*, size_t) OVERRIDE;
virtual void didDetectError() OVERRIDE;
+ void stopAndFireCloseEventIfCreatorWasDeleted();
+
OwnPtr<blink::WebRTCDataChannelHandler> m_handler;
bool m_stopped;
@@ -117,6 +120,8 @@ private:
Timer<RTCDataChannel> m_scheduledEventTimer;
WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents;
+
+ WeakPtrWillBeWeakMember<RTCPeerConnection> m_creator;
keishi 2014/06/17 07:58:21 We need to trace members. You need to add this lin
Henrik Grunell 2014/06/17 08:08:27 Done.
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698