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

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

Issue 14813024: Introduce RequestWebSocketStream into HttpStreamFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 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
« no previous file with comments | « net/http/http_stream_factory_impl_job.cc ('k') | net/http/http_stream_factory_impl_request.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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"
11 #include "net/base/net_log.h" 11 #include "net/base/net_log.h"
12 #include "net/http/http_stream_factory_impl.h" 12 #include "net/http/http_stream_factory_impl.h"
13 #include "net/socket/ssl_client_socket.h" 13 #include "net/socket/ssl_client_socket.h"
14 #include "net/spdy/spdy_session_key.h" 14 #include "net/spdy/spdy_session_key.h"
15 15
16 namespace net { 16 namespace net {
17 17
18 class ClientSocketHandle;
19 class SpdySession;
20
18 class HttpStreamFactoryImpl::Request : public HttpStreamRequest { 21 class HttpStreamFactoryImpl::Request : public HttpStreamRequest {
19 public: 22 public:
20 Request(const GURL& url, 23 Request(const GURL& url,
21 HttpStreamFactoryImpl* factory, 24 HttpStreamFactoryImpl* factory,
22 HttpStreamRequest::Delegate* delegate, 25 HttpStreamRequest::Delegate* delegate,
26 WebSocketStreamBase::Factory* websocket_stream_factory,
23 const BoundNetLog& net_log); 27 const BoundNetLog& net_log);
24 virtual ~Request(); 28 virtual ~Request();
25 29
26 // The GURL from the HttpRequestInfo the started the Request. 30 // The GURL from the HttpRequestInfo the started the Request.
27 const GURL& url() const { return url_; } 31 const GURL& url() const { return url_; }
28 32
29 // Called when the Job determines the appropriate |spdy_session_key| for the 33 // Called when the Job determines the appropriate |spdy_session_key| for the
30 // Request. Note that this does not mean that SPDY is necessarily supported 34 // Request. Note that this does not mean that SPDY is necessarily supported
31 // for this SpdySessionKey, since we may need to wait for NPN to complete 35 // for this SpdySessionKey, since we may need to wait for NPN to complete
32 // before knowing if SPDY is available. 36 // before knowing if SPDY is available.
(...skipping 18 matching lines...) Expand all
51 55
52 // If this Request has a |spdy_session_key_|, remove this session from the 56 // If this Request has a |spdy_session_key_|, remove this session from the
53 // SpdySessionRequestMap. 57 // SpdySessionRequestMap.
54 void RemoveRequestFromSpdySessionRequestMap(); 58 void RemoveRequestFromSpdySessionRequestMap();
55 59
56 // If this Request has a |http_pipelining_key_|, remove this session from the 60 // If this Request has a |http_pipelining_key_|, remove this session from the
57 // HttpPipeliningRequestMap. 61 // HttpPipeliningRequestMap.
58 void RemoveRequestFromHttpPipeliningRequestMap(); 62 void RemoveRequestFromHttpPipeliningRequestMap();
59 63
60 // Called by an attached Job if it sets up a SpdySession. 64 // Called by an attached Job if it sets up a SpdySession.
61 void OnSpdySessionReady(Job* job, 65 void OnNewSpdySessionReady(Job* job,
62 scoped_refptr<SpdySession> spdy_session, 66 scoped_refptr<SpdySession> spdy_session,
63 bool direct); 67 bool direct);
68
69 WebSocketStreamBase::Factory* websocket_stream_factory() {
70 return websocket_stream_factory_;
71 }
64 72
65 // HttpStreamRequest::Delegate methods which we implement. Note we don't 73 // HttpStreamRequest::Delegate methods which we implement. Note we don't
66 // actually subclass HttpStreamRequest::Delegate. 74 // actually subclass HttpStreamRequest::Delegate.
67 75
68 void OnStreamReady(Job* job, 76 void OnStreamReady(Job* job,
69 const SSLConfig& used_ssl_config, 77 const SSLConfig& used_ssl_config,
70 const ProxyInfo& used_proxy_info, 78 const ProxyInfo& used_proxy_info,
71 HttpStreamBase* stream); 79 HttpStreamBase* stream);
80 void OnWebSocketStreamReady(Job* job,
81 const SSLConfig& used_ssl_config,
82 const ProxyInfo& used_proxy_info,
83 WebSocketStreamBase* stream);
72 void OnStreamFailed(Job* job, int status, const SSLConfig& used_ssl_config); 84 void OnStreamFailed(Job* job, int status, const SSLConfig& used_ssl_config);
73 void OnCertificateError(Job* job, 85 void OnCertificateError(Job* job,
74 int status, 86 int status,
75 const SSLConfig& used_ssl_config, 87 const SSLConfig& used_ssl_config,
76 const SSLInfo& ssl_info); 88 const SSLInfo& ssl_info);
77 void OnNeedsProxyAuth(Job* job, 89 void OnNeedsProxyAuth(Job* job,
78 const HttpResponseInfo& proxy_response, 90 const HttpResponseInfo& proxy_response,
79 const SSLConfig& used_ssl_config, 91 const SSLConfig& used_ssl_config,
80 const ProxyInfo& used_proxy_info, 92 const ProxyInfo& used_proxy_info,
81 HttpAuthController* auth_controller); 93 HttpAuthController* auth_controller);
(...skipping 17 matching lines...) Expand all
99 virtual bool using_spdy() const OVERRIDE; 111 virtual bool using_spdy() const OVERRIDE;
100 112
101 private: 113 private:
102 // Used to orphan all jobs in |jobs_| other than |job| which becomes "bound" 114 // Used to orphan all jobs in |jobs_| other than |job| which becomes "bound"
103 // to the request. 115 // to the request.
104 void OrphanJobsExcept(Job* job); 116 void OrphanJobsExcept(Job* job);
105 117
106 // Used to orphan all jobs in |jobs_|. 118 // Used to orphan all jobs in |jobs_|.
107 void OrphanJobs(); 119 void OrphanJobs();
108 120
121 // Called when a Job succeeds.
122 void OnJobSucceeded(Job* job);
123
109 const GURL url_; 124 const GURL url_;
110 HttpStreamFactoryImpl* const factory_; 125 HttpStreamFactoryImpl* const factory_;
126 WebSocketStreamBase::Factory* const websocket_stream_factory_;
111 HttpStreamRequest::Delegate* const delegate_; 127 HttpStreamRequest::Delegate* const delegate_;
112 const BoundNetLog net_log_; 128 const BoundNetLog net_log_;
113 129
114 // At the point where Job is irrevocably tied to the Request, we set this. 130 // At the point where Job is irrevocably tied to the Request, we set this.
115 scoped_ptr<Job> bound_job_; 131 scoped_ptr<Job> bound_job_;
116 std::set<HttpStreamFactoryImpl::Job*> jobs_; 132 std::set<HttpStreamFactoryImpl::Job*> jobs_;
117 scoped_ptr<const SpdySessionKey> spdy_session_key_; 133 scoped_ptr<const SpdySessionKey> spdy_session_key_;
118 scoped_ptr<const HttpPipelinedHost::Key> http_pipelining_key_; 134 scoped_ptr<const HttpPipelinedHost::Key> http_pipelining_key_;
119 135
120 bool completed_; 136 bool completed_;
121 bool was_npn_negotiated_; 137 bool was_npn_negotiated_;
122 // Protocol negotiated with the server. 138 // Protocol negotiated with the server.
123 NextProto protocol_negotiated_; 139 NextProto protocol_negotiated_;
124 bool using_spdy_; 140 bool using_spdy_;
125 141
126 DISALLOW_COPY_AND_ASSIGN(Request); 142 DISALLOW_COPY_AND_ASSIGN(Request);
127 }; 143 };
128 144
129 } // namespace net 145 } // namespace net
130 146
131 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_H_ 147 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_REQUEST_H_
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job.cc ('k') | net/http/http_stream_factory_impl_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698