Use the same HttpStreamFactoryImpl for Websockets.
Currently, HttpNetworkSession owns two HttpStreamFactoryImpl instances:
one for Websocket requests, one for other requests. This is
unnecessary. This CL makes HttpNetworkSession own and use a single
HttpStreamFactoryImpl for all requests.
HttpStreamFactoryImpl manages JobControllers, and JobController manages
Jobs. Every JobController and Job corresponds to a request and is thus
either Websocket or non-Websocket. Before this CL, Job called
JobController through the Job::Delegate interface to find out whether
it was for a Websocket request, and JobController called
HttpStreamFactoryImpl. This CL removes these calls and instead passes a
Boolean in the constructors that is stored in const members of
JobController and Job.
Bug: 801564
Change-Id: I9e5784713f38dd5871455c96626e9e0d3354e160
Reviewed-on: https://chromium-review.googlesource.com/864562
Commit-Queue: Bence Béky <[email protected]>
Reviewed-by: Adam Rice <[email protected]>
Cr-Commit-Position: refs/heads/master@{#529314}
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index c5871b06..4b1fe0d 100644
--- a/net/http/http_network_session.cc
+++ b/net/http/http_network_session.cc
@@ -5,7 +5,7 @@
#include "net/http/http_network_session.h"
#include <inttypes.h>
-#include <memory>
+
#include <utility>
#include "base/atomic_sequence_num.h"
@@ -232,9 +232,8 @@
AddDefaultHttp2Settings(params.http2_settings),
params.time_func,
context.proxy_delegate),
- http_stream_factory_(new HttpStreamFactoryImpl(this, false)),
- http_stream_factory_for_websocket_(new HttpStreamFactoryImpl(this, true)),
- network_stream_throttler_(new NetworkThrottleManagerImpl()),
+ http_stream_factory_(std::make_unique<HttpStreamFactoryImpl>(this)),
+ network_stream_throttler_(std::make_unique<NetworkThrottleManagerImpl>()),
params_(params),
context_(context) {
DCHECK(proxy_service_);