Add comments about PeerConnection::Close and PeerConnectionObserver.

Documenting that the observer can safely be destroyed after Close has
been called, because it ensures no more callbacks will be invoked. Just
like in JavaScript land, where no more events will be fired after
"close" is called.

This is already covered by unit tests.

BUG=webrtc:7491
NOTRY=True
TBR=pthatcher@webrtc.org

Review-Url: https://codereview.webrtc.org/2834543005
Cr-Commit-Position: refs/heads/master@{#17798}
diff --git a/webrtc/api/peerconnectioninterface.h b/webrtc/api/peerconnectioninterface.h
index d30834d..e384fba 100644
--- a/webrtc/api/peerconnectioninterface.h
+++ b/webrtc/api/peerconnectioninterface.h
@@ -753,6 +753,10 @@
 
   // Terminates all media, closes the transports, and in general releases any
   // resources used by the PeerConnection. This is an irreversible operation.
+  //
+  // Note that after this method completes, the PeerConnection will no longer
+  // use the PeerConnectionObserver interface passed in on construction, and
+  // thus the observer object can be safely destroyed.
   virtual void Close() = 0;
 
  protected:
@@ -880,6 +884,15 @@
 
   virtual void SetOptions(const Options& options) = 0;
 
+  // |allocator| and |cert_generator| may be null, in which case default
+  // implementations will be used.
+  //
+  // |observer| must not be null.
+  //
+  // Note that this method does not take ownership of |observer|; it's the
+  // responsibility of the caller to delete it. It can be safely deleted after
+  // Close has been called on the returned PeerConnection, which ensures no
+  // more observer callbacks will be invoked.
   virtual rtc::scoped_refptr<PeerConnectionInterface> CreatePeerConnection(
       const PeerConnectionInterface::RTCConfiguration& configuration,
       std::unique_ptr<cricket::PortAllocator> allocator,