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

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

Issue 2541093003: Instrument SSL sockets using MemoryDumpProvider (Closed)
Patch Set: self review Created 4 years 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
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_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
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* parent_dump) const {
389 std::string name = base::StringPrintf("net/http_network_session_%p", this);
390 base::trace_event::MemoryAllocatorDump* http_network_session_dump =
391 parent_dump->process_memory_dump()->GetAllocatorDump(name);
392 // If memory dump already exists, it means that this is not the first
393 // DumpMemoryStats() invocation on this object and it is reached by another
394 // "parent." If that's the case, add an ownership edge and return early.
395 // This is needed because URLRequestContexts can share an HttpNetworkSession.
396 if (http_network_session_dump != nullptr) {
397 parent_dump->process_memory_dump()->AddOwnershipEdge(
398 parent_dump->guid(), http_network_session_dump->guid());
399 return;
400 }
401 http_network_session_dump =
402 parent_dump->process_memory_dump()->CreateAllocatorDump(name);
403 parent_dump->process_memory_dump()->AddOwnershipEdge(
404 parent_dump->guid(), http_network_session_dump->guid());
405 normal_socket_pool_manager_->DumpMemoryStats(http_network_session_dump);
406 }
407
384 ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager( 408 ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager(
385 SocketPoolType pool_type) { 409 SocketPoolType pool_type) {
386 switch (pool_type) { 410 switch (pool_type) {
387 case NORMAL_SOCKET_POOL: 411 case NORMAL_SOCKET_POOL:
388 return normal_socket_pool_manager_.get(); 412 return normal_socket_pool_manager_.get();
389 case WEBSOCKET_SOCKET_POOL: 413 case WEBSOCKET_SOCKET_POOL:
390 return websocket_socket_pool_manager_.get(); 414 return websocket_socket_pool_manager_.get();
391 default: 415 default:
392 NOTREACHED(); 416 NOTREACHED();
393 break; 417 break;
(...skipping 25 matching lines...) Expand all
419 break; 443 break;
420 case base::MemoryState::SUSPENDED: 444 case base::MemoryState::SUSPENDED:
421 // Note: Not supported at present. Fall through. 445 // Note: Not supported at present. Fall through.
422 case base::MemoryState::UNKNOWN: 446 case base::MemoryState::UNKNOWN:
423 NOTREACHED(); 447 NOTREACHED();
424 break; 448 break;
425 } 449 }
426 } 450 }
427 451
428 } // namespace net 452 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698