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

Unified 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: rebase 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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_stream_factory_impl.h
diff --git a/net/http/http_stream_factory_impl.h b/net/http/http_stream_factory_impl.h
index 80e96ce8ab43d2707e5bac2d3ad8615f53a840af..3e5e82399034fcdaebdd4efdb43a13dbf025dbca 100644
--- a/net/http/http_stream_factory_impl.h
+++ b/net/http/http_stream_factory_impl.h
@@ -28,7 +28,9 @@ class NET_EXPORT_PRIVATE HttpStreamFactoryImpl :
public HttpStreamFactory,
public HttpPipelinedHostPool::Delegate {
public:
- explicit HttpStreamFactoryImpl(HttpNetworkSession* session);
+ // RequestStream may only be called if |for_websockets| is false.
+ // RequestWebSocketStream may only be called if |for_websockets| is true.
+ HttpStreamFactoryImpl(HttpNetworkSession* session, bool for_websockets);
virtual ~HttpStreamFactoryImpl();
// HttpStreamFactory interface
@@ -40,6 +42,15 @@ class NET_EXPORT_PRIVATE HttpStreamFactoryImpl :
HttpStreamRequest::Delegate* delegate,
const BoundNetLog& net_log) OVERRIDE;
+ virtual HttpStreamRequest* RequestWebSocketStream(
+ const HttpRequestInfo& info,
+ RequestPriority priority,
+ const SSLConfig& server_ssl_config,
+ const SSLConfig& proxy_ssl_config,
+ HttpStreamRequest::Delegate* delegate,
+ WebSocketStreamBase::Factory* factory,
+ const BoundNetLog& net_log) OVERRIDE;
+
virtual void PreconnectStreams(int num_streams,
const HttpRequestInfo& info,
RequestPriority priority,
@@ -52,16 +63,31 @@ class NET_EXPORT_PRIVATE HttpStreamFactoryImpl :
virtual void OnHttpPipelinedHostHasAdditionalCapacity(
HttpPipelinedHost* host) OVERRIDE;
- private:
+ protected:
+ // Used in unittests.
class Request;
mmenke 2013/06/13 17:59:56 nit: Is this used in the unit tests?
yhirano 2013/06/14 04:11:25 Reverted.
class Job;
+ // Invoked when an orphaned Job finishes.
+ // virtual for testing.
+ virtual void OnOrphanedJobComplete(const Job* job);
mmenke 2013/06/13 17:59:56 If you follow my other comment, these may not be n
yhirano 2013/06/14 04:11:25 Done.
+
+ private:
typedef std::set<Request*> RequestSet;
typedef std::vector<Request*> RequestVector;
typedef std::map<SpdySessionKey, RequestSet> SpdySessionRequestMap;
typedef std::map<HttpPipelinedHost::Key,
RequestVector> HttpPipeliningRequestMap;
+ HttpStreamRequest* RequestStreamInternal(
+ const HttpRequestInfo& info,
+ RequestPriority priority,
+ const SSLConfig& server_ssl_config,
+ const SSLConfig& proxy_ssl_config,
+ HttpStreamRequest::Delegate* delegate,
+ WebSocketStreamBase::Factory* factory,
+ const BoundNetLog& net_log);
+
PortAlternateProtocolPair GetAlternateProtocolRequestFor(
const GURL& original_url,
GURL* alternate_url) const;
@@ -72,23 +98,20 @@ class NET_EXPORT_PRIVATE HttpStreamFactoryImpl :
// Called when a SpdySession is ready. It will find appropriate Requests and
// fulfill them. |direct| indicates whether or not |spdy_session| uses a
// proxy.
- void OnSpdySessionReady(scoped_refptr<SpdySession> spdy_session,
- bool direct,
- const SSLConfig& used_ssl_config,
- const ProxyInfo& used_proxy_info,
- bool was_npn_negotiated,
- NextProto protocol_negotiated,
- bool using_spdy,
- const BoundNetLog& net_log);
+ void OnNewSpdySessionReady(scoped_refptr<SpdySession> spdy_session,
+ bool direct,
+ const SSLConfig& used_ssl_config,
+ const ProxyInfo& used_proxy_info,
+ bool was_npn_negotiated,
+ NextProto protocol_negotiated,
+ bool using_spdy,
+ const BoundNetLog& net_log);
// Called when the Job detects that the endpoint indicated by the
// Alternate-Protocol does not work. Lets the factory update
// HttpAlternateProtocols with the failure and resets the SPDY session key.
void OnBrokenAlternateProtocol(const Job*, const HostPortPair& origin);
- // Invoked when an orphaned Job finishes.
- void OnOrphanedJobComplete(const Job* job);
-
// Invoked when the Job finishes preconnecting sockets.
void OnPreconnectsComplete(const Job* job);
@@ -124,6 +147,7 @@ class NET_EXPORT_PRIVATE HttpStreamFactoryImpl :
// deleted when the factory is destroyed.
std::set<const Job*> preconnect_job_set_;
+ const bool for_websockets_;
DISALLOW_COPY_AND_ASSIGN(HttpStreamFactoryImpl);
};

Powered by Google App Engine
This is Rietveld 408576698