Index: net/http/http_stream_factory_impl_job_controller.h |
diff --git a/net/http/http_stream_factory_impl_job_controller.h b/net/http/http_stream_factory_impl_job_controller.h |
index ce0494c79c4a997f887dc54df42d8b728b4f2249..20eb0391f4883aecea42994c7df28c5f450745ec 100644 |
--- a/net/http/http_stream_factory_impl_job_controller.h |
+++ b/net/http/http_stream_factory_impl_job_controller.h |
@@ -28,9 +28,7 @@ class HttpStreamFactoryImpl::JobController |
const HttpRequestInfo& request_info, |
bool is_preconnect, |
bool enable_ip_based_pooling, |
- bool enable_alternative_services, |
- const SSLConfig& server_ssl_config, |
- const SSLConfig& proxy_ssl_config); |
+ bool enable_alternative_services); |
~JobController() override; |
@@ -45,14 +43,20 @@ class HttpStreamFactoryImpl::JobController |
// Methods below are called by HttpStreamFactoryImpl only. |
// Creates request and hands out to HttpStreamFactoryImpl, this will also |
// create Job(s) and start serving the created request. |
- std::unique_ptr<Request> Start(HttpStreamRequest::Delegate* delegate, |
- WebSocketHandshakeStreamBase::CreateHelper* |
- websocket_handshake_stream_create_helper, |
- const NetLogWithSource& source_net_log, |
- HttpStreamRequest::StreamType stream_type, |
- RequestPriority priority); |
- |
- void Preconnect(int num_streams); |
+ Request* Start(const HttpRequestInfo& request_info, |
+ HttpStreamRequest::Delegate* delegate, |
+ WebSocketHandshakeStreamBase::CreateHelper* |
+ websocket_handshake_stream_create_helper, |
+ const NetLogWithSource& source_net_log, |
+ HttpStreamRequest::StreamType stream_type, |
+ RequestPriority priority, |
+ const SSLConfig& server_ssl_config, |
+ const SSLConfig& proxy_ssl_config); |
+ |
+ void Preconnect(int num_streams, |
+ const HttpRequestInfo& request_info, |
+ const SSLConfig& server_ssl_config, |
+ const SSLConfig& proxy_ssl_config); |
// From HttpStreamFactoryImpl::Request::Helper. |
// Returns the LoadState for Request. |
@@ -120,6 +124,13 @@ class HttpStreamFactoryImpl::JobController |
bool OnInitConnection(const ProxyInfo& proxy_info) override; |
+ void OnResolveProxyComplete( |
+ Job* job, |
+ const HttpRequestInfo& request_info, |
+ RequestPriority priority, |
+ const SSLConfig& server_ssl_config, |
+ const SSLConfig& proxy_ssl_config, |
+ HttpStreamRequest::StreamType stream_type) override; |
// Invoked to notify the Request and Factory of the readiness of new |
// SPDY session. |
@@ -182,21 +193,13 @@ class HttpStreamFactoryImpl::JobController |
private: |
friend class JobControllerPeer; |
- enum State { |
- STATE_RESOLVE_PROXY, |
- STATE_RESOLVE_PROXY_COMPLETE, |
- STATE_CREATE_JOBS, |
- STATE_NONE |
- }; |
- |
- void OnIOComplete(int result); |
- void OnResolveProxyError(int error); |
- void RunLoop(int result); |
- int DoLoop(int result); |
- int DoResolveProxy(); |
- int DoResolveProxyComplete(int result); |
- // Creates Job(s) for |request_info_|. Job(s) will be owned by |this|. |
- int DoCreateJobs(); |
+ // Creates Job(s) for |request_|. Job(s) will be owned by |this|. |
+ void CreateJobs(const HttpRequestInfo& request_info, |
+ RequestPriority priority, |
+ const SSLConfig& server_ssl_config, |
+ const SSLConfig& proxy_ssl_config, |
+ HttpStreamRequest::Delegate* delegate, |
+ HttpStreamRequest::StreamType stream_type); |
// Called to bind |job| to the |request_| and orphan all other jobs that are |
// still associated with |request_|. |
@@ -222,13 +225,9 @@ class HttpStreamFactoryImpl::JobController |
NextProto negotiated_protocol, |
bool using_spdy); |
- // Must be called when the alternative service job fails. |net_error| is the |
- // net error of the failed alternative service job. |
- void OnAlternativeServiceJobFailed(int net_error); |
- |
- // Must be called when the alternative proxy job fails. |net_error| is the |
- // net error of the failed alternative proxy job. |
- void OnAlternativeProxyJobFailed(int net_error); |
+ // Must be called when the alternative job fails. |net_error| is the net error |
+ // of the failed alternative job. |
+ void OnAlternativeJobFailed(int net_error); |
// Called to report to http_server_properties to mark alternative service |
// broken. |
@@ -236,8 +235,6 @@ class HttpStreamFactoryImpl::JobController |
void MaybeNotifyFactoryOfCompletion(); |
- void NotifyRequestFailed(int rv); |
- |
// Called to resume the main job with delay. Main job is resumed only when |
// |alternative_job_| has failed or |main_job_wait_time_| elapsed. |
void MaybeResumeMainJob(Job* job, const base::TimeDelta& delay); |
@@ -266,6 +263,7 @@ class HttpStreamFactoryImpl::JobController |
// alternative proxy server. |alternative_proxy_server| should not be null, |
// and is owned by the caller. |
bool ShouldCreateAlternativeProxyServerJob( |
+ Job* job, |
const ProxyInfo& proxy_info_, |
const GURL& url, |
ProxyServer* alternative_proxy_server) const; |
@@ -274,17 +272,12 @@ class HttpStreamFactoryImpl::JobController |
// called when |job| has succeeded and the other job will be orphaned. |
void ReportAlternateProtocolUsage(Job* job) const; |
+ // Starts the |alternative_job_|. |
+ void StartAlternativeProxyServerJob(); |
+ |
// Returns whether |job| is an orphaned job. |
bool IsJobOrphaned(Job* job) const; |
- // Called when a Job encountered a network error that could be resolved by |
- // trying a new proxy configuration. If there is another proxy configuration |
- // to try then this method sets |next_state_| appropriately and returns either |
- // OK or ERR_IO_PENDING depending on whether or not the new proxy |
- // configuration is available synchronously or asynchronously. Otherwise, the |
- // given error code is simply returned. |
- int ReconsiderProxyAfterError(Job* job, int error); |
- |
HttpStreamFactoryImpl* factory_; |
HttpNetworkSession* session_; |
JobFactory* job_factory_; |
@@ -315,8 +308,11 @@ class HttpStreamFactoryImpl::JobController |
// Net error code of the failed alternative job. Set to OK by default. |
int alternative_job_net_error_; |
- // The alternative service server that |alternative_job_| uses failed. |
+ |
+ // Either and only one of these records failed alternative service/proxy |
+ // server that |alternative_job_| uses. |
AlternativeService failed_alternative_service_; |
+ ProxyServer failed_alternative_proxy_server_; |
// True if a Job has ever been bound to the |request_|. |
bool job_bound_; |
@@ -338,16 +334,9 @@ class HttpStreamFactoryImpl::JobController |
// True if an alternative proxy server job can be started to fetch |request_|. |
bool can_start_alternative_proxy_job_; |
- State next_state_; |
- ProxyService::PacRequest* pac_request_; |
- CompletionCallback io_callback_; |
- const HttpRequestInfo request_info_; |
- ProxyInfo proxy_info_; |
- const SSLConfig server_ssl_config_; |
- const SSLConfig proxy_ssl_config_; |
- int num_streams_; |
- HttpStreamRequest::StreamType stream_type_; |
- RequestPriority priority_; |
+ // Privacy mode that should be used for fetching the resource. |
+ PrivacyMode privacy_mode_; |
+ |
const NetLogWithSource net_log_; |
base::WeakPtrFactory<JobController> ptr_factory_; |