Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(632)

Side by Side Diff: net/http/http_stream_factory_impl_job.h

Issue 2260623002: Race TCP connection to proxies with QUIC connections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "net/base/completion_callback.h" 14 #include "net/base/completion_callback.h"
15 #include "net/base/net_export.h" 15 #include "net/base/net_export.h"
16 #include "net/base/request_priority.h" 16 #include "net/base/request_priority.h"
17 #include "net/http/bidirectional_stream_impl.h" 17 #include "net/http/bidirectional_stream_impl.h"
18 #include "net/http/http_auth.h" 18 #include "net/http/http_auth.h"
19 #include "net/http/http_auth_controller.h" 19 #include "net/http/http_auth_controller.h"
20 #include "net/http/http_request_info.h" 20 #include "net/http/http_request_info.h"
21 #include "net/http/http_stream_factory_impl.h" 21 #include "net/http/http_stream_factory_impl.h"
22 #include "net/log/net_log.h" 22 #include "net/log/net_log.h"
23 #include "net/proxy/proxy_server.h"
23 #include "net/proxy/proxy_service.h" 24 #include "net/proxy/proxy_service.h"
24 #include "net/quic/chromium/quic_stream_factory.h" 25 #include "net/quic/chromium/quic_stream_factory.h"
25 #include "net/socket/client_socket_handle.h" 26 #include "net/socket/client_socket_handle.h"
26 #include "net/socket/client_socket_pool_manager.h" 27 #include "net/socket/client_socket_pool_manager.h"
27 #include "net/socket/ssl_client_socket.h" 28 #include "net/socket/ssl_client_socket.h"
28 #include "net/spdy/spdy_session_key.h" 29 #include "net/spdy/spdy_session_key.h"
29 #include "net/ssl/ssl_config_service.h" 30 #include "net/ssl/ssl_config_service.h"
30 31
31 namespace net { 32 namespace net {
32 33
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 const SSLConfig& used_ssl_config, 90 const SSLConfig& used_ssl_config,
90 SSLCertRequestInfo* cert_info) = 0; 91 SSLCertRequestInfo* cert_info) = 0;
91 92
92 // Invoked when |job| needs proxy authentication. 93 // Invoked when |job| needs proxy authentication.
93 virtual void OnNeedsProxyAuth(Job* job, 94 virtual void OnNeedsProxyAuth(Job* job,
94 const HttpResponseInfo& proxy_response, 95 const HttpResponseInfo& proxy_response,
95 const SSLConfig& used_ssl_config, 96 const SSLConfig& used_ssl_config,
96 const ProxyInfo& used_proxy_info, 97 const ProxyInfo& used_proxy_info,
97 HttpAuthController* auth_controller) = 0; 98 HttpAuthController* auth_controller) = 0;
98 99
100 // Invoked when |job| has completed proxy resolution.
Zhongyi Shi 2016/08/19 23:08:42 nit: maybe mention it's default proxy resolution.
tbansal1 2016/08/20 01:53:39 I do not understand this comment. You mean it is c
Zhongyi Shi 2016/08/20 06:15:40 Yeah, just mention that this method is trying to s
tbansal1 2016/08/22 15:42:32 Done. I did not mention the specifics ("a HTTP re
101 virtual void OnResolveProxyComplete(
102 Job* job,
103 const HttpRequestInfo& request_info,
104 RequestPriority priority,
105 const SSLConfig& server_ssl_config,
RyanSturm 2016/08/19 19:03:23 nit: I wouldn't complain if you forward declared S
tbansal1 2016/08/20 01:53:39 Done.
106 const SSLConfig& proxy_ssl_config,
107 HttpStreamRequest::StreamType stream_type) = 0;
108
99 // Invoked to notify the Request and Factory of the readiness of new 109 // Invoked to notify the Request and Factory of the readiness of new
100 // SPDY session. 110 // SPDY session.
101 virtual void OnNewSpdySessionReady( 111 virtual void OnNewSpdySessionReady(
102 Job* job, 112 Job* job,
103 const base::WeakPtr<SpdySession>& spdy_session, 113 const base::WeakPtr<SpdySession>& spdy_session,
104 bool direct) = 0; 114 bool direct) = 0;
105 115
106 // Invoked when the orphaned |job| finishes. 116 // Invoked when the orphaned |job| finishes.
107 virtual void OnOrphanedJobComplete(const Job* job) = 0; 117 virtual void OnOrphanedJobComplete(const Job* job) = 0;
108 118
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 JobType job_type, 159 JobType job_type,
150 HttpNetworkSession* session, 160 HttpNetworkSession* session,
151 const HttpRequestInfo& request_info, 161 const HttpRequestInfo& request_info,
152 RequestPriority priority, 162 RequestPriority priority,
153 const SSLConfig& server_ssl_config, 163 const SSLConfig& server_ssl_config,
154 const SSLConfig& proxy_ssl_config, 164 const SSLConfig& proxy_ssl_config,
155 HostPortPair destination, 165 HostPortPair destination,
156 GURL origin_url, 166 GURL origin_url,
157 NetLog* net_log); 167 NetLog* net_log);
158 168
159 // Constructor for alternative Job. 169 // Constructor for alternative Job. The Job is owned by |delegate|, hence
160 // Job is owned by |delegate|, hence |delegate| is valid for the 170 // |delegate| is valid for the lifetime of the Job.
161 // lifetime of the Job. 171 // If |alternative_proxy_server| is a valid proxy server, then the job will
172 // use that instead of using ProxyService for proxy resolution. Further, if
173 // |alternative_proxy_server| is valid but bad proxy, then fallback proxies
174 // are not used.
Zhongyi Shi 2016/08/19 23:08:42 The comments are a little confusing. If I understa
tbansal1 2016/08/20 01:53:39 Done.
162 Job(Delegate* delegate, 175 Job(Delegate* delegate,
163 JobType job_type, 176 JobType job_type,
164 HttpNetworkSession* session, 177 HttpNetworkSession* session,
165 const HttpRequestInfo& request_info, 178 const HttpRequestInfo& request_info,
166 RequestPriority priority, 179 RequestPriority priority,
167 const SSLConfig& server_ssl_config, 180 const SSLConfig& server_ssl_config,
168 const SSLConfig& proxy_ssl_config, 181 const SSLConfig& proxy_ssl_config,
169 HostPortPair destination, 182 HostPortPair destination,
170 GURL origin_url, 183 GURL origin_url,
171 AlternativeService alternative_service, 184 AlternativeService alternative_service,
185 const ProxyServer& alternative_proxy_server,
172 NetLog* net_log); 186 NetLog* net_log);
173 virtual ~Job(); 187 virtual ~Job();
174 188
175 // Start initiates the process of creating a new HttpStream. 189 // Start initiates the process of creating a new HttpStream.
176 // |delegate_| will be notified upon completion. 190 // |delegate_| will be notified upon completion.
177 void Start(HttpStreamRequest::StreamType stream_type); 191 void Start(HttpStreamRequest::StreamType stream_type);
178 192
179 // Preconnect will attempt to request |num_streams| sockets from the 193 // Preconnect will attempt to request |num_streams| sockets from the
180 // appropriate ClientSocketPool. 194 // appropriate ClientSocketPool.
181 int Preconnect(int num_streams); 195 int Preconnect(int num_streams);
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 int HandleCertificateRequest(int error); 371 int HandleCertificateRequest(int error);
358 372
359 // Moves this stream request into SPDY mode. 373 // Moves this stream request into SPDY mode.
360 void SwitchToSpdyMode(); 374 void SwitchToSpdyMode();
361 375
362 // Should we force QUIC for this stream request. 376 // Should we force QUIC for this stream request.
363 bool ShouldForceQuic() const; 377 bool ShouldForceQuic() const;
364 378
365 void MaybeMarkAlternativeServiceBroken(); 379 void MaybeMarkAlternativeServiceBroken();
366 380
381 // May notify proxy delegate that the alternative proxy server is broken.
RyanSturm 2016/08/19 19:03:23 The "May" here is somewhat confusing. It should be
tbansal1 2016/08/20 01:53:39 Done.
382 void MaybeNotifyAlternativeProxyServerBroken() const;
383
367 ClientSocketPoolManager::SocketGroupType GetSocketGroup() const; 384 ClientSocketPoolManager::SocketGroupType GetSocketGroup() const;
368 385
369 void MaybeCopyConnectionAttemptsFromSocketOrHandle(); 386 void MaybeCopyConnectionAttemptsFromSocketOrHandle();
370 387
371 // Record histograms of latency until Connect() completes. 388 // Record histograms of latency until Connect() completes.
372 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle); 389 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle);
373 390
374 // Invoked by the transport socket pool after host resolution is complete 391 // Invoked by the transport socket pool after host resolution is complete
375 // to allow the connection to be aborted, if a matching SPDY session can 392 // to allow the connection to be aborted, if a matching SPDY session can
376 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a 393 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a
(...skipping 28 matching lines...) Expand all
405 422
406 // AlternativeService for this Job if this is an alternative Job. 423 // AlternativeService for this Job if this is an alternative Job.
407 const AlternativeService alternative_service_; 424 const AlternativeService alternative_service_;
408 425
409 // AlternativeService for the other Job if this is not an alternative Job. 426 // AlternativeService for the other Job if this is not an alternative Job.
410 AlternativeService other_job_alternative_service_; 427 AlternativeService other_job_alternative_service_;
411 428
412 // Unowned. |this| job is owned by |delegate_|. 429 // Unowned. |this| job is owned by |delegate_|.
413 Delegate* delegate_; 430 Delegate* delegate_;
414 431
432 // Alternative proxy server that should be used by |this| to fetch the
433 // request.
434 const ProxyServer alternative_proxy_server_;
435
436 // Alternative proxy server for the other job.
437 ProxyServer other_job_alternative_proxy_server_;
438
415 JobType job_type_; 439 JobType job_type_;
416 440
417 // True if handling a HTTPS request, or using SPDY with SSL 441 // True if handling a HTTPS request, or using SPDY with SSL
418 bool using_ssl_; 442 bool using_ssl_;
419 443
420 // True if this network transaction is using SPDY instead of HTTP. 444 // True if this network transaction is using SPDY instead of HTTP.
421 bool using_spdy_; 445 bool using_spdy_;
422 446
423 // True if this network transaction is using QUIC instead of HTTP. 447 // True if this network transaction is using QUIC instead of HTTP.
424 bool using_quic_; 448 bool using_quic_;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 HttpStreamFactoryImpl::Job::Delegate* delegate, 508 HttpStreamFactoryImpl::Job::Delegate* delegate,
485 HttpStreamFactoryImpl::JobType job_type, 509 HttpStreamFactoryImpl::JobType job_type,
486 HttpNetworkSession* session, 510 HttpNetworkSession* session,
487 const HttpRequestInfo& request_info, 511 const HttpRequestInfo& request_info,
488 RequestPriority priority, 512 RequestPriority priority,
489 const SSLConfig& server_ssl_config, 513 const SSLConfig& server_ssl_config,
490 const SSLConfig& proxy_ssl_config, 514 const SSLConfig& proxy_ssl_config,
491 HostPortPair destination, 515 HostPortPair destination,
492 GURL origin_url, 516 GURL origin_url,
493 AlternativeService alternative_service, 517 AlternativeService alternative_service,
518 const ProxyServer& proxy_server,
RyanSturm 2016/08/19 19:03:23 s/proxy_server/alternative_proxy_server
tbansal1 2016/08/20 01:53:39 Done.
494 NetLog* net_log) = 0; 519 NetLog* net_log) = 0;
495 520
496 // Creates a non-alternative Job. 521 // Creates a non-alternative Job.
497 virtual HttpStreamFactoryImpl::Job* CreateJob( 522 virtual HttpStreamFactoryImpl::Job* CreateJob(
498 HttpStreamFactoryImpl::Job::Delegate* delegate, 523 HttpStreamFactoryImpl::Job::Delegate* delegate,
499 HttpStreamFactoryImpl::JobType job_type, 524 HttpStreamFactoryImpl::JobType job_type,
500 HttpNetworkSession* session, 525 HttpNetworkSession* session,
501 const HttpRequestInfo& request_info, 526 const HttpRequestInfo& request_info,
502 RequestPriority priority, 527 RequestPriority priority,
503 const SSLConfig& server_ssl_config, 528 const SSLConfig& server_ssl_config,
504 const SSLConfig& proxy_ssl_config, 529 const SSLConfig& proxy_ssl_config,
505 HostPortPair destination, 530 HostPortPair destination,
506 GURL origin_url, 531 GURL origin_url,
507 NetLog* net_log) = 0; 532 NetLog* net_log) = 0;
508 }; 533 };
509 534
510 } // namespace net 535 } // namespace net
511 536
512 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ 537 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698