Chromium Code Reviews| Index: Source/modules/mediastream/RTCPeerConnection.h |
| diff --git a/Source/modules/mediastream/RTCPeerConnection.h b/Source/modules/mediastream/RTCPeerConnection.h |
| index 03c6137400bfefde3f731e99e64024106e89e41d..7355a474a4a8a18e533bc28215d83b8b4bc21c3a 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 requestMayFireNonStatsCallback() { return !m_closed && !m_stopped; } |
| + bool requestMayFireStatsCallback() { return !m_stopped; } |
|
haraken
2014/06/17 11:43:45
Nit: I'd rename these methods to shouldFireDefault
Henrik Grunell
2014/06/17 12:12:21
Done.
|
| + |
| DEFINE_ATTRIBUTE_EVENT_LISTENER(negotiationneeded); |
| DEFINE_ATTRIBUTE_EVENT_LISTENER(icecandidate); |
| DEFINE_ATTRIBUTE_EVENT_LISTENER(signalingstatechange); |
| @@ -131,7 +135,20 @@ public: |
| virtual void suspend() OVERRIDE; |
| virtual void resume() OVERRIDE; |
| virtual void stop() OVERRIDE; |
| - virtual bool hasPendingActivity() const OVERRIDE { return !m_stopped; } |
| + // We require a call to close() or stop() before the object can be garbage |
| + // collected. In close(), stop() is called on |m_peer_handler|, after which |
| + // no events are fired on this object |
| + // (blink::WebRTCPeerConnectionHandlerClient interface). In stop(), |
| + // |m_peer_handler| is deleted. Note that async operations such as |
| + // createOffer or getStats doesn't respond through this object, but through |
| + // a request object containing the callback. The request object is handed to |
| + // the client. Hence, we don't need to keep track of if there are still |
| + // outstandning requests. The request is given a pointer to this object and |
| + // checks if it should fire the callback before doing so. |
|
haraken
2014/06/17 11:43:45
Nit: This comment sounds a bit redundant. Can we j
Henrik Grunell
2014/06/17 12:12:21
Done.
|
| + virtual bool hasPendingActivity() const OVERRIDE |
| + { |
| + return !m_closed && !m_stopped; |
| + } |
| virtual void trace(Visitor*) OVERRIDE; |
| @@ -162,6 +179,7 @@ private: |
| WillBeHeapVector<RefPtrWillBeMember<Event> > m_scheduledEvents; |
| bool m_stopped; |
| + bool m_closed; |
| }; |
| } // namespace WebCore |