Commit 5a2d1318 authored by Anna Malova's avatar Anna Malova Committed by Commit Bot

Convert WebSocketStreamRequestCreationCallback to OnceCallback.

Bug: 1007815
Change-Id: I8074e7e9cb2c59ceb9f06b25259170e1d1bb47ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087348Reviewed-by: default avatarMatt Menke <mmenke@chromium.org>
Reviewed-by: default avatarAdam Rice <ricea@chromium.org>
Commit-Queue: Anna Malova <amalova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747196}
parent 60a15a34
...@@ -267,7 +267,7 @@ void WebSocketChannel::SendAddChannelRequest( ...@@ -267,7 +267,7 @@ void WebSocketChannel::SendAddChannelRequest(
SendAddChannelRequestWithSuppliedCallback( SendAddChannelRequestWithSuppliedCallback(
socket_url, requested_subprotocols, origin, site_for_cookies, socket_url, requested_subprotocols, origin, site_for_cookies,
network_isolation_key, additional_headers, network_isolation_key, additional_headers,
base::Bind(&WebSocketStream::CreateAndConnectStream)); base::BindOnce(&WebSocketStream::CreateAndConnectStream));
} }
void WebSocketChannel::SetState(State new_state) { void WebSocketChannel::SetState(State new_state) {
...@@ -408,10 +408,10 @@ void WebSocketChannel::SendAddChannelRequestForTesting( ...@@ -408,10 +408,10 @@ void WebSocketChannel::SendAddChannelRequestForTesting(
const SiteForCookies& site_for_cookies, const SiteForCookies& site_for_cookies,
const net::NetworkIsolationKey& network_isolation_key, const net::NetworkIsolationKey& network_isolation_key,
const HttpRequestHeaders& additional_headers, const HttpRequestHeaders& additional_headers,
const WebSocketStreamRequestCreationCallback& callback) { WebSocketStreamRequestCreationCallback callback) {
SendAddChannelRequestWithSuppliedCallback( SendAddChannelRequestWithSuppliedCallback(
socket_url, requested_subprotocols, origin, site_for_cookies, socket_url, requested_subprotocols, origin, site_for_cookies,
network_isolation_key, additional_headers, callback); network_isolation_key, additional_headers, std::move(callback));
} }
void WebSocketChannel::SetClosingHandshakeTimeoutForTesting( void WebSocketChannel::SetClosingHandshakeTimeoutForTesting(
...@@ -431,7 +431,7 @@ void WebSocketChannel::SendAddChannelRequestWithSuppliedCallback( ...@@ -431,7 +431,7 @@ void WebSocketChannel::SendAddChannelRequestWithSuppliedCallback(
const SiteForCookies& site_for_cookies, const SiteForCookies& site_for_cookies,
const net::NetworkIsolationKey& network_isolation_key, const net::NetworkIsolationKey& network_isolation_key,
const HttpRequestHeaders& additional_headers, const HttpRequestHeaders& additional_headers,
const WebSocketStreamRequestCreationCallback& callback) { WebSocketStreamRequestCreationCallback callback) {
DCHECK_EQ(FRESHLY_CONSTRUCTED, state_); DCHECK_EQ(FRESHLY_CONSTRUCTED, state_);
if (!socket_url.SchemeIsWSOrWSS()) { if (!socket_url.SchemeIsWSOrWSS()) {
// TODO(ricea): Kill the renderer (this error should have been caught by // TODO(ricea): Kill the renderer (this error should have been caught by
...@@ -442,7 +442,7 @@ void WebSocketChannel::SendAddChannelRequestWithSuppliedCallback( ...@@ -442,7 +442,7 @@ void WebSocketChannel::SendAddChannelRequestWithSuppliedCallback(
} }
socket_url_ = socket_url; socket_url_ = socket_url;
auto connect_delegate = std::make_unique<ConnectDelegate>(this); auto connect_delegate = std::make_unique<ConnectDelegate>(this);
stream_request_ = callback.Run( stream_request_ = std::move(callback).Run(
socket_url_, requested_subprotocols, origin, site_for_cookies, socket_url_, requested_subprotocols, origin, site_for_cookies,
network_isolation_key, additional_headers, url_request_context_, network_isolation_key, additional_headers, url_request_context_,
NetLogWithSource(), std::move(connect_delegate)); NetLogWithSource(), std::move(connect_delegate));
......
...@@ -51,7 +51,7 @@ class NET_EXPORT WebSocketChannel { ...@@ -51,7 +51,7 @@ class NET_EXPORT WebSocketChannel {
public: public:
// The type of a WebSocketStream creator callback. Must match the signature of // The type of a WebSocketStream creator callback. Must match the signature of
// WebSocketStream::CreateAndConnectStream(). // WebSocketStream::CreateAndConnectStream().
typedef base::Callback<std::unique_ptr<WebSocketStreamRequest>( typedef base::OnceCallback<std::unique_ptr<WebSocketStreamRequest>(
const GURL&, const GURL&,
const std::vector<std::string>&, const std::vector<std::string>&,
const url::Origin&, const url::Origin&,
...@@ -132,7 +132,7 @@ class NET_EXPORT WebSocketChannel { ...@@ -132,7 +132,7 @@ class NET_EXPORT WebSocketChannel {
const SiteForCookies& site_for_cookies, const SiteForCookies& site_for_cookies,
const net::NetworkIsolationKey& network_isolation_key, const net::NetworkIsolationKey& network_isolation_key,
const HttpRequestHeaders& additional_headers, const HttpRequestHeaders& additional_headers,
const WebSocketStreamRequestCreationCallback& callback); WebSocketStreamRequestCreationCallback callback);
// The default timout for the closing handshake is a sensible value (see // The default timout for the closing handshake is a sensible value (see
// kClosingHandshakeTimeoutSeconds in websocket_channel.cc). However, we can // kClosingHandshakeTimeoutSeconds in websocket_channel.cc). However, we can
...@@ -194,7 +194,7 @@ class NET_EXPORT WebSocketChannel { ...@@ -194,7 +194,7 @@ class NET_EXPORT WebSocketChannel {
const SiteForCookies& site_for_cookies, const SiteForCookies& site_for_cookies,
const net::NetworkIsolationKey& network_isolation_key, const net::NetworkIsolationKey& network_isolation_key,
const HttpRequestHeaders& additional_headers, const HttpRequestHeaders& additional_headers,
const WebSocketStreamRequestCreationCallback& callback); WebSocketStreamRequestCreationCallback callback);
// Called when a URLRequest is created for handshaking. // Called when a URLRequest is created for handshaking.
void OnCreateURLRequest(URLRequest* request); void OnCreateURLRequest(URLRequest* request);
......
...@@ -810,7 +810,7 @@ class WebSocketChannelTest : public TestWithTaskEnvironment { ...@@ -810,7 +810,7 @@ class WebSocketChannelTest : public TestWithTaskEnvironment {
connect_data_.socket_url, connect_data_.requested_subprotocols, connect_data_.socket_url, connect_data_.requested_subprotocols,
connect_data_.origin, connect_data_.site_for_cookies, connect_data_.origin, connect_data_.site_for_cookies,
connect_data_.network_isolation_key, HttpRequestHeaders(), connect_data_.network_isolation_key, HttpRequestHeaders(),
base::Bind(&WebSocketStreamCreationCallbackArgumentSaver::Create, base::BindOnce(&WebSocketStreamCreationCallbackArgumentSaver::Create,
base::Unretained(&connect_data_.argument_saver))); base::Unretained(&connect_data_.argument_saver)));
} }
......
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