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

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

Issue 2541093003: Instrument SSL sockets using MemoryDumpProvider (Closed)
Patch Set: rebased 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_crypto_client_stream_factory.h" 30 #include "net/quic/core/quic_crypto_client_stream_factory.h"
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 ssl_config_service_->GetSSLConfig(server_config); 373 ssl_config_service_->GetSSLConfig(server_config);
371 GetAlpnProtos(&server_config->alpn_protos); 374 GetAlpnProtos(&server_config->alpn_protos);
372 *proxy_config = *server_config; 375 *proxy_config = *server_config;
373 if (request.privacy_mode == PRIVACY_MODE_ENABLED) { 376 if (request.privacy_mode == PRIVACY_MODE_ENABLED) {
374 server_config->channel_id_enabled = false; 377 server_config->channel_id_enabled = false;
375 } else if (params_.enable_token_binding && params_.channel_id_service) { 378 } else if (params_.enable_token_binding && params_.channel_id_service) {
376 server_config->token_binding_params.push_back(TB_PARAM_ECDSAP256); 379 server_config->token_binding_params.push_back(TB_PARAM_ECDSAP256);
377 } 380 }
378 } 381 }
379 382
383 void HttpNetworkSession::DumpMemoryStats(
384 base::trace_event::ProcessMemoryDump* pmd,
385 const std::string& parent_absolute_name) const {
386 std::string name = base::StringPrintf("net/http_network_session_%p", this);
387 base::trace_event::MemoryAllocatorDump* http_network_session_dump =
388 pmd->GetAllocatorDump(name);
389 // If memory dump already exists, it means that this is not the first
390 // DumpMemoryStats() invocation on this object and it is reached by another
391 // "parent." If that's the case, add an ownership edge and return early.
392 // This is needed because URLRequestContexts can share an HttpNetworkSession.
393 if (http_network_session_dump != nullptr) {
394 pmd->AddOwnershipEdge(pmd->GetAllocatorDump(parent_absolute_name)->guid(),
Primiano Tucci (use gerrit) 2016/12/06 17:06:28 Hmm I think this is not going to make anything use
xunjieli 2016/12/06 18:36:08 No, it won't ever create two edges between the sam
Primiano Tucci (use gerrit) 2016/12/06 20:15:41 We had an offline chat on this. I dumped my brain
xunjieli 2016/12/06 21:22:11 Thanks for the follow-up! I tried your suggestion
395 http_network_session_dump->guid());
396
397 return;
398 }
399 http_network_session_dump = pmd->CreateAllocatorDump(name);
400 normal_socket_pool_manager_->DumpMemoryStats(
401 pmd, http_network_session_dump->absolute_name());
402 pmd->AddOwnershipEdge(pmd->GetAllocatorDump(parent_absolute_name)->guid(),
403 http_network_session_dump->guid());
404 }
405
380 ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager( 406 ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager(
381 SocketPoolType pool_type) { 407 SocketPoolType pool_type) {
382 switch (pool_type) { 408 switch (pool_type) {
383 case NORMAL_SOCKET_POOL: 409 case NORMAL_SOCKET_POOL:
384 return normal_socket_pool_manager_.get(); 410 return normal_socket_pool_manager_.get();
385 case WEBSOCKET_SOCKET_POOL: 411 case WEBSOCKET_SOCKET_POOL:
386 return websocket_socket_pool_manager_.get(); 412 return websocket_socket_pool_manager_.get();
387 default: 413 default:
388 NOTREACHED(); 414 NOTREACHED();
389 break; 415 break;
(...skipping 25 matching lines...) Expand all
415 break; 441 break;
416 case base::MemoryState::SUSPENDED: 442 case base::MemoryState::SUSPENDED:
417 // Note: Not supported at present. Fall through. 443 // Note: Not supported at present. Fall through.
418 case base::MemoryState::UNKNOWN: 444 case base::MemoryState::UNKNOWN:
419 NOTREACHED(); 445 NOTREACHED();
420 break; 446 break;
421 } 447 }
422 } 448 }
423 449
424 } // namespace net 450 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698