Index: content/renderer/presentation/presentation_connection_proxy.cc |
diff --git a/content/renderer/presentation/presentation_connection_proxy.cc b/content/renderer/presentation/presentation_connection_proxy.cc |
index dd911aae55f4da549cd36c3f4c84ecb466e113a7..53677179ff043168a7e889ac9a7314bf4cc380dc 100644 |
--- a/content/renderer/presentation/presentation_connection_proxy.cc |
+++ b/content/renderer/presentation/presentation_connection_proxy.cc |
@@ -11,6 +11,7 @@ |
#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationConnection.h" |
#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationController.h" |
#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationInfo.h" |
+#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationReceiver.h" |
namespace content { |
@@ -66,7 +67,7 @@ void PresentationConnectionProxy::DidChangeState( |
void PresentationConnectionProxy::OnClose() { |
DCHECK(target_connection_ptr_); |
- source_connection_->DidClose(); |
+ DidChangeState(content::PRESENTATION_CONNECTION_STATE_CLOSED); |
target_connection_ptr_->DidChangeState( |
content::PRESENTATION_CONNECTION_STATE_CLOSED); |
} |
@@ -105,8 +106,11 @@ ControllerConnectionProxy::MakeRemoteRequest() { |
} |
ReceiverConnectionProxy::ReceiverConnectionProxy( |
- blink::WebPresentationConnection* receiver_connection) |
- : PresentationConnectionProxy(receiver_connection) {} |
+ blink::WebPresentationConnection* receiver_connection, |
+ blink::WebPresentationReceiver* receiver) |
+ : PresentationConnectionProxy(receiver_connection), receiver_(receiver) { |
+ DCHECK(receiver_); |
+} |
ReceiverConnectionProxy::~ReceiverConnectionProxy() = default; |
@@ -125,4 +129,11 @@ void ReceiverConnectionProxy::BindControllerConnection( |
DidChangeState(content::PRESENTATION_CONNECTION_STATE_CONNECTED); |
} |
+void ReceiverConnectionProxy::DidChangeState( |
+ content::PresentationConnectionState state) { |
+ PresentationConnectionProxy::DidChangeState(state); |
+ if (state == content::PRESENTATION_CONNECTION_STATE_CLOSED) |
+ receiver_->RemoveConnection(source_connection_); |
+} |
+ |
} // namespace content |