| 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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 // The GURL from the HttpRequestInfo the started the Request. | 24 // The GURL from the HttpRequestInfo the started the Request. |
| 25 const GURL& url() const { return url_; } | 25 const GURL& url() const { return url_; } |
| 26 | 26 |
| 27 // Called when the Job determines the appropriate |spdy_session_key| for the | 27 // Called when the Job determines the appropriate |spdy_session_key| for the |
| 28 // Request. Note that this does not mean that SPDY is necessarily supported | 28 // Request. Note that this does not mean that SPDY is necessarily supported |
| 29 // for this HostPortProxyPair, since we may need to wait for NPN to complete | 29 // for this HostPortProxyPair, since we may need to wait for NPN to complete |
| 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 // Called when the Job determines the appropriate |http_pipelining_key| for |
| 34 // the Request. Registers this Request with the factory, so that if an |
| 35 // existing pipeline becomes available, this Request can be late bound to it. |
| 36 void SetHttpPipeliningKey(const HostPortPair& http_pipelining_key); |
| 37 |
| 33 // Attaches |job| to this request. Does not mean that Request will use |job|, | 38 // Attaches |job| to this request. Does not mean that Request will use |job|, |
| 34 // but Request will own |job|. | 39 // but Request will own |job|. |
| 35 void AttachJob(HttpStreamFactoryImpl::Job* job); | 40 void AttachJob(HttpStreamFactoryImpl::Job* job); |
| 36 | 41 |
| 37 // Marks completion of the request. Must be called before OnStreamReady(). | 42 // Marks completion of the request. Must be called before OnStreamReady(). |
| 38 // |source| is the NetLog::Source generated by the Job that fulfilled this | 43 // |source| is the NetLog::Source generated by the Job that fulfilled this |
| 39 // request. | 44 // request. |
| 40 void Complete(bool was_npn_negotiated, | 45 void Complete(bool was_npn_negotiated, |
| 41 bool using_spdy, | 46 bool using_spdy, |
| 42 const NetLog::Source& source); | 47 const NetLog::Source& source); |
| 43 | 48 |
| 44 // If this Request has a spdy_session_key, remove this session from the | 49 // If this Request has a |spdy_session_key_|, remove this session from the |
| 45 // SpdySessionRequestMap. | 50 // SpdySessionRequestMap. |
| 46 void RemoveRequestFromSpdySessionRequestMap(); | 51 void RemoveRequestFromSpdySessionRequestMap(); |
| 47 | 52 |
| 53 // If this Request has a |http_pipelining_key_|, remove this session from the |
| 54 // HttpPipeliningRequestMap. |
| 55 void RemoveRequestFromHttpPipeliningRequestMap(); |
| 56 |
| 48 // Called by an attached Job if it sets up a SpdySession. | 57 // Called by an attached Job if it sets up a SpdySession. |
| 49 void OnSpdySessionReady(Job* job, | 58 void OnSpdySessionReady(Job* job, |
| 50 scoped_refptr<SpdySession> spdy_session, | 59 scoped_refptr<SpdySession> spdy_session, |
| 51 bool direct); | 60 bool direct); |
| 52 | 61 |
| 53 // HttpStreamRequest::Delegate methods which we implement. Note we don't | 62 // HttpStreamRequest::Delegate methods which we implement. Note we don't |
| 54 // actually subclass HttpStreamRequest::Delegate. | 63 // actually subclass HttpStreamRequest::Delegate. |
| 55 | 64 |
| 56 void OnStreamReady(Job* job, | 65 void OnStreamReady(Job* job, |
| 57 const SSLConfig& used_ssl_config, | 66 const SSLConfig& used_ssl_config, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 104 |
| 96 const GURL url_; | 105 const GURL url_; |
| 97 HttpStreamFactoryImpl* const factory_; | 106 HttpStreamFactoryImpl* const factory_; |
| 98 HttpStreamRequest::Delegate* const delegate_; | 107 HttpStreamRequest::Delegate* const delegate_; |
| 99 const BoundNetLog net_log_; | 108 const BoundNetLog net_log_; |
| 100 | 109 |
| 101 // At the point where Job is irrevocably tied to the Request, we set this. | 110 // At the point where Job is irrevocably tied to the Request, we set this. |
| 102 scoped_ptr<Job> bound_job_; | 111 scoped_ptr<Job> bound_job_; |
| 103 std::set<HttpStreamFactoryImpl::Job*> jobs_; | 112 std::set<HttpStreamFactoryImpl::Job*> jobs_; |
| 104 scoped_ptr<const HostPortProxyPair> spdy_session_key_; | 113 scoped_ptr<const HostPortProxyPair> spdy_session_key_; |
| 114 scoped_ptr<const HostPortPair> http_pipelining_key_; |
| 105 | 115 |
| 106 bool completed_; | 116 bool completed_; |
| 107 bool was_npn_negotiated_; | 117 bool was_npn_negotiated_; |
| 108 bool using_spdy_; | 118 bool using_spdy_; |
| 109 | 119 |
| 110 DISALLOW_COPY_AND_ASSIGN(Request); | 120 DISALLOW_COPY_AND_ASSIGN(Request); |
| 111 }; | 121 }; |
| 112 | 122 |
| 113 } // namespace net | 123 } // namespace net |
| 114 | 124 |
| 115 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ | 125 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ |
| OLD | NEW |