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

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

Issue 2874483002: [Presentation API] Remove closed connections from PresentationConnectionList (Closed)
Patch Set: rebase with master 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 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

Powered by Google App Engine
This is Rietveld 408576698