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

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

Issue 14813024: Introduce RequestWebSocketStream into HttpStreamFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename delegate functions. 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_IMPL_H_ 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "net/base/host_port_pair.h" 13 #include "net/base/host_port_pair.h"
14 #include "net/base/net_log.h" 14 #include "net/base/net_log.h"
15 #include "net/http/http_pipelined_host_pool.h" 15 #include "net/http/http_pipelined_host_pool.h"
16 #include "net/http/http_stream_factory.h" 16 #include "net/http/http_stream_factory.h"
17 #include "net/proxy/proxy_server.h" 17 #include "net/proxy/proxy_server.h"
18 #include "net/socket/ssl_client_socket.h" 18 #include "net/socket/ssl_client_socket.h"
19 19
20 namespace net { 20 namespace net {
21 21
22 class HttpNetworkSession; 22 class HttpNetworkSession;
23 class HttpPipelinedHost; 23 class HttpPipelinedHost;
24 class SpdySession; 24 class SpdySession;
25 25
26 class NET_EXPORT_PRIVATE HttpStreamFactoryImpl : 26 class NET_EXPORT_PRIVATE HttpStreamFactoryImpl :
27 public HttpStreamFactory, 27 public HttpStreamFactory,
28 public HttpPipelinedHostPool::Delegate { 28 public HttpPipelinedHostPool::Delegate {
29 public: 29 public:
30 explicit HttpStreamFactoryImpl(HttpNetworkSession* session); 30 explicit HttpStreamFactoryImpl(HttpNetworkSession* session);
mmenke 2013/05/23 20:26:20 An HttpStreamFactory either is for WebSockets, or
yhirano 2013/05/24 14:11:16 I see, I moved for_websocket_ member from HttpStre
31 virtual ~HttpStreamFactoryImpl(); 31 virtual ~HttpStreamFactoryImpl();
32 32
33 // HttpStreamFactory interface 33 // HttpStreamFactory interface
34 virtual HttpStreamRequest* RequestStream( 34 virtual HttpStreamRequest* RequestStream(
35 const HttpRequestInfo& info, 35 const HttpRequestInfo& info,
36 RequestPriority priority, 36 RequestPriority priority,
37 const SSLConfig& server_ssl_config, 37 const SSLConfig& server_ssl_config,
38 const SSLConfig& proxy_ssl_config, 38 const SSLConfig& proxy_ssl_config,
39 HttpStreamRequest::Delegate* delegate, 39 HttpStreamRequest::Delegate* delegate,
40 const BoundNetLog& net_log) OVERRIDE; 40 const BoundNetLog& net_log) OVERRIDE;
41 41
42 virtual HttpStreamRequest* RequestStreamForWebSocket(
43 const HttpRequestInfo& info,
44 RequestPriority priority,
45 const SSLConfig& server_ssl_config,
46 const SSLConfig& proxy_ssl_config,
47 HttpStreamRequest::Delegate* delegate,
48 const BoundNetLog& net_log) OVERRIDE;
49
42 virtual void PreconnectStreams(int num_streams, 50 virtual void PreconnectStreams(int num_streams,
43 const HttpRequestInfo& info, 51 const HttpRequestInfo& info,
44 RequestPriority priority, 52 RequestPriority priority,
45 const SSLConfig& server_ssl_config, 53 const SSLConfig& server_ssl_config,
46 const SSLConfig& proxy_ssl_config) OVERRIDE; 54 const SSLConfig& proxy_ssl_config) OVERRIDE;
47 virtual base::Value* PipelineInfoToValue() const OVERRIDE; 55 virtual base::Value* PipelineInfoToValue() const OVERRIDE;
48 virtual const HostMappingRules* GetHostMappingRules() const OVERRIDE; 56 virtual const HostMappingRules* GetHostMappingRules() const OVERRIDE;
49 57
50 // HttpPipelinedHostPool::Delegate interface 58 // HttpPipelinedHostPool::Delegate interface
51 virtual void OnHttpPipelinedHostHasAdditionalCapacity( 59 virtual void OnHttpPipelinedHostHasAdditionalCapacity(
52 HttpPipelinedHost* host) OVERRIDE; 60 HttpPipelinedHost* host) OVERRIDE;
53 61
54 private: 62 private:
55 class Request; 63 class Request;
56 class Job; 64 class Job;
57 65
58 typedef std::set<Request*> RequestSet; 66 typedef std::set<Request*> RequestSet;
59 typedef std::vector<Request*> RequestVector; 67 typedef std::vector<Request*> RequestVector;
60 typedef std::map<HostPortProxyPair, RequestSet> SpdySessionRequestMap; 68 typedef std::map<HostPortProxyPair, RequestSet> SpdySessionRequestMap;
61 typedef std::map<HttpPipelinedHost::Key, 69 typedef std::map<HttpPipelinedHost::Key,
62 RequestVector> HttpPipeliningRequestMap; 70 RequestVector> HttpPipeliningRequestMap;
63 71
72 HttpStreamRequest* RequestStreamInternal(
73 const HttpRequestInfo& info,
74 RequestPriority priority,
75 const SSLConfig& server_ssl_config,
76 const SSLConfig& proxy_ssl_config,
77 HttpStreamRequest::Delegate* delegate,
78 const BoundNetLog& net_log,
79 bool for_websocket);
80
64 PortAlternateProtocolPair GetAlternateProtocolRequestFor( 81 PortAlternateProtocolPair GetAlternateProtocolRequestFor(
65 const GURL& original_url, 82 const GURL& original_url,
66 GURL* alternate_url) const; 83 GURL* alternate_url) const;
67 84
68 // Detaches |job| from |request|. 85 // Detaches |job| from |request|.
69 void OrphanJob(Job* job, const Request* request); 86 void OrphanJob(Job* job, const Request* request);
70 87
71 // Called when a SpdySession is ready. It will find appropriate Requests and 88 // Called when a SpdySession is ready. It will find appropriate Requests and
72 // fulfill them. |direct| indicates whether or not |spdy_session| uses a 89 // fulfill them. |direct| indicates whether or not |spdy_session| uses a
73 // proxy. 90 // proxy.
74 void OnSpdySessionReady(scoped_refptr<SpdySession> spdy_session, 91 void OnNewSpdySessionReady(scoped_refptr<SpdySession> spdy_session,
75 bool direct, 92 bool direct,
76 const SSLConfig& used_ssl_config, 93 const SSLConfig& used_ssl_config,
77 const ProxyInfo& used_proxy_info, 94 const ProxyInfo& used_proxy_info,
78 bool was_npn_negotiated, 95 bool was_npn_negotiated,
79 NextProto protocol_negotiated, 96 NextProto protocol_negotiated,
80 bool using_spdy, 97 bool using_spdy,
81 const BoundNetLog& net_log); 98 const BoundNetLog& net_log);
82 99
83 // Called when the Job detects that the endpoint indicated by the 100 // Called when the Job detects that the endpoint indicated by the
84 // Alternate-Protocol does not work. Lets the factory update 101 // Alternate-Protocol does not work. Lets the factory update
85 // HttpAlternateProtocols with the failure and resets the SPDY session key. 102 // HttpAlternateProtocols with the failure and resets the SPDY session key.
86 void OnBrokenAlternateProtocol(const Job*, const HostPortPair& origin); 103 void OnBrokenAlternateProtocol(const Job*, const HostPortPair& origin);
87 104
88 // Invoked when an orphaned Job finishes. 105 // Invoked when an orphaned Job finishes.
89 void OnOrphanedJobComplete(const Job* job); 106 void OnOrphanedJobComplete(const Job* job);
90 107
91 // Invoked when the Job finishes preconnecting sockets. 108 // Invoked when the Job finishes preconnecting sockets.
(...skipping 30 matching lines...) Expand all
122 // object. They're owned by HttpStreamFactoryImpl. Leftover jobs will be 139 // object. They're owned by HttpStreamFactoryImpl. Leftover jobs will be
123 // deleted when the factory is destroyed. 140 // deleted when the factory is destroyed.
124 std::set<const Job*> preconnect_job_set_; 141 std::set<const Job*> preconnect_job_set_;
125 142
126 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactoryImpl); 143 DISALLOW_COPY_AND_ASSIGN(HttpStreamFactoryImpl);
127 }; 144 };
128 145
129 } // namespace net 146 } // namespace net
130 147
131 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ 148 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698