OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_REQUEST_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 // before knowing if SPDY is available. | 30 // before knowing if SPDY is available. |
31 void SetSpdySessionKey(const HostPortProxyPair& spdy_session_key); | 31 void SetSpdySessionKey(const HostPortProxyPair& spdy_session_key); |
32 | 32 |
33 // Attaches |job| to this request. Does not mean that Request will use |job|, | 33 // Attaches |job| to this request. Does not mean that Request will use |job|, |
34 // but Request will own |job|. | 34 // but Request will own |job|. |
35 void AttachJob(HttpStreamFactoryImpl::Job* job); | 35 void AttachJob(HttpStreamFactoryImpl::Job* job); |
36 | 36 |
37 // Marks completion of the request. Must be called before OnStreamReady(). | 37 // Marks completion of the request. Must be called before OnStreamReady(). |
38 // |source| is the NetLog::Source generated by the Job that fulfilled this | 38 // |source| is the NetLog::Source generated by the Job that fulfilled this |
39 // request. | 39 // request. |
40 void Complete(bool was_alternate_protocol_available, | 40 void Complete(bool was_npn_negotiated, |
41 bool was_npn_negotiated, | |
42 bool using_spdy, | 41 bool using_spdy, |
43 const NetLog::Source& source); | 42 const NetLog::Source& source); |
44 | 43 |
45 // If this Request has a spdy_session_key, remove this session from the | 44 // If this Request has a spdy_session_key, remove this session from the |
46 // SpdySessionRequestMap. | 45 // SpdySessionRequestMap. |
47 void RemoveRequestFromSpdySessionRequestMap(); | 46 void RemoveRequestFromSpdySessionRequestMap(); |
48 | 47 |
49 // Called by an attached Job if it sets up a SpdySession. | 48 // Called by an attached Job if it sets up a SpdySession. |
50 void OnSpdySessionReady(Job* job, | 49 void OnSpdySessionReady(Job* job, |
51 scoped_refptr<SpdySession> spdy_session, | 50 scoped_refptr<SpdySession> spdy_session, |
(...skipping 24 matching lines...) Expand all Loading... |
76 const HttpResponseInfo& response_info, | 75 const HttpResponseInfo& response_info, |
77 const SSLConfig& used_ssl_config, | 76 const SSLConfig& used_ssl_config, |
78 const ProxyInfo& used_proxy_info, | 77 const ProxyInfo& used_proxy_info, |
79 HttpStream* stream); | 78 HttpStream* stream); |
80 | 79 |
81 // HttpStreamRequest methods. | 80 // HttpStreamRequest methods. |
82 | 81 |
83 virtual int RestartTunnelWithProxyAuth(const string16& username, | 82 virtual int RestartTunnelWithProxyAuth(const string16& username, |
84 const string16& password); | 83 const string16& password); |
85 virtual LoadState GetLoadState() const; | 84 virtual LoadState GetLoadState() const; |
86 virtual bool was_alternate_protocol_available() const; | |
87 virtual bool was_npn_negotiated() const; | 85 virtual bool was_npn_negotiated() const; |
88 virtual bool using_spdy() const; | 86 virtual bool using_spdy() const; |
89 | 87 |
90 private: | 88 private: |
91 // Used to orphan all jobs in |jobs_| other than |job| which becomes "bound" | 89 // Used to orphan all jobs in |jobs_| other than |job| which becomes "bound" |
92 // to the request. | 90 // to the request. |
93 void OrphanJobsExcept(Job* job); | 91 void OrphanJobsExcept(Job* job); |
94 | 92 |
95 // Used to orphan all jobs in |jobs_|. | 93 // Used to orphan all jobs in |jobs_|. |
96 void OrphanJobs(); | 94 void OrphanJobs(); |
97 | 95 |
98 const GURL url_; | 96 const GURL url_; |
99 HttpStreamFactoryImpl* const factory_; | 97 HttpStreamFactoryImpl* const factory_; |
100 HttpStreamRequest::Delegate* const delegate_; | 98 HttpStreamRequest::Delegate* const delegate_; |
101 const BoundNetLog net_log_; | 99 const BoundNetLog net_log_; |
102 | 100 |
103 // At the point where Job is irrevocably tied to the Request, we set this. | 101 // At the point where Job is irrevocably tied to the Request, we set this. |
104 scoped_ptr<Job> bound_job_; | 102 scoped_ptr<Job> bound_job_; |
105 std::set<HttpStreamFactoryImpl::Job*> jobs_; | 103 std::set<HttpStreamFactoryImpl::Job*> jobs_; |
106 scoped_ptr<const HostPortProxyPair> spdy_session_key_; | 104 scoped_ptr<const HostPortProxyPair> spdy_session_key_; |
107 | 105 |
108 bool completed_; | 106 bool completed_; |
109 bool was_alternate_protocol_available_; | |
110 bool was_npn_negotiated_; | 107 bool was_npn_negotiated_; |
111 bool using_spdy_; | 108 bool using_spdy_; |
112 | 109 |
113 DISALLOW_COPY_AND_ASSIGN(Request); | 110 DISALLOW_COPY_AND_ASSIGN(Request); |
114 }; | 111 }; |
115 | 112 |
116 } // namespace net | 113 } // namespace net |
117 | 114 |
118 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ | 115 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ |
OLD | NEW |