Chromium Code Reviews| 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 std::string name = | |
| 313 base::StringPrintf("%s/stream_factory", parent_absolute_name.c_str()); | |
| 314 base::trace_event::MemoryAllocatorDump* factory_dump = | |
| 315 pmd->CreateAllocatorDump(name); | |
| 316 size_t alt_job_count = 0; | |
| 317 size_t main_job_count = 0; | |
| 318 size_t preconnect_controller_count = 0; | |
| 319 for (const auto& it : job_controller_set_) { | |
| 320 // For a preconnect controller, it should have exactly the main job. | |
| 321 if (it->is_preconnect()) { | |
| 322 preconnect_controller_count++; | |
| 323 continue; | |
| 324 } | |
| 325 // For non-preconnects. | |
| 326 if (it->HasPendingAltJob()) | |
| 327 alt_job_count++; | |
| 328 if (it->HasPendingMainJob()) | |
| 329 main_job_count++; | |
|
ssid
2017/01/18 23:51:52
I think this was already discussed. Just making su
xunjieli
2017/01/19 14:50:42
I also logged the total size of |job_controller_se
ssid
2017/01/20 20:20:23
Ah okay thanks.
| |
| 330 } | |
| 331 factory_dump->AddScalar( | |
| 332 base::trace_event::MemoryAllocatorDump::kNameSize, | |
| 333 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | |
| 334 base::trace_event::EstimateMemoryUsage(job_controller_set_)); | |
| 335 factory_dump->AddScalar( | |
| 336 base::trace_event::MemoryAllocatorDump::kNameObjectCount, | |
| 337 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | |
| 338 job_controller_set_.size()); | |
| 339 // The number of non-preconnect controllers with a pending alt job. | |
| 340 factory_dump->AddScalar("alt_job_count", | |
| 341 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | |
| 342 alt_job_count); | |
| 343 // The number of non-preconnect controllers with a pending main job. | |
| 344 factory_dump->AddScalar("main_job_count", | |
| 345 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | |
| 346 main_job_count); | |
| 347 // The number of preconnect controllers. | |
| 348 factory_dump->AddScalar("preconnect_count", | |
| 349 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | |
| 350 preconnect_controller_count); | |
| 351 } | |
| 352 | |
| 305 } // namespace net | 353 } // namespace net |
| OLD | NEW |