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_network_session.h" | 5 #include "net/http/http_network_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/debug/stack_trace.h" | 11 #include "base/debug/stack_trace.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/memory_coordinator_client_registry.h" | 13 #include "base/memory/memory_coordinator_client_registry.h" |
| 14 #include "base/memory/ptr_util.h" | 14 #include "base/memory/ptr_util.h" |
| 15 #include "base/profiler/scoped_tracker.h" | 15 #include "base/profiler/scoped_tracker.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/stringprintf.h" | |
| 19 #include "base/trace_event/memory_allocator_dump.h" | |
| 20 #include "base/trace_event/process_memory_dump.h" | |
| 18 #include "base/values.h" | 21 #include "base/values.h" |
| 19 #include "net/base/network_throttle_manager_impl.h" | 22 #include "net/base/network_throttle_manager_impl.h" |
| 20 #include "net/http/http_auth_handler_factory.h" | 23 #include "net/http/http_auth_handler_factory.h" |
| 21 #include "net/http/http_response_body_drainer.h" | 24 #include "net/http/http_response_body_drainer.h" |
| 22 #include "net/http/http_stream_factory_impl.h" | 25 #include "net/http/http_stream_factory_impl.h" |
| 23 #include "net/http/url_security_manager.h" | 26 #include "net/http/url_security_manager.h" |
| 24 #include "net/proxy/proxy_service.h" | 27 #include "net/proxy/proxy_service.h" |
| 25 #include "net/quic/chromium/quic_stream_factory.h" | 28 #include "net/quic/chromium/quic_stream_factory.h" |
| 26 #include "net/quic/core/crypto/quic_random.h" | 29 #include "net/quic/core/crypto/quic_random.h" |
| 27 #include "net/quic/core/quic_clock.h" | 30 #include "net/quic/core/quic_clock.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 ssl_config_service_->GetSSLConfig(server_config); | 377 ssl_config_service_->GetSSLConfig(server_config); |
| 375 GetAlpnProtos(&server_config->alpn_protos); | 378 GetAlpnProtos(&server_config->alpn_protos); |
| 376 *proxy_config = *server_config; | 379 *proxy_config = *server_config; |
| 377 if (request.privacy_mode == PRIVACY_MODE_ENABLED) { | 380 if (request.privacy_mode == PRIVACY_MODE_ENABLED) { |
| 378 server_config->channel_id_enabled = false; | 381 server_config->channel_id_enabled = false; |
| 379 } else if (params_.enable_token_binding && params_.channel_id_service) { | 382 } else if (params_.enable_token_binding && params_.channel_id_service) { |
| 380 server_config->token_binding_params.push_back(TB_PARAM_ECDSAP256); | 383 server_config->token_binding_params.push_back(TB_PARAM_ECDSAP256); |
| 381 } | 384 } |
| 382 } | 385 } |
| 383 | 386 |
| 387 void HttpNetworkSession::DumpMemoryStats( | |
| 388 base::trace_event::MemoryAllocatorDump* url_request_context_dump) const { | |
| 389 std::string name = base::StringPrintf("net/http_network_session_%p", this); | |
| 390 base::trace_event::MemoryAllocatorDump* http_network_session_dump = | |
| 391 url_request_context_dump->process_memory_dump()->GetAllocatorDump(name); | |
| 392 // If |this| is shared with another URLRequestContext, add an Ownership Edge | |
| 393 // and return early. | |
| 394 if (http_network_session_dump != nullptr) { | |
| 395 url_request_context_dump->process_memory_dump()->AddOwnershipEdge( | |
| 396 url_request_context_dump->guid(), http_network_session_dump->guid()); | |
| 397 return; | |
| 398 } | |
| 399 http_network_session_dump = | |
| 400 url_request_context_dump->process_memory_dump()->CreateAllocatorDump( | |
| 401 name); | |
| 402 url_request_context_dump->process_memory_dump()->AddOwnershipEdge( | |
| 403 url_request_context_dump->guid(), http_network_session_dump->guid()); | |
| 404 normal_socket_pool_manager_->DumpMemoryStats(http_network_session_dump); | |
| 405 } | |
|
ssid
2016/12/02 21:36:35
I feel it will look better if it's written as:
if
| |
| 406 | |
| 384 ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager( | 407 ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager( |
| 385 SocketPoolType pool_type) { | 408 SocketPoolType pool_type) { |
| 386 switch (pool_type) { | 409 switch (pool_type) { |
| 387 case NORMAL_SOCKET_POOL: | 410 case NORMAL_SOCKET_POOL: |
| 388 return normal_socket_pool_manager_.get(); | 411 return normal_socket_pool_manager_.get(); |
| 389 case WEBSOCKET_SOCKET_POOL: | 412 case WEBSOCKET_SOCKET_POOL: |
| 390 return websocket_socket_pool_manager_.get(); | 413 return websocket_socket_pool_manager_.get(); |
| 391 default: | 414 default: |
| 392 NOTREACHED(); | 415 NOTREACHED(); |
| 393 break; | 416 break; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 419 break; | 442 break; |
| 420 case base::MemoryState::SUSPENDED: | 443 case base::MemoryState::SUSPENDED: |
| 421 // Note: Not supported at present. Fall through. | 444 // Note: Not supported at present. Fall through. |
| 422 case base::MemoryState::UNKNOWN: | 445 case base::MemoryState::UNKNOWN: |
| 423 NOTREACHED(); | 446 NOTREACHED(); |
| 424 break; | 447 break; |
| 425 } | 448 } |
| 426 } | 449 } |
| 427 | 450 |
| 428 } // namespace net | 451 } // namespace net |
| OLD | NEW |