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

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

Issue 2894723002: Revert of Return Request as unique_ptr from JobController::Start(). (Closed)
Patch Set: Created 3 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
« no previous file with comments | « net/http/http_stream_factory_impl.h ('k') | net/http/http_stream_factory_impl_job_controller.h » ('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 #include "net/http/http_stream_factory_impl.h" 5 #include "net/http/http_stream_factory_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <tuple> 8 #include <tuple>
9 #include <utility>
10 9
11 #include "base/logging.h" 10 #include "base/logging.h"
12 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
13 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
14 #include "base/stl_util.h" 13 #include "base/stl_util.h"
15 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
16 #include "base/strings/stringprintf.h" 15 #include "base/strings/stringprintf.h"
17 #include "base/trace_event/memory_allocator_dump.h" 16 #include "base/trace_event/memory_allocator_dump.h"
18 #include "base/trace_event/memory_usage_estimator.h" 17 #include "base/trace_event/memory_usage_estimator.h"
19 #include "base/trace_event/process_memory_dump.h" 18 #include "base/trace_event/process_memory_dump.h"
(...skipping 19 matching lines...) Expand all
39 job_factory_(new JobFactory()), 38 job_factory_(new JobFactory()),
40 for_websockets_(for_websockets), 39 for_websockets_(for_websockets),
41 last_logged_job_controller_count_(0) {} 40 last_logged_job_controller_count_(0) {}
42 41
43 HttpStreamFactoryImpl::~HttpStreamFactoryImpl() { 42 HttpStreamFactoryImpl::~HttpStreamFactoryImpl() {
44 DCHECK(spdy_session_request_map_.empty()); 43 DCHECK(spdy_session_request_map_.empty());
45 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfJobControllerAtShutDown", 44 UMA_HISTOGRAM_COUNTS_1M("Net.JobControllerSet.CountOfJobControllerAtShutDown",
46 job_controller_set_.size()); 45 job_controller_set_.size());
47 } 46 }
48 47
49 std::unique_ptr<HttpStreamRequest> HttpStreamFactoryImpl::RequestStream( 48 HttpStreamRequest* HttpStreamFactoryImpl::RequestStream(
50 const HttpRequestInfo& request_info, 49 const HttpRequestInfo& request_info,
51 RequestPriority priority, 50 RequestPriority priority,
52 const SSLConfig& server_ssl_config, 51 const SSLConfig& server_ssl_config,
53 const SSLConfig& proxy_ssl_config, 52 const SSLConfig& proxy_ssl_config,
54 HttpStreamRequest::Delegate* delegate, 53 HttpStreamRequest::Delegate* delegate,
55 bool enable_ip_based_pooling, 54 bool enable_ip_based_pooling,
56 bool enable_alternative_services, 55 bool enable_alternative_services,
57 const NetLogWithSource& net_log) { 56 const NetLogWithSource& net_log) {
58 DCHECK(!for_websockets_); 57 DCHECK(!for_websockets_);
59 return RequestStreamInternal( 58 return RequestStreamInternal(
60 request_info, priority, server_ssl_config, proxy_ssl_config, delegate, 59 request_info, priority, server_ssl_config, proxy_ssl_config, delegate,
61 nullptr, HttpStreamRequest::HTTP_STREAM, enable_ip_based_pooling, 60 nullptr, HttpStreamRequest::HTTP_STREAM, enable_ip_based_pooling,
62 enable_alternative_services, net_log); 61 enable_alternative_services, net_log);
63 } 62 }
64 63
65 std::unique_ptr<HttpStreamRequest> 64 HttpStreamRequest* HttpStreamFactoryImpl::RequestWebSocketHandshakeStream(
66 HttpStreamFactoryImpl::RequestWebSocketHandshakeStream(
67 const HttpRequestInfo& request_info, 65 const HttpRequestInfo& request_info,
68 RequestPriority priority, 66 RequestPriority priority,
69 const SSLConfig& server_ssl_config, 67 const SSLConfig& server_ssl_config,
70 const SSLConfig& proxy_ssl_config, 68 const SSLConfig& proxy_ssl_config,
71 HttpStreamRequest::Delegate* delegate, 69 HttpStreamRequest::Delegate* delegate,
72 WebSocketHandshakeStreamBase::CreateHelper* create_helper, 70 WebSocketHandshakeStreamBase::CreateHelper* create_helper,
73 bool enable_ip_based_pooling, 71 bool enable_ip_based_pooling,
74 bool enable_alternative_services, 72 bool enable_alternative_services,
75 const NetLogWithSource& net_log) { 73 const NetLogWithSource& net_log) {
76 DCHECK(for_websockets_); 74 DCHECK(for_websockets_);
77 DCHECK(create_helper); 75 DCHECK(create_helper);
78 return RequestStreamInternal( 76 return RequestStreamInternal(
79 request_info, priority, server_ssl_config, proxy_ssl_config, delegate, 77 request_info, priority, server_ssl_config, proxy_ssl_config, delegate,
80 create_helper, HttpStreamRequest::HTTP_STREAM, enable_ip_based_pooling, 78 create_helper, HttpStreamRequest::HTTP_STREAM, enable_ip_based_pooling,
81 enable_alternative_services, net_log); 79 enable_alternative_services, net_log);
82 } 80 }
83 81
84 std::unique_ptr<HttpStreamRequest> 82 HttpStreamRequest* HttpStreamFactoryImpl::RequestBidirectionalStreamImpl(
85 HttpStreamFactoryImpl::RequestBidirectionalStreamImpl(
86 const HttpRequestInfo& request_info, 83 const HttpRequestInfo& request_info,
87 RequestPriority priority, 84 RequestPriority priority,
88 const SSLConfig& server_ssl_config, 85 const SSLConfig& server_ssl_config,
89 const SSLConfig& proxy_ssl_config, 86 const SSLConfig& proxy_ssl_config,
90 HttpStreamRequest::Delegate* delegate, 87 HttpStreamRequest::Delegate* delegate,
91 bool enable_ip_based_pooling, 88 bool enable_ip_based_pooling,
92 bool enable_alternative_services, 89 bool enable_alternative_services,
93 const NetLogWithSource& net_log) { 90 const NetLogWithSource& net_log) {
94 DCHECK(!for_websockets_); 91 DCHECK(!for_websockets_);
95 DCHECK(request_info.url.SchemeIs(url::kHttpsScheme)); 92 DCHECK(request_info.url.SchemeIs(url::kHttpsScheme));
96 93
97 return RequestStreamInternal( 94 return RequestStreamInternal(
98 request_info, priority, server_ssl_config, proxy_ssl_config, delegate, 95 request_info, priority, server_ssl_config, proxy_ssl_config, delegate,
99 nullptr, HttpStreamRequest::BIDIRECTIONAL_STREAM, enable_ip_based_pooling, 96 nullptr, HttpStreamRequest::BIDIRECTIONAL_STREAM, enable_ip_based_pooling,
100 enable_alternative_services, net_log); 97 enable_alternative_services, net_log);
101 } 98 }
102 99
103 std::unique_ptr<HttpStreamRequest> HttpStreamFactoryImpl::RequestStreamInternal( 100 HttpStreamRequest* HttpStreamFactoryImpl::RequestStreamInternal(
104 const HttpRequestInfo& request_info, 101 const HttpRequestInfo& request_info,
105 RequestPriority priority, 102 RequestPriority priority,
106 const SSLConfig& server_ssl_config, 103 const SSLConfig& server_ssl_config,
107 const SSLConfig& proxy_ssl_config, 104 const SSLConfig& proxy_ssl_config,
108 HttpStreamRequest::Delegate* delegate, 105 HttpStreamRequest::Delegate* delegate,
109 WebSocketHandshakeStreamBase::CreateHelper* 106 WebSocketHandshakeStreamBase::CreateHelper*
110 websocket_handshake_stream_create_helper, 107 websocket_handshake_stream_create_helper,
111 HttpStreamRequest::StreamType stream_type, 108 HttpStreamRequest::StreamType stream_type,
112 bool enable_ip_based_pooling, 109 bool enable_ip_based_pooling,
113 bool enable_alternative_services, 110 bool enable_alternative_services,
114 const NetLogWithSource& net_log) { 111 const NetLogWithSource& net_log) {
115 AddJobControllerCountToHistograms(); 112 AddJobControllerCountToHistograms();
116 113
117 auto job_controller = base::MakeUnique<JobController>( 114 auto job_controller = base::MakeUnique<JobController>(
118 this, delegate, session_, job_factory_.get(), request_info, 115 this, delegate, session_, job_factory_.get(), request_info,
119 /* is_preconnect = */ false, enable_ip_based_pooling, 116 /* is_preconnect = */ false, enable_ip_based_pooling,
120 enable_alternative_services, server_ssl_config, proxy_ssl_config); 117 enable_alternative_services, server_ssl_config, proxy_ssl_config);
121 JobController* job_controller_raw_ptr = job_controller.get(); 118 JobController* job_controller_raw_ptr = job_controller.get();
122 job_controller_set_.insert(std::move(job_controller)); 119 job_controller_set_.insert(std::move(job_controller));
123 return job_controller_raw_ptr->Start(delegate, 120 Request* request = job_controller_raw_ptr->Start(
124 websocket_handshake_stream_create_helper, 121 delegate, websocket_handshake_stream_create_helper, net_log, stream_type,
125 net_log, stream_type, priority); 122 priority);
123
124 return request;
126 } 125 }
127 126
128 void HttpStreamFactoryImpl::PreconnectStreams( 127 void HttpStreamFactoryImpl::PreconnectStreams(
129 int num_streams, 128 int num_streams,
130 const HttpRequestInfo& request_info) { 129 const HttpRequestInfo& request_info) {
131 DCHECK(request_info.url.is_valid()); 130 DCHECK(request_info.url.is_valid());
132 131
133 AddJobControllerCountToHistograms(); 132 AddJobControllerCountToHistograms();
134 133
135 SSLConfig server_ssl_config; 134 SSLConfig server_ssl_config;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 factory_dump->AddScalar("main_job_count", 385 factory_dump->AddScalar("main_job_count",
387 base::trace_event::MemoryAllocatorDump::kUnitsObjects, 386 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
388 main_job_count); 387 main_job_count);
389 // The number of preconnect controllers. 388 // The number of preconnect controllers.
390 factory_dump->AddScalar("preconnect_count", 389 factory_dump->AddScalar("preconnect_count",
391 base::trace_event::MemoryAllocatorDump::kUnitsObjects, 390 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
392 num_controllers_for_preconnect); 391 num_controllers_for_preconnect);
393 } 392 }
394 393
395 } // namespace net 394 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl.h ('k') | net/http/http_stream_factory_impl_job_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698