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

Unified Diff: content/renderer/presentation/presentation_connection_proxy.cc

Issue 2874483002: [Presentation API] Remove closed connections from PresentationConnectionList (Closed)
Patch Set: Created 3 years, 7 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: 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 d1488ed3896a925ecdd754244331dcde43058c04..55d49515744ff97c081f89911a29383bb043e166 100644
--- a/content/renderer/presentation/presentation_connection_proxy.cc
+++ b/content/renderer/presentation/presentation_connection_proxy.cc
@@ -63,7 +63,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);
}
@@ -91,8 +91,12 @@ ControllerConnectionProxy::MakeRemoteRequest() {
}
ReceiverConnectionProxy::ReceiverConnectionProxy(
- blink::WebPresentationConnection* receiver_connection)
- : PresentationConnectionProxy(receiver_connection) {}
+ blink::WebPresentationConnection* receiver_connection,
+ const OnConnectionClosedCallback& connection_closed_callback)
+ : PresentationConnectionProxy(receiver_connection),
+ connection_closed_callback_(connection_closed_callback) {
+ DCHECK(connection_closed_callback_);
+}
ReceiverConnectionProxy::~ReceiverConnectionProxy() = default;
@@ -111,4 +115,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)
+ connection_closed_callback_.Run();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698