Index: net/http/http_stream_factory_impl.cc |
diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc |
index a8ec97e285bec6b0822fa49f8c33722f5e8baa17..669f04fdbbe93aea47312a1abb141a1a3d4c2cb1 100644 |
--- a/net/http/http_stream_factory_impl.cc |
+++ b/net/http/http_stream_factory_impl.cc |
@@ -4,8 +4,8 @@ |
#include "net/http/http_stream_factory_impl.h" |
+#include <string> |
#include <tuple> |
-#include <utility> |
#include "base/logging.h" |
#include "base/memory/ptr_util.h" |
@@ -32,10 +32,77 @@ |
namespace net { |
+namespace { |
+// Default JobFactory for creating HttpStreamFactoryImpl::Jobs. |
+class DefaultJobFactory : public HttpStreamFactoryImpl::JobFactory { |
+ public: |
+ DefaultJobFactory() {} |
+ |
+ ~DefaultJobFactory() override {} |
+ |
+ HttpStreamFactoryImpl::Job* CreateJob( |
+ HttpStreamFactoryImpl::Job::Delegate* delegate, |
+ HttpStreamFactoryImpl::JobType job_type, |
+ HttpNetworkSession* session, |
+ const HttpRequestInfo& request_info, |
+ RequestPriority priority, |
+ const SSLConfig& server_ssl_config, |
+ const SSLConfig& proxy_ssl_config, |
+ HostPortPair destination, |
+ GURL origin_url, |
+ bool enable_ip_based_pooling, |
+ NetLog* net_log) override { |
+ return new HttpStreamFactoryImpl::Job( |
+ delegate, job_type, session, request_info, priority, server_ssl_config, |
+ proxy_ssl_config, destination, origin_url, enable_ip_based_pooling, |
+ net_log); |
+ } |
+ |
+ HttpStreamFactoryImpl::Job* CreateJob( |
+ HttpStreamFactoryImpl::Job::Delegate* delegate, |
+ HttpStreamFactoryImpl::JobType job_type, |
+ HttpNetworkSession* session, |
+ const HttpRequestInfo& request_info, |
+ RequestPriority priority, |
+ const SSLConfig& server_ssl_config, |
+ const SSLConfig& proxy_ssl_config, |
+ HostPortPair destination, |
+ GURL origin_url, |
+ AlternativeService alternative_service, |
+ bool enable_ip_based_pooling, |
+ NetLog* net_log) override { |
+ return new HttpStreamFactoryImpl::Job( |
+ delegate, job_type, session, request_info, priority, server_ssl_config, |
+ proxy_ssl_config, destination, origin_url, alternative_service, |
+ ProxyServer(), enable_ip_based_pooling, net_log); |
+ } |
+ |
+ HttpStreamFactoryImpl::Job* CreateJob( |
+ HttpStreamFactoryImpl::Job::Delegate* delegate, |
+ HttpStreamFactoryImpl::JobType job_type, |
+ HttpNetworkSession* session, |
+ const HttpRequestInfo& request_info, |
+ RequestPriority priority, |
+ const SSLConfig& server_ssl_config, |
+ const SSLConfig& proxy_ssl_config, |
+ HostPortPair destination, |
+ GURL origin_url, |
+ const ProxyServer& alternative_proxy_server, |
+ bool enable_ip_based_pooling, |
+ NetLog* net_log) override { |
+ return new HttpStreamFactoryImpl::Job( |
+ delegate, job_type, session, request_info, priority, server_ssl_config, |
+ proxy_ssl_config, destination, origin_url, AlternativeService(), |
+ alternative_proxy_server, enable_ip_based_pooling, net_log); |
+ } |
+}; |
+ |
+} // anonymous namespace |
+ |
HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session, |
bool for_websockets) |
: session_(session), |
- job_factory_(new JobFactory()), |
+ job_factory_(new DefaultJobFactory()), |
for_websockets_(for_websockets), |
last_logged_job_controller_count_(0) {} |
@@ -45,7 +112,7 @@ HttpStreamFactoryImpl::~HttpStreamFactoryImpl() { |
job_controller_set_.size()); |
} |
-std::unique_ptr<HttpStreamRequest> HttpStreamFactoryImpl::RequestStream( |
+HttpStreamRequest* HttpStreamFactoryImpl::RequestStream( |
const HttpRequestInfo& request_info, |
RequestPriority priority, |
const SSLConfig& server_ssl_config, |
@@ -61,8 +128,7 @@ std::unique_ptr<HttpStreamRequest> HttpStreamFactoryImpl::RequestStream( |
enable_alternative_services, net_log); |
} |
-std::unique_ptr<HttpStreamRequest> |
-HttpStreamFactoryImpl::RequestWebSocketHandshakeStream( |
+HttpStreamRequest* HttpStreamFactoryImpl::RequestWebSocketHandshakeStream( |
const HttpRequestInfo& request_info, |
RequestPriority priority, |
const SSLConfig& server_ssl_config, |
@@ -80,8 +146,7 @@ HttpStreamFactoryImpl::RequestWebSocketHandshakeStream( |
enable_alternative_services, net_log); |
} |
-std::unique_ptr<HttpStreamRequest> |
-HttpStreamFactoryImpl::RequestBidirectionalStreamImpl( |
+HttpStreamRequest* HttpStreamFactoryImpl::RequestBidirectionalStreamImpl( |
const HttpRequestInfo& request_info, |
RequestPriority priority, |
const SSLConfig& server_ssl_config, |
@@ -99,7 +164,7 @@ HttpStreamFactoryImpl::RequestBidirectionalStreamImpl( |
enable_alternative_services, net_log); |
} |
-std::unique_ptr<HttpStreamRequest> HttpStreamFactoryImpl::RequestStreamInternal( |
+HttpStreamRequest* HttpStreamFactoryImpl::RequestStreamInternal( |
const HttpRequestInfo& request_info, |
RequestPriority priority, |
const SSLConfig& server_ssl_config, |
@@ -116,12 +181,14 @@ std::unique_ptr<HttpStreamRequest> HttpStreamFactoryImpl::RequestStreamInternal( |
auto job_controller = base::MakeUnique<JobController>( |
this, delegate, session_, job_factory_.get(), request_info, |
/* is_preconnect = */ false, enable_ip_based_pooling, |
- enable_alternative_services, server_ssl_config, proxy_ssl_config); |
+ enable_alternative_services); |
JobController* job_controller_raw_ptr = job_controller.get(); |
job_controller_set_.insert(std::move(job_controller)); |
- return job_controller_raw_ptr->Start(delegate, |
- websocket_handshake_stream_create_helper, |
- net_log, stream_type, priority); |
+ Request* request = job_controller_raw_ptr->Start( |
+ request_info, delegate, websocket_handshake_stream_create_helper, net_log, |
+ stream_type, priority, server_ssl_config, proxy_ssl_config); |
+ |
+ return request; |
} |
void HttpStreamFactoryImpl::PreconnectStreams( |
@@ -144,11 +211,11 @@ void HttpStreamFactoryImpl::PreconnectStreams( |
this, nullptr, session_, job_factory_.get(), request_info, |
/* is_preconnect = */ true, |
/* enable_ip_based_pooling = */ true, |
- /* enable_alternative_services = */ true, server_ssl_config, |
- proxy_ssl_config); |
+ /* enable_alternative_services = */ true); |
JobController* job_controller_raw_ptr = job_controller.get(); |
job_controller_set_.insert(std::move(job_controller)); |
- job_controller_raw_ptr->Preconnect(num_streams); |
+ job_controller_raw_ptr->Preconnect(num_streams, request_info, |
+ server_ssl_config, proxy_ssl_config); |
} |
const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { |