diff options
author | xunjieli <xunjieli@chromium.org> | 2016-03-22 09:43:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-22 16:44:27 +0000 |
commit | 5749218caeebdd18bfe53ef5c23273b5960e907f (patch) | |
tree | 36407cdce926454914a31607b998e858d5ead1ad | |
parent | 5721760f19e829770503b2aa4e51ff76848f2270 (diff) | |
download | chromium_src-5749218caeebdd18bfe53ef5c23273b5960e907f.zip chromium_src-5749218caeebdd18bfe53ef5c23273b5960e907f.tar.gz chromium_src-5749218caeebdd18bfe53ef5c23273b5960e907f.tar.bz2 |
Rename net::BidirectionalStream*Job to net::BidirectionalStream*Impl
This CL renames net::BidirectionalStream*Job to net::BidirectionalStream*Impl.
BUG=584338
Review URL: https://codereview.chromium.org/1812823010
Cr-Commit-Position: refs/heads/master@{#382588}
26 files changed, 240 insertions, 236 deletions
diff --git a/net/http/bidirectional_stream.cc b/net/http/bidirectional_stream.cc index d9b04e0..5c04ca3 100644 --- a/net/http/bidirectional_stream.cc +++ b/net/http/bidirectional_stream.cc @@ -69,14 +69,14 @@ BidirectionalStream::BidirectionalStream( http_request_info.method = request_info_->method; http_request_info.extra_headers = request_info_->extra_headers; stream_request_.reset( - session->http_stream_factory()->RequestBidirectionalStreamJob( + session->http_stream_factory()->RequestBidirectionalStreamImpl( http_request_info, request_info_->priority, server_ssl_config, server_ssl_config, this, net_log_)); // Check that this call cannot fail to set a non-NULL |stream_request_|. DCHECK(stream_request_); - // Check that HttpStreamFactory does not invoke OnBidirectionalStreamJobReady + // Check that HttpStreamFactory does not invoke OnBidirectionalStreamImplReady // synchronously. - DCHECK(!stream_job_); + DCHECK(!stream_impl_); } BidirectionalStream::~BidirectionalStream() { @@ -84,46 +84,46 @@ BidirectionalStream::~BidirectionalStream() { } int BidirectionalStream::ReadData(IOBuffer* buf, int buf_len) { - DCHECK(stream_job_); + DCHECK(stream_impl_); - return stream_job_->ReadData(buf, buf_len); + return stream_impl_->ReadData(buf, buf_len); } void BidirectionalStream::SendData(IOBuffer* data, int length, bool end_stream) { - DCHECK(stream_job_); + DCHECK(stream_impl_); - stream_job_->SendData(data, length, end_stream); + stream_impl_->SendData(data, length, end_stream); } void BidirectionalStream::Cancel() { stream_request_.reset(); - if (stream_job_) { - stream_job_->Cancel(); - stream_job_.reset(); + if (stream_impl_) { + stream_impl_->Cancel(); + stream_impl_.reset(); } } NextProto BidirectionalStream::GetProtocol() const { - if (!stream_job_) + if (!stream_impl_) return kProtoUnknown; - return stream_job_->GetProtocol(); + return stream_impl_->GetProtocol(); } int64_t BidirectionalStream::GetTotalReceivedBytes() const { - if (!stream_job_) + if (!stream_impl_) return 0; - return stream_job_->GetTotalReceivedBytes(); + return stream_impl_->GetTotalReceivedBytes(); } int64_t BidirectionalStream::GetTotalSentBytes() const { - if (!stream_job_) + if (!stream_impl_) return 0; - return stream_job_->GetTotalSentBytes(); + return stream_impl_->GetTotalSentBytes(); } void BidirectionalStream::OnHeadersSent() { @@ -167,15 +167,15 @@ void BidirectionalStream::OnStreamReady(const SSLConfig& used_ssl_config, NOTREACHED(); } -void BidirectionalStream::OnBidirectionalStreamJobReady( +void BidirectionalStream::OnBidirectionalStreamImplReady( const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - BidirectionalStreamJob* stream) { - DCHECK(!stream_job_); + BidirectionalStreamImpl* stream) { + DCHECK(!stream_impl_); stream_request_.reset(); - stream_job_.reset(stream); - stream_job_->Start(request_info_.get(), net_log_, this, std::move(timer_)); + stream_impl_.reset(stream); + stream_impl_->Start(request_info_.get(), net_log_, this, std::move(timer_)); } void BidirectionalStream::OnWebSocketHandshakeStreamReady( diff --git a/net/http/bidirectional_stream.h b/net/http/bidirectional_stream.h index 78aeeaf..7e6152a 100644 --- a/net/http/bidirectional_stream.h +++ b/net/http/bidirectional_stream.h @@ -10,7 +10,7 @@ #include "base/compiler_specific.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" -#include "net/http/bidirectional_stream_job.h" +#include "net/http/bidirectional_stream_impl.h" #include "net/http/http_stream_factory.h" #include "net/log/net_log.h" @@ -32,7 +32,7 @@ struct SSLConfig; // ReadData or SendData should be in flight until the operation completes. // The BidirectionalStream must be torn down before the HttpNetworkSession. class NET_EXPORT BidirectionalStream - : public NON_EXPORTED_BASE(BidirectionalStreamJob::Delegate), + : public NON_EXPORTED_BASE(BidirectionalStreamImpl::Delegate), public NON_EXPORTED_BASE(HttpStreamRequest::Delegate) { public: // Delegate interface to get notified of success of failure. Callbacks will be @@ -102,7 +102,7 @@ class NET_EXPORT BidirectionalStream Delegate* delegate, scoped_ptr<base::Timer> timer); - // Cancels |stream_request_| or |stream_job_| if applicable. + // Cancels |stream_request_| or |stream_impl_| if applicable. // |this| should not be destroyed during Delegate::OnHeadersSent or // Delegate::OnDataSent. ~BidirectionalStream() override; @@ -121,7 +121,7 @@ class NET_EXPORT BidirectionalStream // flag. void SendData(IOBuffer* data, int length, bool end_stream); - // If |stream_request_| is non-NULL, cancel it. If |stream_job_| is + // If |stream_request_| is non-NULL, cancel it. If |stream_impl_| is // established, cancel it. No delegate method will be called after Cancel(). // Any pending operations may or may not succeed. void Cancel(); @@ -146,7 +146,7 @@ class NET_EXPORT BidirectionalStream // remote end point. private: - // BidirectionalStreamJob::Delegate implementation: + // BidirectionalStreamImpl::Delegate implementation: void OnHeadersSent() override; void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override; void OnDataRead(int bytes_read) override; @@ -158,9 +158,10 @@ class NET_EXPORT BidirectionalStream void OnStreamReady(const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, HttpStream* stream) override; - void OnBidirectionalStreamJobReady(const SSLConfig& used_ssl_config, - const ProxyInfo& used_proxy_info, - BidirectionalStreamJob* stream) override; + void OnBidirectionalStreamImplReady( + const SSLConfig& used_ssl_config, + const ProxyInfo& used_proxy_info, + BidirectionalStreamImpl* stream_impl) override; void OnWebSocketHandshakeStreamReady( const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, @@ -194,12 +195,12 @@ class NET_EXPORT BidirectionalStream // Timer used to buffer data received in short time-spans and send a single // read completion notification. scoped_ptr<base::Timer> timer_; - // HttpStreamRequest used to request a BidirectionalStreamJob. This is NULL if - // the request has been canceled or completed. + // HttpStreamRequest used to request a BidirectionalStreamImpl. This is NULL + // if the request has been canceled or completed. scoped_ptr<HttpStreamRequest> stream_request_; - // The underlying BidirectioanlStreamJob used for this stream. It is non-NULL, - // if the |stream_request_| successfully finishes. - scoped_ptr<BidirectionalStreamJob> stream_job_; + // The underlying BidirectioanlStreamImpl used for this stream. It is + // non-NULL, if the |stream_request_| successfully finishes. + scoped_ptr<BidirectionalStreamImpl> stream_impl_; DISALLOW_COPY_AND_ASSIGN(BidirectionalStream); }; diff --git a/net/http/bidirectional_stream_impl.cc b/net/http/bidirectional_stream_impl.cc new file mode 100644 index 0000000..6cbf69f --- /dev/null +++ b/net/http/bidirectional_stream_impl.cc @@ -0,0 +1,17 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "net/http/bidirectional_stream_impl.h" + +namespace net { + +BidirectionalStreamImpl::Delegate::Delegate() {} + +BidirectionalStreamImpl::Delegate::~Delegate() {} + +BidirectionalStreamImpl::BidirectionalStreamImpl() {} + +BidirectionalStreamImpl::~BidirectionalStreamImpl() {} + +} // namespace net diff --git a/net/http/bidirectional_stream_job.h b/net/http/bidirectional_stream_impl.h index 7b36da9..3f82e6f 100644 --- a/net/http/bidirectional_stream_job.h +++ b/net/http/bidirectional_stream_impl.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef NET_HTTP_BIDIRECTIONAL_STREAM_JOB_H_ -#define NET_HTTP_BIDIRECTIONAL_STREAM_JOB_H_ +#ifndef NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_ +#define NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_ #include <stdint.h> @@ -26,41 +26,41 @@ struct BidirectionalStreamRequestInfo; // Exposes an interface to do HTTP/2 bidirectional streaming. // Note that only one ReadData or SendData should be in flight until the // operation completes synchronously or asynchronously. -// BidirectionalStreamJob once created by HttpStreamFactoryImpl should be owned +// BidirectionalStreamImpl once created by HttpStreamFactoryImpl should be owned // by BidirectionalStream. -class NET_EXPORT_PRIVATE BidirectionalStreamJob { +class NET_EXPORT_PRIVATE BidirectionalStreamImpl { public: - // Delegate to handle BidirectionalStreamJob events. + // Delegate to handle BidirectionalStreamImpl events. class NET_EXPORT_PRIVATE Delegate { public: Delegate(); // Called when the request headers have been sent. - // The delegate may call BidirectionalStreamJob::ReadData to start reading, - // call BidirectionalStreamJob::SendData to send data, - // or call BidirectionalStreamJob::Cancel to cancel the stream. - // The delegate should not call BidirectionalStreamJob::Cancel + // The delegate may call BidirectionalStreamImpl::ReadData to start reading, + // call BidirectionalStreamImpl::SendData to send data, + // or call BidirectionalStreamImpl::Cancel to cancel the stream. + // The delegate should not call BidirectionalStreamImpl::Cancel // during this callback. virtual void OnHeadersSent() = 0; // Called when response headers are received. // This is called at most once for the lifetime of a stream. - // The delegate may call BidirectionalStreamJob::ReadData to start - // reading, call BidirectionalStreamJob::SendData to send data, - // or call BidirectionalStreamJob::Cancel to cancel the stream. + // The delegate may call BidirectionalStreamImpl::ReadData to start + // reading, call BidirectionalStreamImpl::SendData to send data, + // or call BidirectionalStreamImpl::Cancel to cancel the stream. virtual void OnHeadersReceived(const SpdyHeaderBlock& response_headers) = 0; // Called when read is completed asynchronously. |bytes_read| specifies how // much data is available. - // The delegate may call BidirectionalStreamJob::ReadData to continue - // reading, call BidirectionalStreamJob::SendData to send data, - // or call BidirectionalStreamJob::Cancel to cancel the stream. + // The delegate may call BidirectionalStreamImpl::ReadData to continue + // reading, call BidirectionalStreamImpl::SendData to send data, + // or call BidirectionalStreamImpl::Cancel to cancel the stream. virtual void OnDataRead(int bytes_read) = 0; // Called when the entire buffer passed through SendData is sent. - // The delegate may call BidirectionalStreamJob::ReadData to continue - // reading, or call BidirectionalStreamJob::SendData to send data. - // The delegate should not call BidirectionalStreamJob::Cancel + // The delegate may call BidirectionalStreamImpl::ReadData to continue + // reading, or call BidirectionalStreamImpl::SendData to send data. + // The delegate should not call BidirectionalStreamImpl::Cancel // during this callback. virtual void OnDataSent() = 0; @@ -81,16 +81,16 @@ class NET_EXPORT_PRIVATE BidirectionalStreamJob { DISALLOW_COPY_AND_ASSIGN(Delegate); }; - BidirectionalStreamJob(); + BidirectionalStreamImpl(); // |this| should not be destroyed during Delegate::OnHeadersSent or // Delegate::OnDataSent. - virtual ~BidirectionalStreamJob(); + virtual ~BidirectionalStreamImpl(); - // Starts the BidirectionalStreamJob and sends request headers. + // Starts the BidirectionalStreamImpl and sends request headers. virtual void Start(const BidirectionalStreamRequestInfo* request_info, const BoundNetLog& net_log, - BidirectionalStreamJob::Delegate* delegate, + BidirectionalStreamImpl::Delegate* delegate, scoped_ptr<base::Timer> timer) = 0; // Reads at most |buf_len| bytes into |buf|. Returns the number of bytes read, @@ -127,9 +127,9 @@ class NET_EXPORT_PRIVATE BidirectionalStreamJob { virtual int64_t GetTotalSentBytes() const = 0; private: - DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamJob); + DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamImpl); }; } // namespace net -#endif // NET_HTTP_BIDIRECTIONAL_STREAM_JOB_H_ +#endif // NET_HTTP_BIDIRECTIONAL_STREAM_IMPL_H_ diff --git a/net/http/bidirectional_stream_job.cc b/net/http/bidirectional_stream_job.cc deleted file mode 100644 index 3c30753..0000000 --- a/net/http/bidirectional_stream_job.cc +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "net/http/bidirectional_stream_job.h" - -namespace net { - -BidirectionalStreamJob::Delegate::Delegate() {} - -BidirectionalStreamJob::Delegate::~Delegate() {} - -BidirectionalStreamJob::BidirectionalStreamJob() {} - -BidirectionalStreamJob::~BidirectionalStreamJob() {} - -} // namespace net diff --git a/net/http/bidirectional_stream_unittest.cc b/net/http/bidirectional_stream_unittest.cc index 6d4cb81..1fa6155 100644 --- a/net/http/bidirectional_stream_unittest.cc +++ b/net/http/bidirectional_stream_unittest.cc @@ -354,7 +354,7 @@ TEST_F(BidirectionalStreamTest, CreateInsecureStream) { } // Simulates user calling ReadData after END_STREAM has been received in -// BidirectionalStreamSpdyJob. +// BidirectionalStreamSpdyImpl. TEST_F(BidirectionalStreamTest, TestReadDataAfterClose) { scoped_ptr<SpdyFrame> req( spdy_util_.ConstructSpdyGet("https://www.example.org", 1, LOWEST)); @@ -399,7 +399,7 @@ TEST_F(BidirectionalStreamTest, TestReadDataAfterClose) { scoped_refptr<IOBuffer> read_buffer(new IOBuffer(kReadBufferSize)); // Create a MockTimer. Retain a raw pointer since the underlying - // BidirectionalStreamJob owns it. + // BidirectionalStreamImpl owns it. MockTimer* timer = new MockTimer(); scoped_ptr<TestDelegateBase> delegate(new TestDelegateBase( read_buffer.get(), kReadBufferSize, make_scoped_ptr(timer))); @@ -550,7 +550,7 @@ TEST_F(BidirectionalStreamTest, TestInterleaveReadDataAndSendData) { delegate->GetTotalReceivedBytes()); } -// Tests that BidirectionalStreamSpdyJob::OnClose will complete any remaining +// Tests that BidirectionalStreamSpdyImpl::OnClose will complete any remaining // read even if the read queue is empty. TEST_F(BidirectionalStreamTest, TestCompleteAsyncRead) { scoped_ptr<SpdyFrame> req( diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 41c1acf..1947594 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -495,10 +495,10 @@ void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config, OnIOComplete(OK); } -void HttpNetworkTransaction::OnBidirectionalStreamJobReady( +void HttpNetworkTransaction::OnBidirectionalStreamImplReady( const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - BidirectionalStreamJob* stream_job) { + BidirectionalStreamImpl* stream) { NOTREACHED(); } diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h index 5b554af..43b2863 100644 --- a/net/http/http_network_transaction.h +++ b/net/http/http_network_transaction.h @@ -36,7 +36,7 @@ class ECPrivateKey; namespace net { -class BidirectionalStreamJob; +class BidirectionalStreamImpl; class ClientSocketHandle; class HttpAuthController; class HttpNetworkSession; @@ -97,10 +97,9 @@ class NET_EXPORT_PRIVATE HttpNetworkTransaction void OnStreamReady(const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, HttpStream* stream) override; - void OnBidirectionalStreamJobReady( - const SSLConfig& used_ssl_config, - const ProxyInfo& used_proxy_info, - BidirectionalStreamJob* stream_job) override; + void OnBidirectionalStreamImplReady(const SSLConfig& used_ssl_config, + const ProxyInfo& used_proxy_info, + BidirectionalStreamImpl* stream) override; void OnWebSocketHandshakeStreamReady( const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 2cf63e4..d54b498 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -14634,7 +14634,7 @@ class FakeStreamFactory : public HttpStreamFactory { return fake_request; } - HttpStreamRequest* RequestBidirectionalStreamJob( + HttpStreamRequest* RequestBidirectionalStreamImpl( const HttpRequestInfo& info, RequestPriority priority, const SSLConfig& server_ssl_config, diff --git a/net/http/http_stream_factory.h b/net/http/http_stream_factory.h index e207a86..59956e1 100644 --- a/net/http/http_stream_factory.h +++ b/net/http/http_stream_factory.h @@ -33,7 +33,7 @@ namespace net { class AuthCredentials; class BoundNetLog; -class BidirectionalStreamJob; +class BidirectionalStreamImpl; class HostMappingRules; class HostPortPair; class HttpAuthController; @@ -92,10 +92,10 @@ class NET_EXPORT_PRIVATE HttpStreamRequest { const ProxyInfo& used_proxy_info, WebSocketHandshakeStreamBase* stream) = 0; - virtual void OnBidirectionalStreamJobReady( + virtual void OnBidirectionalStreamImplReady( const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - BidirectionalStreamJob* stream) = 0; + BidirectionalStreamImpl* stream) = 0; // This is the failure to create a stream case. // |used_ssl_config| indicates the actual SSL configuration used for this @@ -231,10 +231,10 @@ class NET_EXPORT HttpStreamFactory { WebSocketHandshakeStreamBase::CreateHelper* create_helper, const BoundNetLog& net_log) = 0; - // Request a BidirectionalStreamJob. - // Will call delegate->OnBidirectionalStreamJobReady on successful + // Request a BidirectionalStreamImpl. + // Will call delegate->OnBidirectionalStreamImplReady on successful // completion. - virtual HttpStreamRequest* RequestBidirectionalStreamJob( + virtual HttpStreamRequest* RequestBidirectionalStreamImpl( const HttpRequestInfo& info, RequestPriority priority, const SSLConfig& server_ssl_config, diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc index a36b832..a8d9515 100644 --- a/net/http/http_stream_factory_impl.cc +++ b/net/http/http_stream_factory_impl.cc @@ -16,7 +16,7 @@ #include "net/http/transport_security_state.h" #include "net/log/net_log.h" #include "net/quic/quic_server_id.h" -#include "net/spdy/bidirectional_stream_spdy_job.h" +#include "net/spdy/bidirectional_stream_spdy_impl.h" #include "net/spdy/spdy_http_stream.h" #include "url/gurl.h" @@ -70,7 +70,7 @@ HttpStreamRequest* HttpStreamFactoryImpl::RequestWebSocketHandshakeStream( HttpStreamRequest::HTTP_STREAM, net_log); } -HttpStreamRequest* HttpStreamFactoryImpl::RequestBidirectionalStreamJob( +HttpStreamRequest* HttpStreamFactoryImpl::RequestBidirectionalStreamImpl( const HttpRequestInfo& request_info, RequestPriority priority, const SSLConfig& server_ssl_config, @@ -320,9 +320,9 @@ void HttpStreamFactoryImpl::OnNewSpdySessionReady( NOTREACHED(); } else if (request->stream_type() == HttpStreamRequest::BIDIRECTIONAL_STREAM) { - request->OnBidirectionalStreamJobReady( + request->OnBidirectionalStreamImplReady( nullptr, used_ssl_config, used_proxy_info, - new BidirectionalStreamSpdyJob(spdy_session)); + new BidirectionalStreamSpdyImpl(spdy_session)); } else { bool use_relative_url = direct || request->url().SchemeIs("https"); request->OnStreamReady( diff --git a/net/http/http_stream_factory_impl.h b/net/http/http_stream_factory_impl.h index a509f01..756d3b8 100644 --- a/net/http/http_stream_factory_impl.h +++ b/net/http/http_stream_factory_impl.h @@ -51,7 +51,7 @@ class NET_EXPORT_PRIVATE HttpStreamFactoryImpl : public HttpStreamFactory { WebSocketHandshakeStreamBase::CreateHelper* create_helper, const BoundNetLog& net_log) override; - HttpStreamRequest* RequestBidirectionalStreamJob( + HttpStreamRequest* RequestBidirectionalStreamImpl( const HttpRequestInfo& info, RequestPriority priority, const SSLConfig& server_ssl_config, diff --git a/net/http/http_stream_factory_impl_job.cc b/net/http/http_stream_factory_impl_job.cc index fc2b9ca..0493921d 100644 --- a/net/http/http_stream_factory_impl_job.cc +++ b/net/http/http_stream_factory_impl_job.cc @@ -26,7 +26,7 @@ #include "net/base/connection_type_histograms.h" #include "net/base/port_util.h" #include "net/cert/cert_verifier.h" -#include "net/http/bidirectional_stream_job.h" +#include "net/http/bidirectional_stream_impl.h" #include "net/http/http_basic_stream.h" #include "net/http/http_network_session.h" #include "net/http/http_proxy_client_socket.h" @@ -43,7 +43,7 @@ #include "net/socket/socks_client_socket_pool.h" #include "net/socket/ssl_client_socket.h" #include "net/socket/ssl_client_socket_pool.h" -#include "net/spdy/bidirectional_stream_spdy_job.h" +#include "net/spdy/bidirectional_stream_spdy_impl.h" #include "net/spdy/spdy_http_stream.h" #include "net/spdy/spdy_protocol.h" #include "net/spdy/spdy_session.h" @@ -453,8 +453,8 @@ void HttpStreamFactoryImpl::Job::OnWebSocketHandshakeStreamReadyCallback() { // |this| may be deleted after this call. } -void HttpStreamFactoryImpl::Job::OnBidirectionalStreamJobReadyCallback() { - DCHECK(bidirectional_stream_job_); +void HttpStreamFactoryImpl::Job::OnBidirectionalStreamImplReadyCallback() { + DCHECK(bidirectional_stream_impl_); MaybeCopyConnectionAttemptsFromSocketOrHandle(); @@ -463,15 +463,15 @@ void HttpStreamFactoryImpl::Job::OnBidirectionalStreamJobReadyCallback() { } else { request_->Complete(was_npn_negotiated(), protocol_negotiated(), using_spdy()); - request_->OnBidirectionalStreamJobReady( + request_->OnBidirectionalStreamImplReady( this, server_ssl_config_, proxy_info_, - bidirectional_stream_job_.release()); + bidirectional_stream_impl_.release()); } // |this| may be deleted after this call. } void HttpStreamFactoryImpl::Job::OnNewSpdySessionReadyCallback() { - DCHECK(stream_.get() || bidirectional_stream_job_.get()); + DCHECK(stream_.get() || bidirectional_stream_impl_.get()); DCHECK(!IsPreconnecting()); DCHECK(using_spdy()); // Note: an event loop iteration has passed, so |new_spdy_session_| may be @@ -492,14 +492,14 @@ void HttpStreamFactoryImpl::Job::OnNewSpdySessionReadyCallback() { stream_factory_->OnOrphanedJobComplete(this); } else { if (stream_type_ == HttpStreamRequest::BIDIRECTIONAL_STREAM) { - DCHECK(bidirectional_stream_job_); + DCHECK(bidirectional_stream_impl_); request_->OnNewSpdySessionReady(this, /*spdy_http_stream=*/nullptr, - std::move(bidirectional_stream_job_), + std::move(bidirectional_stream_impl_), spdy_session, spdy_session_direct_); } else { DCHECK(stream_); request_->OnNewSpdySessionReady(this, std::move(stream_), - /** bidirectional_stream_job=*/nullptr, + /** bidirectional_stream_impl=*/nullptr, spdy_session, spdy_session_direct_); } } @@ -693,14 +693,15 @@ int HttpStreamFactoryImpl::Job::RunLoop(int result) { FROM_HERE, base::Bind(&Job::OnWebSocketHandshakeStreamReadyCallback, ptr_factory_.GetWeakPtr())); } else if (stream_type_ == HttpStreamRequest::BIDIRECTIONAL_STREAM) { - if (!bidirectional_stream_job_) { + if (!bidirectional_stream_impl_) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&Job::OnStreamFailedCallback, ptr_factory_.GetWeakPtr(), ERR_FAILED)); } else { base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, base::Bind(&Job::OnBidirectionalStreamJobReadyCallback, - ptr_factory_.GetWeakPtr())); + FROM_HERE, + base::Bind(&Job::OnBidirectionalStreamImplReadyCallback, + ptr_factory_.GetWeakPtr())); } } else { DCHECK(stream_.get()); @@ -1243,8 +1244,9 @@ int HttpStreamFactoryImpl::Job::DoInitConnectionComplete(int result) { return result; } if (stream_type_ == HttpStreamRequest::BIDIRECTIONAL_STREAM) { - bidirectional_stream_job_ = quic_request_.CreateBidirectionalStreamJob(); - if (!bidirectional_stream_job_) { + bidirectional_stream_impl_ = + quic_request_.CreateBidirectionalStreamImpl(); + if (!bidirectional_stream_impl_) { // Quic session is closed before stream can be created. return ERR_CONNECTION_CLOSED; } @@ -1304,7 +1306,7 @@ int HttpStreamFactoryImpl::Job::DoWaitingUserAction(int result) { return ERR_IO_PENDING; } -int HttpStreamFactoryImpl::Job::SetSpdyHttpStreamOrBidirectionalStreamJob( +int HttpStreamFactoryImpl::Job::SetSpdyHttpStreamOrBidirectionalStreamImpl( base::WeakPtr<SpdySession> session, bool direct) { // TODO(ricea): Restore the code for WebSockets over SPDY once it's @@ -1312,7 +1314,7 @@ int HttpStreamFactoryImpl::Job::SetSpdyHttpStreamOrBidirectionalStreamJob( if (stream_factory_->for_websockets_) return ERR_NOT_IMPLEMENTED; if (stream_type_ == HttpStreamRequest::BIDIRECTIONAL_STREAM) { - bidirectional_stream_job_.reset(new BidirectionalStreamSpdyJob(session)); + bidirectional_stream_impl_.reset(new BidirectionalStreamSpdyImpl(session)); return OK; } @@ -1375,7 +1377,7 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() { connection_->socket()->Disconnect(); connection_->Reset(); - int set_result = SetSpdyHttpStreamOrBidirectionalStreamJob( + int set_result = SetSpdyHttpStreamOrBidirectionalStreamImpl( existing_spdy_session_, direct); existing_spdy_session_.reset(); return set_result; @@ -1389,7 +1391,7 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() { return result; } if (spdy_session) { - return SetSpdyHttpStreamOrBidirectionalStreamJob(spdy_session, direct); + return SetSpdyHttpStreamOrBidirectionalStreamImpl(spdy_session, direct); } result = valid_spdy_session_pool_->CreateAvailableSessionFromSocket( @@ -1424,13 +1426,13 @@ int HttpStreamFactoryImpl::Job::DoCreateStream() { if (http_server_properties) http_server_properties->SetSupportsSpdy(host_port_pair, true); - // Create a SpdyHttpStream or a BidirectionalStreamJob attached to the + // Create a SpdyHttpStream or a BidirectionalStreamImpl attached to the // session; OnNewSpdySessionReadyCallback is not called until an event loop // iteration later, so if the SpdySession is closed between then, allow // reuse state from the underlying socket, sampled by SpdyHttpStream, // bubble up to the request. - return SetSpdyHttpStreamOrBidirectionalStreamJob(new_spdy_session_, - spdy_session_direct_); + return SetSpdyHttpStreamOrBidirectionalStreamImpl(new_spdy_session_, + spdy_session_direct_); } int HttpStreamFactoryImpl::Job::DoCreateStreamComplete(int result) { diff --git a/net/http/http_stream_factory_impl_job.h b/net/http/http_stream_factory_impl_job.h index e0a5f5e..a795189 100644 --- a/net/http/http_stream_factory_impl_job.h +++ b/net/http/http_stream_factory_impl_job.h @@ -27,7 +27,7 @@ namespace net { -class BidirectionalStreamJob; +class BidirectionalStreamImpl; class ClientSocketHandle; class HttpAuthController; class HttpNetworkSession; @@ -208,7 +208,7 @@ class HttpStreamFactoryImpl::Job { void ResumeAfterDelay(); void OnStreamReadyCallback(); - void OnBidirectionalStreamJobReadyCallback(); + void OnBidirectionalStreamImplReadyCallback(); void OnWebSocketHandshakeStreamReadyCallback(); // This callback function is called when a new SPDY session is created. void OnNewSpdySessionReadyCallback(); @@ -243,10 +243,10 @@ class HttpStreamFactoryImpl::Job { int DoRestartTunnelAuth(); int DoRestartTunnelAuthComplete(int result); - // Creates a SpdyHttpStream or a BidirectionalStreamJob from the given values - // and sets to |stream_| or |bidirectional_stream_job_| respectively. Does + // Creates a SpdyHttpStream or a BidirectionalStreamImpl from the given values + // and sets to |stream_| or |bidirectional_stream_impl_| respectively. Does // nothing if |stream_factory_| is for WebSockets. - int SetSpdyHttpStreamOrBidirectionalStreamJob( + int SetSpdyHttpStreamOrBidirectionalStreamImpl( base::WeakPtr<SpdySession> session, bool direct); @@ -389,7 +389,7 @@ class HttpStreamFactoryImpl::Job { scoped_ptr<HttpStream> stream_; scoped_ptr<WebSocketHandshakeStreamBase> websocket_stream_; - scoped_ptr<BidirectionalStreamJob> bidirectional_stream_job_; + scoped_ptr<BidirectionalStreamImpl> bidirectional_stream_impl_; // True if we negotiated NPN. bool was_npn_negotiated_; diff --git a/net/http/http_stream_factory_impl_request.cc b/net/http/http_stream_factory_impl_request.cc index ee1a7d3..7c5cbc9 100644 --- a/net/http/http_stream_factory_impl_request.cc +++ b/net/http/http_stream_factory_impl_request.cc @@ -7,7 +7,7 @@ #include "base/callback.h" #include "base/logging.h" #include "base/stl_util.h" -#include "net/http/bidirectional_stream_job.h" +#include "net/http/bidirectional_stream_impl.h" #include "net/http/http_stream_factory_impl_job.h" #include "net/spdy/spdy_http_stream.h" #include "net/spdy/spdy_session.h" @@ -88,19 +88,19 @@ void HttpStreamFactoryImpl::Request::OnStreamReady( delegate_->OnStreamReady(used_ssl_config, used_proxy_info, stream); } -void HttpStreamFactoryImpl::Request::OnBidirectionalStreamJobReady( +void HttpStreamFactoryImpl::Request::OnBidirectionalStreamImplReady( Job* job, const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - BidirectionalStreamJob* stream_job) { + BidirectionalStreamImpl* stream_job) { DCHECK(!factory_->for_websockets_); DCHECK_EQ(HttpStreamRequest::BIDIRECTIONAL_STREAM, stream_type_); DCHECK(stream_job); DCHECK(completed_); OnJobSucceeded(job); - delegate_->OnBidirectionalStreamJobReady(used_ssl_config, used_proxy_info, - stream_job); + delegate_->OnBidirectionalStreamImplReady(used_ssl_config, used_proxy_info, + stream_job); } void HttpStreamFactoryImpl::Request::OnWebSocketHandshakeStreamReady( @@ -272,7 +272,7 @@ bool HttpStreamFactoryImpl::Request::HasSpdySessionKey() const { void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady( Job* job, scoped_ptr<HttpStream> stream, - scoped_ptr<BidirectionalStreamJob> bidirectional_stream_job, + scoped_ptr<BidirectionalStreamImpl> bidirectional_stream_impl, const base::WeakPtr<SpdySession>& spdy_session, bool direct) { DCHECK(job); @@ -308,13 +308,13 @@ void HttpStreamFactoryImpl::Request::OnNewSpdySessionReady( // implemented. NOTREACHED(); } else if (stream_type_ == HttpStreamRequest::BIDIRECTIONAL_STREAM) { - DCHECK(bidirectional_stream_job); + DCHECK(bidirectional_stream_impl); DCHECK(!stream); - delegate_->OnBidirectionalStreamJobReady( + delegate_->OnBidirectionalStreamImplReady( job->server_ssl_config(), job->proxy_info(), - bidirectional_stream_job.release()); + bidirectional_stream_impl.release()); } else { - DCHECK(!bidirectional_stream_job); + DCHECK(!bidirectional_stream_impl); DCHECK(stream); delegate_->OnStreamReady(job->server_ssl_config(), job->proxy_info(), stream.release()); diff --git a/net/http/http_stream_factory_impl_request.h b/net/http/http_stream_factory_impl_request.h index 89a1d5f..a84615f 100644 --- a/net/http/http_stream_factory_impl_request.h +++ b/net/http/http_stream_factory_impl_request.h @@ -19,7 +19,7 @@ namespace net { -class BidirectionalStreamJob; +class BidirectionalStreamImpl; class ClientSocketHandle; class HttpStream; class SpdySession; @@ -63,12 +63,12 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest { // Called by an attached Job if it sets up a SpdySession. // |stream| is null when |stream_type| is HttpStreamRequest::HTTP_STREAM. - // |bidirectional_stream_spdy_job| is null when |stream_type| is + // |bidirectional_stream_spdy_impl| is null when |stream_type| is // HttpStreamRequest::BIDIRECTIONAL_STREAM. void OnNewSpdySessionReady( Job* job, scoped_ptr<HttpStream> stream, - scoped_ptr<BidirectionalStreamJob> bidirectional_stream_spdy_job, + scoped_ptr<BidirectionalStreamImpl> bidirectional_stream_spdy_impl, const base::WeakPtr<SpdySession>& spdy_session, bool direct); @@ -88,10 +88,10 @@ class HttpStreamFactoryImpl::Request : public HttpStreamRequest { const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, HttpStream* stream); - void OnBidirectionalStreamJobReady(Job* job, - const SSLConfig& used_ssl_config, - const ProxyInfo& used_proxy_info, - BidirectionalStreamJob* stream); + void OnBidirectionalStreamImplReady(Job* job, + const SSLConfig& used_ssl_config, + const ProxyInfo& used_proxy_info, + BidirectionalStreamImpl* stream); void OnWebSocketHandshakeStreamReady(Job* job, const SSLConfig& used_ssl_config, diff --git a/net/http/http_stream_factory_impl_request_unittest.cc b/net/http/http_stream_factory_impl_request_unittest.cc index 8983399..6a08a00 100644 --- a/net/http/http_stream_factory_impl_request_unittest.cc +++ b/net/http/http_stream_factory_impl_request_unittest.cc @@ -35,10 +35,10 @@ class DoNothingRequestDelegate : public HttpStreamRequest::Delegate { void OnStreamReady(const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, HttpStream* stream) override {} - void OnBidirectionalStreamJobReady( + void OnBidirectionalStreamImplReady( const SSLConfig& used_ssl_config, const ProxyInfo& used_proxy_info, - BidirectionalStreamJob* stream_job) override {} + BidirectionalStreamImpl* stream) override {} void OnWebSocketHandshakeStreamReady( const SSLConfig& used_ssl_config, diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc index 341b1b2..f95ea51 100644 --- a/net/http/http_stream_factory_impl_unittest.cc +++ b/net/http/http_stream_factory_impl_unittest.cc @@ -17,7 +17,7 @@ #include "net/base/test_data_directory.h" #include "net/cert/mock_cert_verifier.h" #include "net/dns/mock_host_resolver.h" -#include "net/http/bidirectional_stream_job.h" +#include "net/http/bidirectional_stream_impl.h" #include "net/http/bidirectional_stream_request_info.h" #include "net/http/http_auth_handler_factory.h" #include "net/http/http_network_session.h" @@ -58,7 +58,7 @@ namespace net { -class BidirectionalStreamJob; +class BidirectionalStreamImpl; namespace { @@ -187,13 +187,14 @@ class StreamRequestWaiter : public HttpStreamRequest::Delegate { used_proxy_info_ = used_proxy_info; } - void OnBidirectionalStreamJobReady(const SSLConfig& used_ssl_config, - const ProxyInfo& used_proxy_info, - BidirectionalStreamJob* stream) override { + void OnBidirectionalStreamImplReady( + const SSLConfig& used_ssl_config, + const ProxyInfo& used_proxy_info, + BidirectionalStreamImpl* stream) override { stream_done_ = true; if (waiting_for_stream_) base::MessageLoop::current()->QuitWhenIdle(); - bidirectional_stream_job_.reset(stream); + bidirectional_stream_impl_.reset(stream); used_ssl_config_ = used_ssl_config; used_proxy_info_ = used_proxy_info; } @@ -251,8 +252,8 @@ class StreamRequestWaiter : public HttpStreamRequest::Delegate { return static_cast<MockWebSocketHandshakeStream*>(websocket_stream_.get()); } - BidirectionalStreamJob* bidirectional_stream_job() { - return bidirectional_stream_job_.get(); + BidirectionalStreamImpl* bidirectional_stream_impl() { + return bidirectional_stream_impl_.get(); } bool stream_done() const { return stream_done_; } @@ -263,7 +264,7 @@ class StreamRequestWaiter : public HttpStreamRequest::Delegate { bool stream_done_; scoped_ptr<HttpStream> stream_; scoped_ptr<WebSocketHandshakeStreamBase> websocket_stream_; - scoped_ptr<BidirectionalStreamJob> bidirectional_stream_job_; + scoped_ptr<BidirectionalStreamImpl> bidirectional_stream_impl_; SSLConfig used_ssl_config_; ProxyInfo used_proxy_info_; int error_status_; @@ -737,9 +738,9 @@ TEST_P(HttpStreamFactoryTest, UnreachableQuicProxyMarkedAsBad) { } } -// BidirectionalStreamJob::Delegate to wait until response headers are +// BidirectionalStreamImpl::Delegate to wait until response headers are // received. -class TestBidirectionalDelegate : public BidirectionalStreamJob::Delegate { +class TestBidirectionalDelegate : public BidirectionalStreamImpl::Delegate { public: void WaitUntilDone() { loop_.Run(); } @@ -1456,7 +1457,7 @@ TEST_P(HttpStreamFactoryTest, RequestSpdyHttpStream) { EXPECT_TRUE(waiter.used_proxy_info().is_direct()); } -TEST_P(HttpStreamFactoryTest, RequestBidirectionalStreamJob) { +TEST_P(HttpStreamFactoryTest, RequestBidirectionalStreamImpl) { SpdySessionDependencies session_deps(GetParam(), ProxyService::CreateDirect()); @@ -1482,14 +1483,14 @@ TEST_P(HttpStreamFactoryTest, RequestBidirectionalStreamJob) { SSLConfig ssl_config; StreamRequestWaiter waiter; scoped_ptr<HttpStreamRequest> request( - session->http_stream_factory()->RequestBidirectionalStreamJob( + session->http_stream_factory()->RequestBidirectionalStreamImpl( request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, BoundNetLog())); waiter.WaitForStream(); EXPECT_TRUE(waiter.stream_done()); EXPECT_FALSE(waiter.websocket_stream()); ASSERT_FALSE(waiter.stream()); - ASSERT_TRUE(waiter.bidirectional_stream_job()); + ASSERT_TRUE(waiter.bidirectional_stream_impl()); EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetTransportSocketPool( HttpNetworkSession::NORMAL_SOCKET_POOL))); EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetSSLSocketPool( @@ -1588,7 +1589,7 @@ INSTANTIATE_TEST_CASE_P(Version, ::testing::ValuesIn(QuicSupportedVersions())); TEST_P(HttpStreamFactoryBidirectionalQuicTest, - RequestBidirectionalStreamJobQuicAlternative) { + RequestBidirectionalStreamImplQuicAlternative) { GURL url = GURL("https://www.example.org"); MockQuicData mock_quic_data; @@ -1630,7 +1631,7 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest, StreamRequestWaiter waiter; scoped_ptr<HttpStreamRequest> request( - session()->http_stream_factory()->RequestBidirectionalStreamJob( + session()->http_stream_factory()->RequestBidirectionalStreamImpl( request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, BoundNetLog())); @@ -1638,8 +1639,8 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest, EXPECT_TRUE(waiter.stream_done()); EXPECT_FALSE(waiter.websocket_stream()); ASSERT_FALSE(waiter.stream()); - ASSERT_TRUE(waiter.bidirectional_stream_job()); - BidirectionalStreamJob* job = waiter.bidirectional_stream_job(); + ASSERT_TRUE(waiter.bidirectional_stream_impl()); + BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); BidirectionalStreamRequestInfo bidi_request_info; bidi_request_info.method = "GET"; @@ -1648,12 +1649,12 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest, bidi_request_info.priority = LOWEST; TestBidirectionalDelegate delegate; - job->Start(&bidi_request_info, BoundNetLog(), &delegate, nullptr); + stream_impl->Start(&bidi_request_info, BoundNetLog(), &delegate, nullptr); delegate.WaitUntilDone(); scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); - EXPECT_EQ(OK, job->ReadData(buffer.get(), 1)); - EXPECT_EQ(kProtoQUIC1SPDY3, job->GetProtocol()); + EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); + EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); EXPECT_EQ("200", delegate.response_headers().find(":status")->second); EXPECT_EQ(1, GetSocketPoolGroupCount(session()->GetTransportSocketPool( HttpNetworkSession::NORMAL_SOCKET_POOL))); @@ -1669,7 +1670,7 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest, // Tests that when QUIC is not enabled for bidirectional streaming, HTTP/2 is // used instead. TEST_P(HttpStreamFactoryBidirectionalQuicTest, - RequestBidirectionalStreamJobQuicNotEnabled) { + RequestBidirectionalStreamImplQuicNotEnabled) { GURL url = GURL("https://www.example.org"); // Make the http job fail. @@ -1695,7 +1696,7 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest, StreamRequestWaiter waiter; scoped_ptr<HttpStreamRequest> request( - session()->http_stream_factory()->RequestBidirectionalStreamJob( + session()->http_stream_factory()->RequestBidirectionalStreamImpl( request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, BoundNetLog())); @@ -1703,7 +1704,7 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest, EXPECT_TRUE(waiter.stream_done()); EXPECT_FALSE(waiter.websocket_stream()); ASSERT_FALSE(waiter.stream()); - ASSERT_FALSE(waiter.bidirectional_stream_job()); + ASSERT_FALSE(waiter.bidirectional_stream_impl()); // Since the alternative service job is not started, we will get the error // from the http job. ASSERT_EQ(ERR_CONNECTION_REFUSED, waiter.error_status()); @@ -1712,7 +1713,7 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest, // Tests that if Http job fails, but Quic job succeeds, we return // BidirectionalStreamQuicImpl. TEST_P(HttpStreamFactoryBidirectionalQuicTest, - RequestBidirectionalStreamJobHttpJobFailsQuicJobSucceeds) { + RequestBidirectionalStreamImplHttpJobFailsQuicJobSucceeds) { GURL url = GURL("https://www.example.org"); // Set up Quic data. @@ -1755,7 +1756,7 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest, StreamRequestWaiter waiter; scoped_ptr<HttpStreamRequest> request( - session()->http_stream_factory()->RequestBidirectionalStreamJob( + session()->http_stream_factory()->RequestBidirectionalStreamImpl( request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, BoundNetLog())); @@ -1763,8 +1764,8 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest, EXPECT_TRUE(waiter.stream_done()); EXPECT_FALSE(waiter.websocket_stream()); ASSERT_FALSE(waiter.stream()); - ASSERT_TRUE(waiter.bidirectional_stream_job()); - BidirectionalStreamJob* job = waiter.bidirectional_stream_job(); + ASSERT_TRUE(waiter.bidirectional_stream_impl()); + BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); BidirectionalStreamRequestInfo bidi_request_info; bidi_request_info.method = "GET"; @@ -1773,13 +1774,13 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest, bidi_request_info.priority = LOWEST; TestBidirectionalDelegate delegate; - job->Start(&bidi_request_info, BoundNetLog(), &delegate, nullptr); + stream_impl->Start(&bidi_request_info, BoundNetLog(), &delegate, nullptr); delegate.WaitUntilDone(); // Make sure the BidirectionalStream negotiated goes through QUIC. scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); - EXPECT_EQ(OK, job->ReadData(buffer.get(), 1)); - EXPECT_EQ(kProtoQUIC1SPDY3, job->GetProtocol()); + EXPECT_EQ(OK, stream_impl->ReadData(buffer.get(), 1)); + EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); EXPECT_EQ("200", delegate.response_headers().find(":status")->second); // There is no Http2 socket pool. EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool( @@ -1793,7 +1794,7 @@ TEST_P(HttpStreamFactoryBidirectionalQuicTest, EXPECT_TRUE(waiter.used_proxy_info().is_direct()); } -TEST_P(HttpStreamFactoryTest, RequestBidirectionalStreamJobFailure) { +TEST_P(HttpStreamFactoryTest, RequestBidirectionalStreamImplFailure) { SpdySessionDependencies session_deps(GetParam(), ProxyService::CreateDirect()); @@ -1804,7 +1805,7 @@ TEST_P(HttpStreamFactoryTest, RequestBidirectionalStreamJobFailure) { SSLSocketDataProvider ssl_socket_data(ASYNC, OK); - // If HTTP/1 is used, BidirectionalStreamJob should not be obtained. + // If HTTP/1 is used, BidirectionalStreamImpl should not be obtained. ssl_socket_data.SetNextProto(kProtoHTTP11); session_deps.socket_factory->AddSSLSocketDataProvider(&ssl_socket_data); @@ -1821,7 +1822,7 @@ TEST_P(HttpStreamFactoryTest, RequestBidirectionalStreamJobFailure) { SSLConfig ssl_config; StreamRequestWaiter waiter; scoped_ptr<HttpStreamRequest> request( - session->http_stream_factory()->RequestBidirectionalStreamJob( + session->http_stream_factory()->RequestBidirectionalStreamImpl( request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, BoundNetLog())); waiter.WaitForStream(); @@ -1829,7 +1830,7 @@ TEST_P(HttpStreamFactoryTest, RequestBidirectionalStreamJobFailure) { ASSERT_EQ(ERR_FAILED, waiter.error_status()); EXPECT_FALSE(waiter.websocket_stream()); ASSERT_FALSE(waiter.stream()); - ASSERT_FALSE(waiter.bidirectional_stream_job()); + ASSERT_FALSE(waiter.bidirectional_stream_impl()); EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetTransportSocketPool( HttpNetworkSession::NORMAL_SOCKET_POOL))); EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetSSLSocketPool( diff --git a/net/net.gypi b/net/net.gypi index 80e59a6..b665104 100644 --- a/net/net.gypi +++ b/net/net.gypi @@ -826,8 +826,8 @@ 'filter/sdch_filter.h', 'http/bidirectional_stream.cc', 'http/bidirectional_stream.h', - 'http/bidirectional_stream_job.cc', - 'http/bidirectional_stream_job.h', + 'http/bidirectional_stream_impl.cc', + 'http/bidirectional_stream_impl.h', 'http/bidirectional_stream_request_info.cc', 'http/bidirectional_stream_request_info.h', 'http/des.cc', @@ -1111,8 +1111,8 @@ 'socket/websocket_transport_client_socket_pool.h', 'socket/websocket_transport_connect_sub_job.cc', 'socket/websocket_transport_connect_sub_job.h', - 'spdy/bidirectional_stream_spdy_job.cc', - 'spdy/bidirectional_stream_spdy_job.h', + 'spdy/bidirectional_stream_spdy_impl.cc', + 'spdy/bidirectional_stream_spdy_impl.h', 'spdy/buffered_spdy_framer.cc', 'spdy/buffered_spdy_framer.h', 'spdy/fuzzing/hpack_fuzz_util.cc', diff --git a/net/quic/bidirectional_stream_quic_impl.cc b/net/quic/bidirectional_stream_quic_impl.cc index bd2812e..6e56032 100644 --- a/net/quic/bidirectional_stream_quic_impl.cc +++ b/net/quic/bidirectional_stream_quic_impl.cc @@ -45,7 +45,7 @@ BidirectionalStreamQuicImpl::~BidirectionalStreamQuicImpl() { void BidirectionalStreamQuicImpl::Start( const BidirectionalStreamRequestInfo* request_info, const BoundNetLog& net_log, - BidirectionalStreamJob::Delegate* delegate, + BidirectionalStreamImpl::Delegate* delegate, scoped_ptr<base::Timer> /* timer */) { DCHECK(!stream_); diff --git a/net/quic/bidirectional_stream_quic_impl.h b/net/quic/bidirectional_stream_quic_impl.h index bfc39a6..b75c389 100644 --- a/net/quic/bidirectional_stream_quic_impl.h +++ b/net/quic/bidirectional_stream_quic_impl.h @@ -10,7 +10,7 @@ #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "net/http/bidirectional_stream_job.h" +#include "net/http/bidirectional_stream_impl.h" #include "net/quic/quic_chromium_client_session.h" #include "net/quic/quic_chromium_client_stream.h" @@ -26,7 +26,7 @@ class IOBuffer; class SpdyHeaderBlock; class NET_EXPORT_PRIVATE BidirectionalStreamQuicImpl - : public BidirectionalStreamJob, + : public BidirectionalStreamImpl, public QuicChromiumClientStream::Delegate, public QuicChromiumClientSession::Observer { public: @@ -35,10 +35,10 @@ class NET_EXPORT_PRIVATE BidirectionalStreamQuicImpl ~BidirectionalStreamQuicImpl() override; - // BidirectionalStreamJob implementation: + // BidirectionalStreamImpl implementation: void Start(const BidirectionalStreamRequestInfo* request_info, const BoundNetLog& net_log, - BidirectionalStreamJob::Delegate* delegate, + BidirectionalStreamImpl::Delegate* delegate, scoped_ptr<base::Timer> timer) override; int ReadData(IOBuffer* buffer, int buffer_len) override; void SendData(IOBuffer* data, int length, bool end_stream) override; @@ -77,7 +77,7 @@ class NET_EXPORT_PRIVATE BidirectionalStreamQuicImpl QuicChromiumClientStream* stream_; // Non-owning. const BidirectionalStreamRequestInfo* request_info_; - BidirectionalStreamJob::Delegate* delegate_; + BidirectionalStreamImpl::Delegate* delegate_; // Saves the response status if the stream is explicitly closed via OnError // or OnClose with an error. Once all buffered data has been returned, this // will be used as the final response. diff --git a/net/quic/bidirectional_stream_quic_impl_unittest.cc b/net/quic/bidirectional_stream_quic_impl_unittest.cc index 3f38f5c..dcf45e4 100644 --- a/net/quic/bidirectional_stream_quic_impl_unittest.cc +++ b/net/quic/bidirectional_stream_quic_impl_unittest.cc @@ -51,7 +51,7 @@ const uint16_t kDefaultServerPort = 80; // Size of the buffer to be allocated for each read. const size_t kReadBufferSize = 4096; -class TestDelegateBase : public BidirectionalStreamJob::Delegate { +class TestDelegateBase : public BidirectionalStreamImpl::Delegate { public: TestDelegateBase(IOBuffer* read_buf, int read_buf_len) : TestDelegateBase(read_buf, diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc index 4bb26f9..a550bd9 100644 --- a/net/quic/quic_stream_factory.cc +++ b/net/quic/quic_stream_factory.cc @@ -28,7 +28,7 @@ #include "net/cert/ct_verifier.h" #include "net/dns/host_resolver.h" #include "net/dns/single_request_host_resolver.h" -#include "net/http/bidirectional_stream_job.h" +#include "net/http/bidirectional_stream_impl.h" #include "net/quic/bidirectional_stream_quic_impl.h" #include "net/quic/crypto/channel_id_chromium.h" #include "net/quic/crypto/proof_verifier_chromium.h" @@ -557,8 +557,8 @@ scoped_ptr<QuicHttpStream> QuicStreamRequest::CreateStream() { return make_scoped_ptr(new QuicHttpStream(session_)); } -scoped_ptr<BidirectionalStreamJob> -QuicStreamRequest::CreateBidirectionalStreamJob() { +scoped_ptr<BidirectionalStreamImpl> +QuicStreamRequest::CreateBidirectionalStreamImpl() { if (!session_) return nullptr; return make_scoped_ptr(new BidirectionalStreamQuicImpl(session_)); diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h index 9030779..9bbf995 100644 --- a/net/quic/quic_stream_factory.h +++ b/net/quic/quic_stream_factory.h @@ -56,7 +56,7 @@ class QuicServerInfoFactory; class QuicStreamFactory; class SocketPerformanceWatcherFactory; class TransportSecurityState; -class BidirectionalStreamJob; +class BidirectionalStreamImpl; namespace test { class QuicStreamFactoryPeer; @@ -91,7 +91,7 @@ class NET_EXPORT_PRIVATE QuicStreamRequest { scoped_ptr<QuicHttpStream> CreateStream(); - scoped_ptr<BidirectionalStreamJob> CreateBidirectionalStreamJob(); + scoped_ptr<BidirectionalStreamImpl> CreateBidirectionalStreamImpl(); // Sets |session_|. void SetSession(QuicChromiumClientSession* session); diff --git a/net/spdy/bidirectional_stream_spdy_job.cc b/net/spdy/bidirectional_stream_spdy_impl.cc index 553d191..c7e023b 100644 --- a/net/spdy/bidirectional_stream_spdy_job.cc +++ b/net/spdy/bidirectional_stream_spdy_impl.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/spdy/bidirectional_stream_spdy_job.h" +#include "net/spdy/bidirectional_stream_spdy_impl.h" #include "base/bind.h" #include "base/location.h" @@ -26,7 +26,7 @@ const int kBufferTimeMs = 1; } // namespace -BidirectionalStreamSpdyJob::BidirectionalStreamSpdyJob( +BidirectionalStreamSpdyImpl::BidirectionalStreamSpdyImpl( const base::WeakPtr<SpdySession>& spdy_session) : spdy_session_(spdy_session), request_info_(nullptr), @@ -40,17 +40,17 @@ BidirectionalStreamSpdyJob::BidirectionalStreamSpdyJob( closed_stream_sent_bytes_(0), weak_factory_(this) {} -BidirectionalStreamSpdyJob::~BidirectionalStreamSpdyJob() { +BidirectionalStreamSpdyImpl::~BidirectionalStreamSpdyImpl() { if (stream_) { stream_->DetachDelegate(); DCHECK(!stream_); } } -void BidirectionalStreamSpdyJob::Start( +void BidirectionalStreamSpdyImpl::Start( const BidirectionalStreamRequestInfo* request_info, const BoundNetLog& net_log, - BidirectionalStreamJob::Delegate* delegate, + BidirectionalStreamImpl::Delegate* delegate, scoped_ptr<base::Timer> timer) { DCHECK(!stream_); DCHECK(timer); @@ -68,13 +68,13 @@ void BidirectionalStreamSpdyJob::Start( int rv = stream_request_.StartRequest( SPDY_BIDIRECTIONAL_STREAM, spdy_session_, request_info_->url, request_info_->priority, net_log, - base::Bind(&BidirectionalStreamSpdyJob::OnStreamInitialized, + base::Bind(&BidirectionalStreamSpdyImpl::OnStreamInitialized, weak_factory_.GetWeakPtr())); if (rv != ERR_IO_PENDING) OnStreamInitialized(rv); } -int BidirectionalStreamSpdyJob::ReadData(IOBuffer* buf, int buf_len) { +int BidirectionalStreamSpdyImpl::ReadData(IOBuffer* buf, int buf_len) { if (stream_) DCHECK(!stream_->IsIdle()); @@ -95,9 +95,9 @@ int BidirectionalStreamSpdyJob::ReadData(IOBuffer* buf, int buf_len) { return ERR_IO_PENDING; } -void BidirectionalStreamSpdyJob::SendData(IOBuffer* data, - int length, - bool end_stream) { +void BidirectionalStreamSpdyImpl::SendData(IOBuffer* data, + int length, + bool end_stream) { DCHECK(!stream_closed_); DCHECK(stream_); @@ -105,7 +105,7 @@ void BidirectionalStreamSpdyJob::SendData(IOBuffer* data, end_stream ? NO_MORE_DATA_TO_SEND : MORE_DATA_TO_SEND); } -void BidirectionalStreamSpdyJob::Cancel() { +void BidirectionalStreamSpdyImpl::Cancel() { if (!stream_) return; // Cancels the stream and detaches the delegate so it doesn't get called back. @@ -113,11 +113,11 @@ void BidirectionalStreamSpdyJob::Cancel() { DCHECK(!stream_); } -NextProto BidirectionalStreamSpdyJob::GetProtocol() const { +NextProto BidirectionalStreamSpdyImpl::GetProtocol() const { return negotiated_protocol_; } -int64_t BidirectionalStreamSpdyJob::GetTotalReceivedBytes() const { +int64_t BidirectionalStreamSpdyImpl::GetTotalReceivedBytes() const { if (stream_closed_) return closed_stream_received_bytes_; @@ -127,7 +127,7 @@ int64_t BidirectionalStreamSpdyJob::GetTotalReceivedBytes() const { return stream_->raw_received_bytes(); } -int64_t BidirectionalStreamSpdyJob::GetTotalSentBytes() const { +int64_t BidirectionalStreamSpdyImpl::GetTotalSentBytes() const { if (stream_closed_) return closed_stream_sent_bytes_; @@ -137,14 +137,14 @@ int64_t BidirectionalStreamSpdyJob::GetTotalSentBytes() const { return stream_->raw_sent_bytes(); } -void BidirectionalStreamSpdyJob::OnRequestHeadersSent() { +void BidirectionalStreamSpdyImpl::OnRequestHeadersSent() { DCHECK(stream_); negotiated_protocol_ = stream_->GetProtocol(); delegate_->OnHeadersSent(); } -SpdyResponseHeadersStatus BidirectionalStreamSpdyJob::OnResponseHeadersUpdated( +SpdyResponseHeadersStatus BidirectionalStreamSpdyImpl::OnResponseHeadersUpdated( const SpdyHeaderBlock& response_headers) { DCHECK(stream_); @@ -152,12 +152,13 @@ SpdyResponseHeadersStatus BidirectionalStreamSpdyJob::OnResponseHeadersUpdated( return RESPONSE_HEADERS_ARE_COMPLETE; } -void BidirectionalStreamSpdyJob::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { +void BidirectionalStreamSpdyImpl::OnDataReceived( + scoped_ptr<SpdyBuffer> buffer) { DCHECK(stream_); DCHECK(!stream_closed_); - // If |buffer| is null, BidirectionalStreamSpdyJob::OnClose will be invoked by - // SpdyStream to indicate the end of stream. + // If |buffer| is null, BidirectionalStreamSpdyImpl::OnClose will be invoked + // by SpdyStream to indicate the end of stream. if (!buffer) return; @@ -171,21 +172,21 @@ void BidirectionalStreamSpdyJob::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { } } -void BidirectionalStreamSpdyJob::OnDataSent() { +void BidirectionalStreamSpdyImpl::OnDataSent() { DCHECK(stream_); DCHECK(!stream_closed_); delegate_->OnDataSent(); } -void BidirectionalStreamSpdyJob::OnTrailers(const SpdyHeaderBlock& trailers) { +void BidirectionalStreamSpdyImpl::OnTrailers(const SpdyHeaderBlock& trailers) { DCHECK(stream_); DCHECK(!stream_closed_); delegate_->OnTrailersReceived(trailers); } -void BidirectionalStreamSpdyJob::OnClose(int status) { +void BidirectionalStreamSpdyImpl::OnClose(int status) { DCHECK(stream_); stream_closed_ = true; @@ -205,7 +206,7 @@ void BidirectionalStreamSpdyJob::OnClose(int status) { DoBufferedRead(); } -void BidirectionalStreamSpdyJob::SendRequestHeaders() { +void BidirectionalStreamSpdyImpl::SendRequestHeaders() { scoped_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock); HttpRequestInfo http_request_info; http_request_info.url = request_info_->url; @@ -221,7 +222,7 @@ void BidirectionalStreamSpdyJob::SendRequestHeaders() { : MORE_DATA_TO_SEND); } -void BidirectionalStreamSpdyJob::OnStreamInitialized(int rv) { +void BidirectionalStreamSpdyImpl::OnStreamInitialized(int rv) { DCHECK_NE(ERR_IO_PENDING, rv); if (rv == OK) { stream_ = stream_request_.ReleaseStream(); @@ -232,7 +233,7 @@ void BidirectionalStreamSpdyJob::OnStreamInitialized(int rv) { delegate_->OnFailed(rv); } -void BidirectionalStreamSpdyJob::ScheduleBufferedRead() { +void BidirectionalStreamSpdyImpl::ScheduleBufferedRead() { // If there is already a scheduled DoBufferedRead, don't issue // another one. Mark that we have received more data and return. if (timer_->IsRunning()) { @@ -242,11 +243,11 @@ void BidirectionalStreamSpdyJob::ScheduleBufferedRead() { more_read_data_pending_ = false; timer_->Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kBufferTimeMs), - base::Bind(&BidirectionalStreamSpdyJob::DoBufferedRead, + base::Bind(&BidirectionalStreamSpdyImpl::DoBufferedRead, weak_factory_.GetWeakPtr())); } -void BidirectionalStreamSpdyJob::DoBufferedRead() { +void BidirectionalStreamSpdyImpl::DoBufferedRead() { DCHECK(!timer_->IsRunning()); // Check to see that the stream has not errored out. DCHECK(stream_ || stream_closed_); @@ -269,7 +270,7 @@ void BidirectionalStreamSpdyJob::DoBufferedRead() { } } -bool BidirectionalStreamSpdyJob::ShouldWaitForMoreBufferedData() const { +bool BidirectionalStreamSpdyImpl::ShouldWaitForMoreBufferedData() const { if (stream_closed_) return false; DCHECK_GT(read_buffer_len_, 0); diff --git a/net/spdy/bidirectional_stream_spdy_job.h b/net/spdy/bidirectional_stream_spdy_impl.h index 7dda52f4..62e7bb6 100644 --- a/net/spdy/bidirectional_stream_spdy_job.h +++ b/net/spdy/bidirectional_stream_spdy_impl.h @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_JOB_H_ -#define NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_JOB_H_ +#ifndef NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ +#define NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ #include <stdint.h> #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" -#include "net/http/bidirectional_stream_job.h" +#include "net/http/bidirectional_stream_impl.h" #include "net/http/bidirectional_stream_request_info.h" #include "net/http/http_request_info.h" #include "net/spdy/spdy_read_queue.h" @@ -27,19 +27,19 @@ class BoundNetLog; class IOBuffer; class SpdyHeaderBlock; -class NET_EXPORT_PRIVATE BidirectionalStreamSpdyJob - : public BidirectionalStreamJob, +class NET_EXPORT_PRIVATE BidirectionalStreamSpdyImpl + : public BidirectionalStreamImpl, public SpdyStream::Delegate { public: - explicit BidirectionalStreamSpdyJob( + explicit BidirectionalStreamSpdyImpl( const base::WeakPtr<SpdySession>& spdy_session); - ~BidirectionalStreamSpdyJob() override; + ~BidirectionalStreamSpdyImpl() override; - // BidirectionalStreamJob implementation: + // BidirectionalStreamImpl implementation: void Start(const BidirectionalStreamRequestInfo* request_info, const BoundNetLog& net_log, - BidirectionalStreamJob::Delegate* delegate, + BidirectionalStreamImpl::Delegate* delegate, scoped_ptr<base::Timer> timer) override; int ReadData(IOBuffer* buf, int buf_len) override; void SendData(IOBuffer* data, int length, bool end_stream) override; @@ -66,7 +66,7 @@ class NET_EXPORT_PRIVATE BidirectionalStreamSpdyJob const base::WeakPtr<SpdySession> spdy_session_; const BidirectionalStreamRequestInfo* request_info_; - BidirectionalStreamJob::Delegate* delegate_; + BidirectionalStreamImpl::Delegate* delegate_; scoped_ptr<base::Timer> timer_; SpdyStreamRequest stream_request_; base::WeakPtr<SpdyStream> stream_; @@ -92,11 +92,11 @@ class NET_EXPORT_PRIVATE BidirectionalStreamSpdyJob // bytes sent over the network for |stream_| while it was open. int64_t closed_stream_sent_bytes_; - base::WeakPtrFactory<BidirectionalStreamSpdyJob> weak_factory_; + base::WeakPtrFactory<BidirectionalStreamSpdyImpl> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamSpdyJob); + DISALLOW_COPY_AND_ASSIGN(BidirectionalStreamSpdyImpl); }; } // namespace net -#endif // NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_JOB_H_ +#endif // NET_SPDY_BIDIRECTIONAL_STREAM_SPDY_IMPL_H_ |