| OLD | NEW |
| 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 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| 11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "net/http/http_network_session.h" | 14 #include "net/http/http_network_session.h" |
| 15 #include "net/http/http_server_properties.h" | 15 #include "net/http/http_server_properties.h" |
| 16 #include "net/http/http_stream_factory_impl_job.h" | 16 #include "net/http/http_stream_factory_impl_job.h" |
| 17 #include "net/http/http_stream_factory_impl_job_controller.h" | 17 #include "net/http/http_stream_factory_impl_job_controller.h" |
| 18 #include "net/http/http_stream_factory_impl_request.h" | 18 #include "net/http/http_stream_factory_impl_request.h" |
| 19 #include "net/http/transport_security_state.h" | 19 #include "net/http/transport_security_state.h" |
| 20 #include "net/proxy/proxy_info.h" | 20 #include "net/proxy/proxy_info.h" |
| 21 #include "net/quic/core/quic_server_id.h" | 21 #include "net/quic/core/quic_server_id.h" |
| 22 #include "net/spdy/bidirectional_stream_spdy_impl.h" | 22 #include "net/spdy/bidirectional_stream_spdy_impl.h" |
| 23 #include "net/spdy/spdy_http_stream.h" | 23 #include "net/spdy/spdy_http_stream.h" |
| 24 #include "url/gurl.h" | 24 #include "url/gurl.h" |
| 25 #include "url/scheme_host_port.h" | 25 #include "url/scheme_host_port.h" |
| 26 #include "url/url_constants.h" | 26 #include "url/url_constants.h" |
| 27 | 27 |
| 28 #include "base/strings/stringprintf.h" |
| 29 #include "base/trace_event/memory_allocator_dump.h" |
| 30 #include "base/trace_event/process_memory_dump.h" |
| 31 |
| 28 namespace net { | 32 namespace net { |
| 29 | 33 |
| 30 namespace { | 34 namespace { |
| 31 // Default JobFactory for creating HttpStreamFactoryImpl::Jobs. | 35 // Default JobFactory for creating HttpStreamFactoryImpl::Jobs. |
| 32 class DefaultJobFactory : public HttpStreamFactoryImpl::JobFactory { | 36 class DefaultJobFactory : public HttpStreamFactoryImpl::JobFactory { |
| 33 public: | 37 public: |
| 34 DefaultJobFactory() {} | 38 DefaultJobFactory() {} |
| 35 | 39 |
| 36 ~DefaultJobFactory() override {} | 40 ~DefaultJobFactory() override {} |
| 37 | 41 |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 HostPortPair host_port_pair = proxy_info.proxy_server().host_port_pair(); | 299 HostPortPair host_port_pair = proxy_info.proxy_server().host_port_pair(); |
| 296 DCHECK(!host_port_pair.IsEmpty()); | 300 DCHECK(!host_port_pair.IsEmpty()); |
| 297 | 301 |
| 298 url::SchemeHostPort scheme_host_port("https", host_port_pair.host(), | 302 url::SchemeHostPort scheme_host_port("https", host_port_pair.host(), |
| 299 host_port_pair.port()); | 303 host_port_pair.port()); |
| 300 | 304 |
| 301 return session_->http_server_properties()->SupportsRequestPriority( | 305 return session_->http_server_properties()->SupportsRequestPriority( |
| 302 scheme_host_port); | 306 scheme_host_port); |
| 303 } | 307 } |
| 304 | 308 |
| 309 void HttpStreamFactoryImpl::DumpMemoryStats( |
| 310 base::trace_event::ProcessMemoryDump* pmd, |
| 311 const std::string& parent_absolute_name) const { |
| 312 |
| 313 std::string name = base::StringPrintf("%s/factory", parent_absolute_name.c_str
()); |
| 314 base::trace_event::MemoryAllocatorDump* factory = |
| 315 pmd->CreateAllocatorDump(name); |
| 316 factory->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, |
| 317 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 318 job_controller_set_.size()); |
| 319 |
| 320 int i =0; |
| 321 for (const auto& it : job_controller_set_) { |
| 322 i++; |
| 323 base::trace_event::MemoryAllocatorDump* f = |
| 324 pmd->CreateAllocatorDump(base::StringPrintf("%s/%d", name.c_str(), i)); |
| 325 |
| 326 f->AddString("request", "", |
| 327 it->request_ == nullptr ? "null" : "non-null"); |
| 328 f->AddString("main", "", |
| 329 it->main_job_.get() == nullptr ? "null" : "non-null"); |
| 330 f->AddString( |
| 331 "alternative job", "", |
| 332 it->alternative_job_.get() == nullptr ? "null" : "non-null"); |
| 333 f->AddString( |
| 334 "is_preconnect_", "", |
| 335 it->is_preconnect_ ? "true" : "false"); |
| 336 f->AddString( |
| 337 "main_job_is_blocked", "", |
| 338 it->main_job_is_blocked_ ? "true" : "false"); |
| 339 f->AddString( |
| 340 "alt job failed", "", |
| 341 it->alternative_job_failed_ ? "true" : "false"); |
| 342 if (it->main_job_) { |
| 343 f->AddString("main_job state", "", |
| 344 it->main_job_->state()); |
| 345 } |
| 346 f->AddString("is_quic", "", it->is_quic_ ? "true" : "false"); |
| 347 f->AddString("reuse_quic", "", it->reusing_quic_ ? "true" : "false"); |
| 348 f->AddString("is_spdy", "", it->is_spdy_ ? "true" : "false"); |
| 349 } |
| 350 |
| 351 } |
| 352 |
| 305 } // namespace net | 353 } // namespace net |
| OLD | NEW |