| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
| 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // lifetime of the Job. | 163 // lifetime of the Job. |
| 164 Job(Delegate* delegate, | 164 Job(Delegate* delegate, |
| 165 JobType job_type, | 165 JobType job_type, |
| 166 HttpNetworkSession* session, | 166 HttpNetworkSession* session, |
| 167 const HttpRequestInfo& request_info, | 167 const HttpRequestInfo& request_info, |
| 168 RequestPriority priority, | 168 RequestPriority priority, |
| 169 const SSLConfig& server_ssl_config, | 169 const SSLConfig& server_ssl_config, |
| 170 const SSLConfig& proxy_ssl_config, | 170 const SSLConfig& proxy_ssl_config, |
| 171 HostPortPair destination, | 171 HostPortPair destination, |
| 172 GURL origin_url, | 172 GURL origin_url, |
| 173 bool enable_ip_based_pooling, |
| 173 NetLog* net_log); | 174 NetLog* net_log); |
| 174 | 175 |
| 175 // Constructor for the alternative Job. The Job is owned by |delegate|, hence | 176 // Constructor for the alternative Job. The Job is owned by |delegate|, hence |
| 176 // |delegate| is valid for the lifetime of the Job. If |alternative_service| | 177 // |delegate| is valid for the lifetime of the Job. If |alternative_service| |
| 177 // is initialized, then the Job will use the alternative service. On the | 178 // is initialized, then the Job will use the alternative service. On the |
| 178 // other hand, if |alternative_proxy_server| is a valid proxy server, then the | 179 // other hand, if |alternative_proxy_server| is a valid proxy server, then the |
| 179 // job will use that instead of using ProxyService for proxy resolution. | 180 // job will use that instead of using ProxyService for proxy resolution. |
| 180 // Further, if |alternative_proxy_server| is a valid but bad proxy, then | 181 // Further, if |alternative_proxy_server| is a valid but bad proxy, then |
| 181 // fallback proxies are not used. It is illegal to call this with an | 182 // fallback proxies are not used. It is illegal to call this with an |
| 182 // initialized |alternative_service|, and a valid |alternative_proxy_server|. | 183 // initialized |alternative_service|, and a valid |alternative_proxy_server|. |
| 183 Job(Delegate* delegate, | 184 Job(Delegate* delegate, |
| 184 JobType job_type, | 185 JobType job_type, |
| 185 HttpNetworkSession* session, | 186 HttpNetworkSession* session, |
| 186 const HttpRequestInfo& request_info, | 187 const HttpRequestInfo& request_info, |
| 187 RequestPriority priority, | 188 RequestPriority priority, |
| 188 const SSLConfig& server_ssl_config, | 189 const SSLConfig& server_ssl_config, |
| 189 const SSLConfig& proxy_ssl_config, | 190 const SSLConfig& proxy_ssl_config, |
| 190 HostPortPair destination, | 191 HostPortPair destination, |
| 191 GURL origin_url, | 192 GURL origin_url, |
| 192 AlternativeService alternative_service, | 193 AlternativeService alternative_service, |
| 193 const ProxyServer& alternative_proxy_server, | 194 const ProxyServer& alternative_proxy_server, |
| 195 bool enable_ip_based_pooling, |
| 194 NetLog* net_log); | 196 NetLog* net_log); |
| 195 virtual ~Job(); | 197 virtual ~Job(); |
| 196 | 198 |
| 197 // Start initiates the process of creating a new HttpStream. | 199 // Start initiates the process of creating a new HttpStream. |
| 198 // |delegate_| will be notified upon completion. | 200 // |delegate_| will be notified upon completion. |
| 199 void Start(HttpStreamRequest::StreamType stream_type); | 201 void Start(HttpStreamRequest::StreamType stream_type); |
| 200 | 202 |
| 201 // Preconnect will attempt to request |num_streams| sockets from the | 203 // Preconnect will attempt to request |num_streams| sockets from the |
| 202 // appropriate ClientSocketPool. | 204 // appropriate ClientSocketPool. |
| 203 int Preconnect(int num_streams); | 205 int Preconnect(int num_streams); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 // Record histograms of latency until Connect() completes. | 387 // Record histograms of latency until Connect() completes. |
| 386 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle); | 388 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle); |
| 387 | 389 |
| 388 // Invoked by the transport socket pool after host resolution is complete | 390 // Invoked by the transport socket pool after host resolution is complete |
| 389 // to allow the connection to be aborted, if a matching SPDY session can | 391 // to allow the connection to be aborted, if a matching SPDY session can |
| 390 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a | 392 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a |
| 391 // session is found, and OK otherwise. | 393 // session is found, and OK otherwise. |
| 392 static int OnHostResolution(SpdySessionPool* spdy_session_pool, | 394 static int OnHostResolution(SpdySessionPool* spdy_session_pool, |
| 393 const SpdySessionKey& spdy_session_key, | 395 const SpdySessionKey& spdy_session_key, |
| 394 const GURL& origin_url, | 396 const GURL& origin_url, |
| 397 bool enable_ip_based_pooling, |
| 395 const AddressList& addresses, | 398 const AddressList& addresses, |
| 396 const NetLogWithSource& net_log); | 399 const NetLogWithSource& net_log); |
| 397 | 400 |
| 398 const HttpRequestInfo request_info_; | 401 const HttpRequestInfo request_info_; |
| 399 RequestPriority priority_; | 402 RequestPriority priority_; |
| 400 ProxyInfo proxy_info_; | 403 ProxyInfo proxy_info_; |
| 401 SSLConfig server_ssl_config_; | 404 SSLConfig server_ssl_config_; |
| 402 SSLConfig proxy_ssl_config_; | 405 SSLConfig proxy_ssl_config_; |
| 403 const NetLogWithSource net_log_; | 406 const NetLogWithSource net_log_; |
| 404 | 407 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 417 // original request when host mapping rules are set-up. | 420 // original request when host mapping rules are set-up. |
| 418 const GURL origin_url_; | 421 const GURL origin_url_; |
| 419 | 422 |
| 420 // AlternativeService for this Job if this is an alternative Job. | 423 // AlternativeService for this Job if this is an alternative Job. |
| 421 const AlternativeService alternative_service_; | 424 const AlternativeService alternative_service_; |
| 422 | 425 |
| 423 // Alternative proxy server that should be used by |this| to fetch the | 426 // Alternative proxy server that should be used by |this| to fetch the |
| 424 // request. | 427 // request. |
| 425 const ProxyServer alternative_proxy_server_; | 428 const ProxyServer alternative_proxy_server_; |
| 426 | 429 |
| 430 // Enable pooling to a SpdySession with matching IP and certificate |
| 431 // even if the SpdySessionKey is different. |
| 432 const bool enable_ip_based_pooling_; |
| 433 |
| 427 // Unowned. |this| job is owned by |delegate_|. | 434 // Unowned. |this| job is owned by |delegate_|. |
| 428 Delegate* delegate_; | 435 Delegate* delegate_; |
| 429 | 436 |
| 430 const JobType job_type_; | 437 const JobType job_type_; |
| 431 | 438 |
| 432 // True if handling a HTTPS request, or using SPDY with SSL | 439 // True if handling a HTTPS request, or using SPDY with SSL |
| 433 bool using_ssl_; | 440 bool using_ssl_; |
| 434 | 441 |
| 435 // True if this network transaction is using SPDY instead of HTTP. | 442 // True if this network transaction is using SPDY instead of HTTP. |
| 436 bool using_spdy_; | 443 bool using_spdy_; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 HttpStreamFactoryImpl::Job::Delegate* delegate, | 502 HttpStreamFactoryImpl::Job::Delegate* delegate, |
| 496 HttpStreamFactoryImpl::JobType job_type, | 503 HttpStreamFactoryImpl::JobType job_type, |
| 497 HttpNetworkSession* session, | 504 HttpNetworkSession* session, |
| 498 const HttpRequestInfo& request_info, | 505 const HttpRequestInfo& request_info, |
| 499 RequestPriority priority, | 506 RequestPriority priority, |
| 500 const SSLConfig& server_ssl_config, | 507 const SSLConfig& server_ssl_config, |
| 501 const SSLConfig& proxy_ssl_config, | 508 const SSLConfig& proxy_ssl_config, |
| 502 HostPortPair destination, | 509 HostPortPair destination, |
| 503 GURL origin_url, | 510 GURL origin_url, |
| 504 AlternativeService alternative_service, | 511 AlternativeService alternative_service, |
| 512 bool enable_ip_based_pooling, |
| 505 NetLog* net_log) = 0; | 513 NetLog* net_log) = 0; |
| 506 | 514 |
| 507 // Creates an alternative proxy server Job. | 515 // Creates an alternative proxy server Job. |
| 508 virtual HttpStreamFactoryImpl::Job* CreateJob( | 516 virtual HttpStreamFactoryImpl::Job* CreateJob( |
| 509 HttpStreamFactoryImpl::Job::Delegate* delegate, | 517 HttpStreamFactoryImpl::Job::Delegate* delegate, |
| 510 HttpStreamFactoryImpl::JobType job_type, | 518 HttpStreamFactoryImpl::JobType job_type, |
| 511 HttpNetworkSession* session, | 519 HttpNetworkSession* session, |
| 512 const HttpRequestInfo& request_info, | 520 const HttpRequestInfo& request_info, |
| 513 RequestPriority priority, | 521 RequestPriority priority, |
| 514 const SSLConfig& server_ssl_config, | 522 const SSLConfig& server_ssl_config, |
| 515 const SSLConfig& proxy_ssl_config, | 523 const SSLConfig& proxy_ssl_config, |
| 516 HostPortPair destination, | 524 HostPortPair destination, |
| 517 GURL origin_url, | 525 GURL origin_url, |
| 518 const ProxyServer& alternative_proxy_server, | 526 const ProxyServer& alternative_proxy_server, |
| 527 bool enable_ip_based_pooling, |
| 519 NetLog* net_log) = 0; | 528 NetLog* net_log) = 0; |
| 520 | 529 |
| 521 // Creates a non-alternative Job. | 530 // Creates a non-alternative Job. |
| 522 virtual HttpStreamFactoryImpl::Job* CreateJob( | 531 virtual HttpStreamFactoryImpl::Job* CreateJob( |
| 523 HttpStreamFactoryImpl::Job::Delegate* delegate, | 532 HttpStreamFactoryImpl::Job::Delegate* delegate, |
| 524 HttpStreamFactoryImpl::JobType job_type, | 533 HttpStreamFactoryImpl::JobType job_type, |
| 525 HttpNetworkSession* session, | 534 HttpNetworkSession* session, |
| 526 const HttpRequestInfo& request_info, | 535 const HttpRequestInfo& request_info, |
| 527 RequestPriority priority, | 536 RequestPriority priority, |
| 528 const SSLConfig& server_ssl_config, | 537 const SSLConfig& server_ssl_config, |
| 529 const SSLConfig& proxy_ssl_config, | 538 const SSLConfig& proxy_ssl_config, |
| 530 HostPortPair destination, | 539 HostPortPair destination, |
| 531 GURL origin_url, | 540 GURL origin_url, |
| 541 bool enable_ip_based_pooling, |
| 532 NetLog* net_log) = 0; | 542 NetLog* net_log) = 0; |
| 533 }; | 543 }; |
| 534 | 544 |
| 535 } // namespace net | 545 } // namespace net |
| 536 | 546 |
| 537 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 547 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
| OLD | NEW |