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_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 "net/base/net_log.h" | 10 #include "net/base/net_log.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 // The GURL from the HttpRequestInfo the started the Request. | 32 // The GURL from the HttpRequestInfo the started the Request. |
33 const GURL& url() const { return url_; } | 33 const GURL& url() const { return url_; } |
34 | 34 |
35 // Called when the Job determines the appropriate |spdy_session_key| for the | 35 // Called when the Job determines the appropriate |spdy_session_key| for the |
36 // Request. Note that this does not mean that SPDY is necessarily supported | 36 // Request. Note that this does not mean that SPDY is necessarily supported |
37 // for this SpdySessionKey, since we may need to wait for NPN to complete | 37 // for this SpdySessionKey, since we may need to wait for NPN to complete |
38 // before knowing if SPDY is available. | 38 // before knowing if SPDY is available. |
39 void SetSpdySessionKey(const SpdySessionKey& spdy_session_key); | 39 void SetSpdySessionKey(const SpdySessionKey& spdy_session_key); |
40 | 40 |
41 // Called when the Job determines the appropriate |http_pipelining_key| for | |
42 // the Request. Registers this Request with the factory, so that if an | |
43 // existing pipeline becomes available, this Request can be late bound to it. | |
44 // Returns true if this is this key was new to the factory. | |
45 bool SetHttpPipeliningKey(const HttpPipelinedHost::Key& http_pipelining_key); | |
46 | |
47 // Attaches |job| to this request. Does not mean that Request will use |job|, | 41 // Attaches |job| to this request. Does not mean that Request will use |job|, |
48 // but Request will own |job|. | 42 // but Request will own |job|. |
49 void AttachJob(HttpStreamFactoryImpl::Job* job); | 43 void AttachJob(HttpStreamFactoryImpl::Job* job); |
50 | 44 |
51 // Marks completion of the request. Must be called before OnStreamReady(). | 45 // Marks completion of the request. Must be called before OnStreamReady(). |
52 // |job_net_log| is the BoundNetLog of the Job that fulfilled this request. | 46 // |job_net_log| is the BoundNetLog of the Job that fulfilled this request. |
53 void Complete(bool was_npn_negotiated, | 47 void Complete(bool was_npn_negotiated, |
54 NextProto protocol_negotiated, | 48 NextProto protocol_negotiated, |
55 bool using_spdy, | 49 bool using_spdy, |
56 const BoundNetLog& job_net_log); | 50 const BoundNetLog& job_net_log); |
57 | 51 |
58 // If this Request has a |spdy_session_key_|, remove this session from the | 52 // If this Request has a |spdy_session_key_|, remove this session from the |
59 // SpdySessionRequestMap. | 53 // SpdySessionRequestMap. |
60 void RemoveRequestFromSpdySessionRequestMap(); | 54 void RemoveRequestFromSpdySessionRequestMap(); |
61 | 55 |
62 // If this Request has a |http_pipelining_key_|, remove this session from the | |
63 // HttpPipeliningRequestMap. | |
64 void RemoveRequestFromHttpPipeliningRequestMap(); | |
65 | |
66 // Called by an attached Job if it sets up a SpdySession. | 56 // Called by an attached Job if it sets up a SpdySession. |
67 void OnNewSpdySessionReady(Job* job, | 57 void OnNewSpdySessionReady(Job* job, |
68 scoped_ptr<HttpStream> stream, | 58 scoped_ptr<HttpStream> stream, |
69 const base::WeakPtr<SpdySession>& spdy_session, | 59 const base::WeakPtr<SpdySession>& spdy_session, |
70 bool direct); | 60 bool direct); |
71 | 61 |
72 WebSocketHandshakeStreamBase::CreateHelper* | 62 WebSocketHandshakeStreamBase::CreateHelper* |
73 websocket_handshake_stream_create_helper() { | 63 websocket_handshake_stream_create_helper() { |
74 return websocket_handshake_stream_create_helper_; | 64 return websocket_handshake_stream_create_helper_; |
75 } | 65 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 HttpStreamFactoryImpl* const factory_; | 120 HttpStreamFactoryImpl* const factory_; |
131 WebSocketHandshakeStreamBase::CreateHelper* const | 121 WebSocketHandshakeStreamBase::CreateHelper* const |
132 websocket_handshake_stream_create_helper_; | 122 websocket_handshake_stream_create_helper_; |
133 HttpStreamRequest::Delegate* const delegate_; | 123 HttpStreamRequest::Delegate* const delegate_; |
134 const BoundNetLog net_log_; | 124 const BoundNetLog net_log_; |
135 | 125 |
136 // At the point where Job is irrevocably tied to the Request, we set this. | 126 // At the point where Job is irrevocably tied to the Request, we set this. |
137 scoped_ptr<Job> bound_job_; | 127 scoped_ptr<Job> bound_job_; |
138 std::set<HttpStreamFactoryImpl::Job*> jobs_; | 128 std::set<HttpStreamFactoryImpl::Job*> jobs_; |
139 scoped_ptr<const SpdySessionKey> spdy_session_key_; | 129 scoped_ptr<const SpdySessionKey> spdy_session_key_; |
140 scoped_ptr<const HttpPipelinedHost::Key> http_pipelining_key_; | |
141 | 130 |
142 bool completed_; | 131 bool completed_; |
143 bool was_npn_negotiated_; | 132 bool was_npn_negotiated_; |
144 // Protocol negotiated with the server. | 133 // Protocol negotiated with the server. |
145 NextProto protocol_negotiated_; | 134 NextProto protocol_negotiated_; |
146 bool using_spdy_; | 135 bool using_spdy_; |
147 | 136 |
148 DISALLOW_COPY_AND_ASSIGN(Request); | 137 DISALLOW_COPY_AND_ASSIGN(Request); |
149 }; | 138 }; |
150 | 139 |
151 } // namespace net | 140 } // namespace net |
152 | 141 |
153 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ | 142 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_ |
OLD | NEW |