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

Side by Side Diff: net/spdy/spdy_session_pool.cc

Issue 1547273003: Set trusted SPDY proxy dynamically on per-profile basis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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/spdy/spdy_session_pool.h" 5 #include "net/spdy/spdy_session_pool.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
11 #include "base/profiler/scoped_tracker.h" 11 #include "base/profiler/scoped_tracker.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "net/base/address_list.h" 13 #include "net/base/address_list.h"
14 #include "net/base/trusted_spdy_proxy_provider.h"
14 #include "net/http/http_network_session.h" 15 #include "net/http/http_network_session.h"
15 #include "net/http/http_server_properties.h" 16 #include "net/http/http_server_properties.h"
16 #include "net/spdy/spdy_session.h" 17 #include "net/spdy/spdy_session.h"
17 18
18 namespace net { 19 namespace net {
19 20
20 namespace { 21 namespace {
21 22
22 enum SpdySessionGetTypes { 23 enum SpdySessionGetTypes {
23 CREATED_NEW = 0, 24 CREATED_NEW = 0,
(...skipping 10 matching lines...) Expand all
34 SSLConfigService* ssl_config_service, 35 SSLConfigService* ssl_config_service,
35 const base::WeakPtr<HttpServerProperties>& http_server_properties, 36 const base::WeakPtr<HttpServerProperties>& http_server_properties,
36 TransportSecurityState* transport_security_state, 37 TransportSecurityState* transport_security_state,
37 bool enable_compression, 38 bool enable_compression,
38 bool enable_ping_based_connection_checking, 39 bool enable_ping_based_connection_checking,
39 NextProto default_protocol, 40 NextProto default_protocol,
40 size_t session_max_recv_window_size, 41 size_t session_max_recv_window_size,
41 size_t stream_max_recv_window_size, 42 size_t stream_max_recv_window_size,
42 size_t initial_max_concurrent_streams, 43 size_t initial_max_concurrent_streams,
43 SpdySessionPool::TimeFunc time_func, 44 SpdySessionPool::TimeFunc time_func,
44 const std::string& trusted_spdy_proxy) 45 const base::WeakPtr<TrustedSpdyProxyProvider>& trusted_spdy_proxy_provider)
45 : http_server_properties_(http_server_properties), 46 : http_server_properties_(http_server_properties),
46 transport_security_state_(transport_security_state), 47 transport_security_state_(transport_security_state),
47 ssl_config_service_(ssl_config_service), 48 ssl_config_service_(ssl_config_service),
48 resolver_(resolver), 49 resolver_(resolver),
49 verify_domain_authentication_(true), 50 verify_domain_authentication_(true),
50 enable_sending_initial_data_(true), 51 enable_sending_initial_data_(true),
51 enable_compression_(enable_compression), 52 enable_compression_(enable_compression),
52 enable_ping_based_connection_checking_( 53 enable_ping_based_connection_checking_(
53 enable_ping_based_connection_checking), 54 enable_ping_based_connection_checking),
54 // TODO(akalin): Force callers to have a valid value of 55 // TODO(akalin): Force callers to have a valid value of
55 // |default_protocol_|. 56 // |default_protocol_|.
56 default_protocol_((default_protocol == kProtoUnknown) ? kProtoSPDY31 57 default_protocol_((default_protocol == kProtoUnknown) ? kProtoSPDY31
57 : default_protocol), 58 : default_protocol),
58 session_max_recv_window_size_(session_max_recv_window_size), 59 session_max_recv_window_size_(session_max_recv_window_size),
59 stream_max_recv_window_size_(stream_max_recv_window_size), 60 stream_max_recv_window_size_(stream_max_recv_window_size),
60 initial_max_concurrent_streams_(initial_max_concurrent_streams), 61 initial_max_concurrent_streams_(initial_max_concurrent_streams),
61 time_func_(time_func), 62 time_func_(time_func),
62 trusted_spdy_proxy_(HostPortPair::FromString(trusted_spdy_proxy)) { 63 trusted_spdy_proxy_provider_(trusted_spdy_proxy_provider) {
63 DCHECK(default_protocol_ >= kProtoSPDYMinimumVersion && 64 DCHECK(default_protocol_ >= kProtoSPDYMinimumVersion &&
64 default_protocol_ <= kProtoSPDYMaximumVersion); 65 default_protocol_ <= kProtoSPDYMaximumVersion);
65 NetworkChangeNotifier::AddIPAddressObserver(this); 66 NetworkChangeNotifier::AddIPAddressObserver(this);
66 if (ssl_config_service_.get()) 67 if (ssl_config_service_.get())
67 ssl_config_service_->AddObserver(this); 68 ssl_config_service_->AddObserver(this);
68 CertDatabase::GetInstance()->AddObserver(this); 69 CertDatabase::GetInstance()->AddObserver(this);
69 } 70 }
70 71
71 SpdySessionPool::~SpdySessionPool() { 72 SpdySessionPool::~SpdySessionPool() {
72 CloseAllSessions(); 73 CloseAllSessions();
(...skipping 21 matching lines...) Expand all
94 95
95 UMA_HISTOGRAM_ENUMERATION( 96 UMA_HISTOGRAM_ENUMERATION(
96 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); 97 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX);
97 98
98 scoped_ptr<SpdySession> new_session(new SpdySession( 99 scoped_ptr<SpdySession> new_session(new SpdySession(
99 key, http_server_properties_, transport_security_state_, 100 key, http_server_properties_, transport_security_state_,
100 verify_domain_authentication_, enable_sending_initial_data_, 101 verify_domain_authentication_, enable_sending_initial_data_,
101 enable_compression_, enable_ping_based_connection_checking_, 102 enable_compression_, enable_ping_based_connection_checking_,
102 default_protocol_, session_max_recv_window_size_, 103 default_protocol_, session_max_recv_window_size_,
103 stream_max_recv_window_size_, initial_max_concurrent_streams_, time_func_, 104 stream_max_recv_window_size_, initial_max_concurrent_streams_, time_func_,
104 trusted_spdy_proxy_, net_log.net_log())); 105 trusted_spdy_proxy_provider_, net_log.net_log()));
105 106
106 new_session->InitializeWithSocket(std::move(connection), this, is_secure, 107 new_session->InitializeWithSocket(std::move(connection), this, is_secure,
107 certificate_error_code); 108 certificate_error_code);
108 109
109 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); 110 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr();
110 sessions_.insert(new_session.release()); 111 sessions_.insert(new_session.release());
111 MapKeyToAvailableSession(key, available_session); 112 MapKeyToAvailableSession(key, available_session);
112 113
113 net_log.AddEvent( 114 net_log.AddEvent(
114 NetLog::TYPE_HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, 115 NetLog::TYPE_HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET,
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 372
372 if (idle_only && (*it)->is_active()) 373 if (idle_only && (*it)->is_active())
373 continue; 374 continue;
374 375
375 (*it)->CloseSessionOnError(error, description); 376 (*it)->CloseSessionOnError(error, description);
376 DCHECK(!IsSessionAvailable(*it)); 377 DCHECK(!IsSessionAvailable(*it));
377 } 378 }
378 } 379 }
379 380
380 } // namespace net 381 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698