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

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

Issue 14813024: Introduce RequestWebSocketStream into HttpStreamFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a comment. Created 7 years, 7 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_H_ 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_H_
6 #define NET_HTTP_HTTP_STREAM_FACTORY_H_ 6 #define NET_HTTP_HTTP_STREAM_FACTORY_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 class GURL; 22 class GURL;
23 23
24 namespace base { 24 namespace base {
25 class Value; 25 class Value;
26 } 26 }
27 27
28 namespace net { 28 namespace net {
29 29
30 class AuthCredentials; 30 class AuthCredentials;
31 class BoundNetLog; 31 class BoundNetLog;
32 class ClientSocketHandle;
32 class HostMappingRules; 33 class HostMappingRules;
33 class HostPortPair; 34 class HostPortPair;
34 class HttpAuthController; 35 class HttpAuthController;
35 class HttpResponseInfo; 36 class HttpResponseInfo;
36 class HttpServerProperties; 37 class HttpServerProperties;
37 class HttpStreamBase; 38 class HttpStreamBase;
38 class ProxyInfo; 39 class ProxyInfo;
39 class SSLCertRequestInfo; 40 class SSLCertRequestInfo;
40 class SSLInfo; 41 class SSLInfo;
42 class SpdySession;
41 struct HttpRequestInfo; 43 struct HttpRequestInfo;
42 struct SSLConfig; 44 struct SSLConfig;
43 45
44 // The HttpStreamRequest is the client's handle to the worker object which 46 // The HttpStreamRequest is the client's handle to the worker object which
45 // handles the creation of an HttpStream. While the HttpStream is being 47 // handles the creation of an HttpStream. While the HttpStream is being
46 // created, this object is the creator's handle for interacting with the 48 // created, this object is the creator's handle for interacting with the
47 // HttpStream creation process. The request is cancelled by deleting it, after 49 // HttpStream creation process. The request is cancelled by deleting it, after
48 // which no callbacks will be invoked. 50 // which no callbacks will be invoked.
49 class NET_EXPORT_PRIVATE HttpStreamRequest { 51 class NET_EXPORT_PRIVATE HttpStreamRequest {
50 public: 52 public:
51 // The HttpStreamRequest::Delegate is a set of callback methods for a 53 // The HttpStreamRequest::Delegate is a set of callback methods for a
52 // HttpStreamRequestJob. Generally, only one of these methods will be 54 // HttpStreamRequestJob. Generally, only one of these methods will be
53 // called as a result of a stream request. 55 // called as a result of a stream request.
54 class NET_EXPORT_PRIVATE Delegate { 56 class NET_EXPORT_PRIVATE Delegate {
55 public: 57 public:
56 virtual ~Delegate() {} 58 virtual ~Delegate() {}
57 59
58 // This is the success case. 60 // This is the success case.
59 // |stream| is now owned by the delegate. 61 // |stream| is now owned by the delegate.
60 // |used_ssl_config| indicates the actual SSL configuration used for this 62 // |used_ssl_config| indicates the actual SSL configuration used for this
61 // stream, since the HttpStreamRequest may have modified the configuration 63 // stream, since the HttpStreamRequest may have modified the configuration
62 // during stream processing. 64 // during stream processing.
63 // |used_proxy_info| indicates the actual ProxyInfo used for this stream, 65 // |used_proxy_info| indicates the actual ProxyInfo used for this stream,
64 // since the HttpStreamRequest performs the proxy resolution. 66 // since the HttpStreamRequest performs the proxy resolution.
65 virtual void OnStreamReady( 67 virtual void OnStreamReady(
66 const SSLConfig& used_ssl_config, 68 const SSLConfig& used_ssl_config,
67 const ProxyInfo& used_proxy_info, 69 const ProxyInfo& used_proxy_info,
68 HttpStreamBase* stream) = 0; 70 HttpStreamBase* stream) = 0;
69 71
72 // This is another success case.
Adam Rice 2013/05/13 13:03:03 How about "This is a success case for WebSockets"
yhirano 2013/05/14 05:43:53 Done.
73 // Some factory can call this function instead of OnStreamReady.
Adam Rice 2013/05/13 13:03:03 It is probably better to specifically say RequestS
yhirano 2013/05/14 05:43:53 I deleted this line.
74 // |connection| is now owned by the delegate.
75 // |used_ssl_config| indicates the actual SSL configuration used for this
76 // stream, since the HttpStreamRequest may have modified the configuration
77 // during stream processing.
78 // |used_proxy_info| indicates the actual ProxyInfo used for this stream,
79 // since the HttpStreamRequest performs the proxy resolution.
80 virtual void OnSocketReady(
81 const SSLConfig& used_ssl_config,
82 const ProxyInfo& used_proxy_info,
83 ClientSocketHandle* connection) = 0;
84
85 // This is another success case.
86 // Some factory can call this function instead of OnStreamReady.
87 // |session| is referenced by the caller.
88 // You can create and hold a scoped_refptr pointer to retain it.
Adam Rice 2013/05/13 13:03:03 Better to say "you should" rather than "you can" h
yhirano 2013/05/14 05:43:53 On 2013/05/13 13:03:03, Adam Rice wrote: > Better
89 // |used_ssl_config| indicates the actual SSL configuration used for this
90 // stream, since the HttpStreamRequest may have modified the configuration
91 // during stream processing.
92 // |used_proxy_info| indicates the actual ProxyInfo used for this stream,
93 // since the HttpStreamRequest performs the proxy resolution.
94 virtual void OnSpdySessionReady(
95 const SSLConfig& used_ssl_config,
96 const ProxyInfo& used_proxy_info,
97 SpdySession* session) = 0;
98
70 // This is the failure to create a stream case. 99 // This is the failure to create a stream case.
71 // |used_ssl_config| indicates the actual SSL configuration used for this 100 // |used_ssl_config| indicates the actual SSL configuration used for this
72 // stream, since the HttpStreamRequest may have modified the configuration 101 // stream, since the HttpStreamRequest may have modified the configuration
73 // during stream processing. 102 // during stream processing.
74 virtual void OnStreamFailed(int status, 103 virtual void OnStreamFailed(int status,
75 const SSLConfig& used_ssl_config) = 0; 104 const SSLConfig& used_ssl_config) = 0;
76 105
77 // Called when we have a certificate error for the request. 106 // Called when we have a certificate error for the request.
78 // |used_ssl_config| indicates the actual SSL configuration used for this 107 // |used_ssl_config| indicates the actual SSL configuration used for this
79 // stream, since the HttpStreamRequest may have modified the configuration 108 // stream, since the HttpStreamRequest may have modified the configuration
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 void ProcessAlternateProtocol( 191 void ProcessAlternateProtocol(
163 HttpServerProperties* http_server_properties, 192 HttpServerProperties* http_server_properties,
164 const std::string& alternate_protocol_str, 193 const std::string& alternate_protocol_str,
165 const HostPortPair& http_host_port_pair); 194 const HostPortPair& http_host_port_pair);
166 195
167 GURL ApplyHostMappingRules(const GURL& url, HostPortPair* endpoint); 196 GURL ApplyHostMappingRules(const GURL& url, HostPortPair* endpoint);
168 197
169 // Virtual interface methods. 198 // Virtual interface methods.
170 199
171 // Request a stream. 200 // Request a stream.
172 // Will callback to the HttpStreamRequestDelegate upon completion. 201 // Will call delegate->OnStreamReady upon completion.
173 virtual HttpStreamRequest* RequestStream( 202 virtual HttpStreamRequest* RequestStream(
174 const HttpRequestInfo& info, 203 const HttpRequestInfo& info,
175 RequestPriority priority, 204 RequestPriority priority,
176 const SSLConfig& server_ssl_config, 205 const SSLConfig& server_ssl_config,
177 const SSLConfig& proxy_ssl_config, 206 const SSLConfig& proxy_ssl_config,
178 HttpStreamRequest::Delegate* delegate, 207 HttpStreamRequest::Delegate* delegate,
179 const BoundNetLog& net_log) = 0; 208 const BoundNetLog& net_log) = 0;
180 209
210 // Request a stream part for a websocket connection.
Adam Rice 2013/05/13 13:03:03 I do not understand the word "part" in this contex
yhirano 2013/05/14 05:43:53 Done.
211 // Will call delegate->OnSocketReady or delegate->OnSpdySessionReady
212 // upon completion.
213 virtual HttpStreamRequest* RequestStreamForWebSocket(
214 const HttpRequestInfo& info,
215 RequestPriority priority,
216 const SSLConfig& server_ssl_config,
217 const SSLConfig& proxy_ssl_config,
218 HttpStreamRequest::Delegate* delegate,
219 const BoundNetLog& net_log) = 0;
220
181 // Requests that enough connections for |num_streams| be opened. 221 // Requests that enough connections for |num_streams| be opened.
182 virtual void PreconnectStreams(int num_streams, 222 virtual void PreconnectStreams(int num_streams,
183 const HttpRequestInfo& info, 223 const HttpRequestInfo& info,
184 RequestPriority priority, 224 RequestPriority priority,
185 const SSLConfig& server_ssl_config, 225 const SSLConfig& server_ssl_config,
186 const SSLConfig& proxy_ssl_config) = 0; 226 const SSLConfig& proxy_ssl_config) = 0;
187 227
188 // If pipelining is supported, creates a Value summary of the currently active 228 // If pipelining is supported, creates a Value summary of the currently active
189 // pipelines. Caller assumes ownership of the returned value. Otherwise, 229 // pipelines. Caller assumes ownership of the returned value. Otherwise,
190 // returns an empty Value. 230 // returns an empty Value.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 static bool force_spdy_over_ssl_; 309 static bool force_spdy_over_ssl_;
270 static bool force_spdy_always_; 310 static bool force_spdy_always_;
271 static std::list<HostPortPair>* forced_spdy_exclusions_; 311 static std::list<HostPortPair>* forced_spdy_exclusions_;
272 312
273 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory); 313 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory);
274 }; 314 };
275 315
276 } // namespace net 316 } // namespace net
277 317
278 #endif // NET_HTTP_HTTP_STREAM_FACTORY_H_ 318 #endif // NET_HTTP_HTTP_STREAM_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698