| 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 "base/strings/stringprintf.h" |
| 15 #include "base/trace_event/memory_allocator_dump.h" |
| 16 #include "base/trace_event/memory_usage_estimator.h" |
| 17 #include "base/trace_event/process_memory_dump.h" |
| 14 #include "net/http/http_network_session.h" | 18 #include "net/http/http_network_session.h" |
| 15 #include "net/http/http_server_properties.h" | 19 #include "net/http/http_server_properties.h" |
| 16 #include "net/http/http_stream_factory_impl_job.h" | 20 #include "net/http/http_stream_factory_impl_job.h" |
| 17 #include "net/http/http_stream_factory_impl_job_controller.h" | 21 #include "net/http/http_stream_factory_impl_job_controller.h" |
| 18 #include "net/http/http_stream_factory_impl_request.h" | 22 #include "net/http/http_stream_factory_impl_request.h" |
| 19 #include "net/http/transport_security_state.h" | 23 #include "net/http/transport_security_state.h" |
| 20 #include "net/proxy/proxy_info.h" | 24 #include "net/proxy/proxy_info.h" |
| 21 #include "net/quic/core/quic_server_id.h" | 25 #include "net/quic/core/quic_server_id.h" |
| 22 #include "net/spdy/bidirectional_stream_spdy_impl.h" | 26 #include "net/spdy/bidirectional_stream_spdy_impl.h" |
| 23 #include "net/spdy/spdy_http_stream.h" | 27 #include "net/spdy/spdy_http_stream.h" |
| (...skipping 271 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 if (job_controller_set_.empty()) |
| 313 return; |
| 314 std::string name = |
| 315 base::StringPrintf("%s/stream_factory", parent_absolute_name.c_str()); |
| 316 base::trace_event::MemoryAllocatorDump* factory_dump = |
| 317 pmd->CreateAllocatorDump(name); |
| 318 size_t alt_job_count = 0; |
| 319 size_t main_job_count = 0; |
| 320 size_t preconnect_controller_count = 0; |
| 321 for (const auto& it : job_controller_set_) { |
| 322 // For a preconnect controller, it should have exactly the main job. |
| 323 if (it->is_preconnect()) { |
| 324 preconnect_controller_count++; |
| 325 continue; |
| 326 } |
| 327 // For non-preconnects. |
| 328 if (it->HasPendingAltJob()) |
| 329 alt_job_count++; |
| 330 if (it->HasPendingMainJob()) |
| 331 main_job_count++; |
| 332 } |
| 333 factory_dump->AddScalar( |
| 334 base::trace_event::MemoryAllocatorDump::kNameSize, |
| 335 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 336 base::trace_event::EstimateMemoryUsage(job_controller_set_)); |
| 337 factory_dump->AddScalar( |
| 338 base::trace_event::MemoryAllocatorDump::kNameObjectCount, |
| 339 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 340 job_controller_set_.size()); |
| 341 // The number of non-preconnect controllers with a pending alt job. |
| 342 factory_dump->AddScalar("alt_job_count", |
| 343 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 344 alt_job_count); |
| 345 // The number of non-preconnect controllers with a pending main job. |
| 346 factory_dump->AddScalar("main_job_count", |
| 347 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 348 main_job_count); |
| 349 // The number of preconnect controllers. |
| 350 factory_dump->AddScalar("preconnect_count", |
| 351 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 352 preconnect_controller_count); |
| 353 } |
| 354 |
| 305 } // namespace net | 355 } // namespace net |
| OLD | NEW |