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 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 30 matching lines...) Expand all Loading... | |
41 | 41 |
42 // An HttpStreamRequestImpl exists for each stream which is in progress of being | 42 // An HttpStreamRequestImpl exists for each stream which is in progress of being |
43 // created for the StreamFactory. | 43 // created for the StreamFactory. |
44 class HttpStreamFactoryImpl::Job { | 44 class HttpStreamFactoryImpl::Job { |
45 public: | 45 public: |
46 // Delegate to report Job's status to Request and HttpStreamFactory. | 46 // Delegate to report Job's status to Request and HttpStreamFactory. |
47 class NET_EXPORT_PRIVATE Delegate { | 47 class NET_EXPORT_PRIVATE Delegate { |
48 public: | 48 public: |
49 virtual ~Delegate() {} | 49 virtual ~Delegate() {} |
50 | 50 |
51 // Invoked when |job| has alternative service identified borken. | |
Ryan Hamilton
2016/09/13 04:17:04
s/borken/broken/ (and below)
Zhongyi Shi
2016/09/13 22:52:37
Done.
| |
52 virtual void OnAlternativeServiceBroken(Job* job) = 0; | |
53 | |
54 // Invoked when |job| has alternative proxy server identified borken. | |
55 virtual void OnAlternativeProxyServerBroken(Job* job) = 0; | |
56 | |
51 // Invoked when |job| has an HttpStream ready. | 57 // Invoked when |job| has an HttpStream ready. |
52 virtual void OnStreamReady(Job* job, | 58 virtual void OnStreamReady(Job* job, |
53 const SSLConfig& used_ssl_config, | 59 const SSLConfig& used_ssl_config, |
54 const ProxyInfo& used_proxy_info) = 0; | 60 const ProxyInfo& used_proxy_info) = 0; |
55 | 61 |
56 // Invoked when |job| has a BidirectionalStream ready. | 62 // Invoked when |job| has a BidirectionalStream ready. |
57 virtual void OnBidirectionalStreamImplReady( | 63 virtual void OnBidirectionalStreamImplReady( |
58 Job* job, | 64 Job* job, |
59 const SSLConfig& used_ssl_config, | 65 const SSLConfig& used_ssl_config, |
60 const ProxyInfo& used_proxy_info) = 0; | 66 const ProxyInfo& used_proxy_info) = 0; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 | 234 |
229 bool is_waiting() const { return next_state_ == STATE_WAIT_COMPLETE; } | 235 bool is_waiting() const { return next_state_ == STATE_WAIT_COMPLETE; } |
230 const SSLConfig& server_ssl_config() const; | 236 const SSLConfig& server_ssl_config() const; |
231 const SSLConfig& proxy_ssl_config() const; | 237 const SSLConfig& proxy_ssl_config() const; |
232 const ProxyInfo& proxy_info() const; | 238 const ProxyInfo& proxy_info() const; |
233 | 239 |
234 // Called to indicate that this job succeeded, and some other jobs | 240 // Called to indicate that this job succeeded, and some other jobs |
235 // will be orphaned. | 241 // will be orphaned. |
236 void ReportJobSucceededForRequest(); | 242 void ReportJobSucceededForRequest(); |
237 | 243 |
238 // Marks that the other |job| has completed. | 244 JobType job_type() const { return job_type_; } |
239 virtual void MarkOtherJobComplete(const Job& job); | |
240 | 245 |
241 JobType job_type() const { return job_type_; } | 246 const AlternativeService alternative_service() { |
tbansal1
2016/09/13 05:06:45
Can this method be a const method? Same below.
Zhongyi Shi
2016/09/13 22:52:37
Done.
| |
247 return alternative_service_; | |
248 } | |
249 const ProxyServer alternative_proxy_server() { | |
250 return alternative_proxy_server_; | |
251 } | |
242 | 252 |
243 private: | 253 private: |
244 friend class HttpStreamFactoryImplJobPeer; | 254 friend class HttpStreamFactoryImplJobPeer; |
245 | 255 |
246 enum State { | 256 enum State { |
247 STATE_START, | 257 STATE_START, |
248 STATE_RESOLVE_PROXY, | 258 STATE_RESOLVE_PROXY, |
249 STATE_RESOLVE_PROXY_COMPLETE, | 259 STATE_RESOLVE_PROXY_COMPLETE, |
250 | 260 |
251 // Note that when Alternate-Protocol says we can connect to an alternate | 261 // Note that when Alternate-Protocol says we can connect to an alternate |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 | 383 |
374 // Called to handle a client certificate request. | 384 // Called to handle a client certificate request. |
375 int HandleCertificateRequest(int error); | 385 int HandleCertificateRequest(int error); |
376 | 386 |
377 // Moves this stream request into SPDY mode. | 387 // Moves this stream request into SPDY mode. |
378 void SwitchToSpdyMode(); | 388 void SwitchToSpdyMode(); |
379 | 389 |
380 // Should we force QUIC for this stream request. | 390 // Should we force QUIC for this stream request. |
381 bool ShouldForceQuic() const; | 391 bool ShouldForceQuic() const; |
382 | 392 |
383 void MaybeMarkAlternativeServiceBroken(); | |
384 | |
385 // May notify proxy delegate that the alternative proxy server is broken. The | |
386 // alternative proxy server is considered as broken if the alternative proxy | |
387 // server job failed, but the main job was successful. | |
388 void MaybeNotifyAlternativeProxyServerBroken() const; | |
389 | |
390 ClientSocketPoolManager::SocketGroupType GetSocketGroup() const; | 393 ClientSocketPoolManager::SocketGroupType GetSocketGroup() const; |
391 | 394 |
392 void MaybeCopyConnectionAttemptsFromSocketOrHandle(); | 395 void MaybeCopyConnectionAttemptsFromSocketOrHandle(); |
393 | 396 |
394 // Record histograms of latency until Connect() completes. | 397 // Record histograms of latency until Connect() completes. |
395 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle); | 398 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle); |
396 | 399 |
397 // Invoked by the transport socket pool after host resolution is complete | 400 // Invoked by the transport socket pool after host resolution is complete |
398 // to allow the connection to be aborted, if a matching SPDY session can | 401 // to allow the connection to be aborted, if a matching SPDY session can |
399 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a | 402 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
547 const SSLConfig& server_ssl_config, | 550 const SSLConfig& server_ssl_config, |
548 const SSLConfig& proxy_ssl_config, | 551 const SSLConfig& proxy_ssl_config, |
549 HostPortPair destination, | 552 HostPortPair destination, |
550 GURL origin_url, | 553 GURL origin_url, |
551 NetLog* net_log) = 0; | 554 NetLog* net_log) = 0; |
552 }; | 555 }; |
553 | 556 |
554 } // namespace net | 557 } // namespace net |
555 | 558 |
556 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 559 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
OLD | NEW |