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 d321fac532fca5a99ab885008525ae93cd1ff95e..c84e7b737733150119cbad9db1ee6859c1a56916 100644 |
--- a/net/http/http_stream_factory_impl_job_controller.h |
+++ b/net/http/http_stream_factory_impl_job_controller.h |
@@ -26,7 +26,9 @@ class HttpStreamFactoryImpl::JobController |
const HttpRequestInfo& request_info, |
bool is_preconnect, |
bool enable_ip_based_pooling, |
- bool enable_alternative_services); |
+ bool enable_alternative_services, |
+ const SSLConfig& server_ssl_config, |
+ const SSLConfig& proxy_ssl_config); |
~JobController() override; |
@@ -41,20 +43,14 @@ 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. |
- Request* Start(const HttpRequestInfo& request_info, |
- HttpStreamRequest::Delegate* delegate, |
+ Request* Start(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); |
+ RequestPriority priority); |
- void Preconnect(int num_streams, |
- const HttpRequestInfo& request_info, |
- const SSLConfig& server_ssl_config, |
- const SSLConfig& proxy_ssl_config); |
+ void Preconnect(int num_streams); |
// From HttpStreamFactoryImpl::Request::Helper. |
// Returns the LoadState for Request. |
@@ -69,6 +65,14 @@ class HttpStreamFactoryImpl::JobController |
// Proxy authentication credentials are collected. |
int RestartTunnelWithProxyAuth() override; |
+ // Called when we encounter a network error that could be resolved by trying |
Ryan Hamilton
2017/05/09 19:22:07
nit: avoid first person in comments.
xunjieli
2017/05/10 00:26:25
Done.
|
+ // a new proxy configuration. If there is another proxy configuration to try |
+ // then this method sets next_state_ appropriately and returns either OK or |
tbansal1
2017/05/09 20:38:48
s/next_state_/|next_state_|/
xunjieli
2017/05/10 00:26:25
Done.
|
+ // 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); |
tbansal1
2017/05/09 20:38:48
Can this be a private method?
xunjieli
2017/05/10 00:26:25
Done. Good point!
|
+ |
// Called when the priority of transaction changes. |
void SetPriority(RequestPriority priority) override; |
@@ -122,13 +126,6 @@ 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. |
@@ -191,13 +188,23 @@ class HttpStreamFactoryImpl::JobController |
private: |
friend class JobControllerPeer; |
+ enum State { |
+ STATE_RESOLVE_PROXY, |
+ STATE_RESOLVE_PROXY_COMPLETE, |
+ |
+ STATE_CREATE_JOBS, |
+ // STATE_CREATE_JOBS_COMPLETE, |
Ryan Hamilton
2017/05/09 19:22:06
Should this be removed?
xunjieli
2017/05/10 00:26:25
Done. Ah, Good catch!
|
+ 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_|. 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); |
+ int DoCreateJobs(); |
// Called to bind |job| to the |request_| and orphan all other jobs that are |
// still associated with |request_|. |
@@ -227,6 +234,8 @@ class HttpStreamFactoryImpl::JobController |
// of the failed alternative job. |
void OnAlternativeJobFailed(int net_error); |
+ void OnAlternativeProxyJobFailed(int net_error); |
+ |
// Called to report to http_server_properties to mark alternative service |
// broken. |
void ReportBrokenAlternativeService(); |
@@ -261,7 +270,6 @@ 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; |
@@ -306,11 +314,8 @@ class HttpStreamFactoryImpl::JobController |
// Net error code of the failed alternative job. Set to OK by default. |
int alternative_job_net_error_; |
- |
- // Either and only one of these records failed alternative service/proxy |
- // server that |alternative_job_| uses. |
+ // The alternative service server that |alternative_job_| uses failed. |
AlternativeService failed_alternative_service_; |
- ProxyServer failed_alternative_proxy_server_; |
// True if a Job has ever been bound to the |request_|. |
bool job_bound_; |
@@ -335,8 +340,21 @@ class HttpStreamFactoryImpl::JobController |
// Privacy mode that should be used for fetching the resource. |
PrivacyMode privacy_mode_; |
+ State next_state_; |
+ ProxyService::PacRequest* pac_request_; |
+ |
const NetLogWithSource net_log_; |
tbansal1
2017/05/09 20:38:48
nit: |net_log_| should be the last entry (before W
xunjieli
2017/05/10 00:26:25
Done.
|
+ 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_; |
+ |
base::WeakPtrFactory<JobController> ptr_factory_; |
}; |