Index: mojo/services/network/http_connection_impl.cc |
diff --git a/mojo/services/network/http_connection_impl.cc b/mojo/services/network/http_connection_impl.cc |
index 77d7a9165c61c3cc87ed79448d75993fa157dda5..1fb8a4444860a810b9cd8d94f4073e4da8a4a86b 100644 |
--- a/mojo/services/network/http_connection_impl.cc |
+++ b/mojo/services/network/http_connection_impl.cc |
@@ -85,8 +85,7 @@ class HttpConnectionImpl::SimpleDataPipeReader { |
DISALLOW_COPY_AND_ASSIGN(SimpleDataPipeReader); |
}; |
-class HttpConnectionImpl::WebSocketImpl : public WebSocket, |
- public ErrorHandler { |
+class HttpConnectionImpl::WebSocketImpl : public WebSocket { |
public: |
// |connection| must outlive this object. |
WebSocketImpl(HttpConnectionImpl* connection, |
@@ -103,8 +102,8 @@ class HttpConnectionImpl::WebSocketImpl : public WebSocket, |
DCHECK(client_); |
DCHECK(send_stream_.is_valid()); |
- binding_.set_error_handler(this); |
- client_.set_error_handler(this); |
+ binding_.set_connection_error_handler([this]() { Close(); }); |
+ client_.set_connection_error_handler([this]() { Close(); }); |
DataPipe data_pipe; |
receive_stream_ = data_pipe.producer_handle.Pass(); |
@@ -173,9 +172,6 @@ class HttpConnectionImpl::WebSocketImpl : public WebSocket, |
Close(); |
} |
- // ErrorHandler implementation. |
- void OnConnectionError() override { Close(); } |
- |
void OnFinishedReadingSendStream(uint32_t num_bytes, const char* data) { |
DCHECK_GT(pending_send_count_, 0u); |
pending_send_count_--; |
@@ -263,8 +259,8 @@ HttpConnectionImpl::HttpConnectionImpl(int connection_id, |
delegate_(delegate.Pass()), |
binding_(this, connection) { |
DCHECK(delegate_); |
- binding_.set_error_handler(this); |
- delegate_.set_error_handler(this); |
+ binding_.set_connection_error_handler([this]() { Close(); }); |
+ delegate_.set_connection_error_handler([this]() { Close(); }); |
} |
HttpConnectionImpl::~HttpConnectionImpl() { |
@@ -344,14 +340,6 @@ void HttpConnectionImpl::SetReceiveBufferSize( |
callback.Run(MakeNetworkError(net::OK)); |
} |
-void HttpConnectionImpl::OnConnectionError() { |
- // This method is called when the proxy side of |binding_| or the impl side of |
- // |delegate_| has closed the pipe. Although it is set as error handler for |
- // both |binding_| and |delegate_|, it will only be called at most once |
- // because when called it closes/resets |binding_| and |delegate_|. |
- Close(); |
-} |
- |
void HttpConnectionImpl::OnFinishedReadingResponseBody( |
HttpResponsePtr response, |
SimpleDataPipeReader* reader, |