Commit 69eb751a authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

Clean up Binding from WebSocketHandleImpl

This CL replaces |client_binding_| with |client_receiver_|
from WebSocketHandleImpl to use new Mojo types.

Bug: 955171, 978694
Change-Id: I3a60e4c4a60b8edb769f006d92f2339ffe32101b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1777341Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692046}
parent 71180a21
...@@ -27,7 +27,6 @@ WebSocketHandleImpl::WebSocketHandleImpl( ...@@ -27,7 +27,6 @@ WebSocketHandleImpl::WebSocketHandleImpl(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: task_runner_(std::move(task_runner)), : task_runner_(std::move(task_runner)),
channel_(nullptr), channel_(nullptr),
client_binding_(this),
readable_watcher_(FROM_HERE, readable_watcher_(FROM_HERE,
mojo::SimpleWatcher::ArmingPolicy::MANUAL, mojo::SimpleWatcher::ArmingPolicy::MANUAL,
task_runner_) { task_runner_) {
...@@ -160,10 +159,10 @@ void WebSocketHandleImpl::OnConnectionEstablished( ...@@ -160,10 +159,10 @@ void WebSocketHandleImpl::OnConnectionEstablished(
if (!channel_) if (!channel_)
return; return;
// From now on, we will detect mojo errors via |client_binding_|. // From now on, we will detect mojo errors via |client_receiver_|.
handshake_client_receiver_.reset(); handshake_client_receiver_.reset();
client_binding_.Bind(std::move(client_receiver), task_runner_); client_receiver_.Bind(std::move(client_receiver), task_runner_);
client_binding_.set_connection_error_with_reason_handler( client_receiver_.set_disconnect_with_reason_handler(
WTF::Bind(&WebSocketHandleImpl::OnConnectionError, WTF::Unretained(this), WTF::Bind(&WebSocketHandleImpl::OnConnectionError, WTF::Unretained(this),
FROM_HERE)); FROM_HERE));
...@@ -233,7 +232,7 @@ void WebSocketHandleImpl::ConsumePendingDataFrames() { ...@@ -233,7 +232,7 @@ void WebSocketHandleImpl::ConsumePendingDataFrames() {
return; return;
} }
if (begin_result == MOJO_RESULT_FAILED_PRECONDITION) { if (begin_result == MOJO_RESULT_FAILED_PRECONDITION) {
// |client_binding_| will catch the connection error. // |client_receiver_| will catch the connection error.
return; return;
} }
DCHECK_EQ(begin_result, MOJO_RESULT_OK); DCHECK_EQ(begin_result, MOJO_RESULT_OK);
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBSOCKETS_WEBSOCKET_HANDLE_IMPL_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBSOCKETS_WEBSOCKET_HANDLE_IMPL_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBSOCKETS_WEBSOCKET_HANDLE_IMPL_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBSOCKETS_WEBSOCKET_HANDLE_IMPL_H_
#include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
#include "services/network/public/mojom/websocket.mojom-blink.h" #include "services/network/public/mojom/websocket.mojom-blink.h"
...@@ -121,7 +120,7 @@ class WebSocketHandleImpl ...@@ -121,7 +120,7 @@ class WebSocketHandleImpl
mojo::Remote<network::mojom::blink::WebSocket> websocket_; mojo::Remote<network::mojom::blink::WebSocket> websocket_;
mojo::Receiver<network::mojom::blink::WebSocketHandshakeClient> mojo::Receiver<network::mojom::blink::WebSocketHandshakeClient>
handshake_client_receiver_{this}; handshake_client_receiver_{this};
mojo::Binding<network::mojom::blink::WebSocketClient> client_binding_; mojo::Receiver<network::mojom::blink::WebSocketClient> client_receiver_{this};
// Datapipe fields to receive. // Datapipe fields to receive.
mojo::ScopedDataPipeConsumerHandle readable_; mojo::ScopedDataPipeConsumerHandle readable_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment