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/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" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 AvailableSessionMap::iterator available_session_it = | 188 AvailableSessionMap::iterator available_session_it = |
189 LookupAvailableSessionByKey(alias_key); | 189 LookupAvailableSessionByKey(alias_key); |
190 if (available_session_it == available_sessions_.end()) { | 190 if (available_session_it == available_sessions_.end()) { |
191 NOTREACHED(); // It shouldn't be in the aliases table if we can't get it! | 191 NOTREACHED(); // It shouldn't be in the aliases table if we can't get it! |
192 continue; | 192 continue; |
193 } | 193 } |
194 | 194 |
195 const base::WeakPtr<SpdySession>& available_session = | 195 const base::WeakPtr<SpdySession>& available_session = |
196 available_session_it->second; | 196 available_session_it->second; |
197 DCHECK(ContainsKey(sessions_, available_session.get())); | 197 DCHECK(base::ContainsKey(sessions_, available_session.get())); |
198 // If the session is a secure one, we need to verify that the | 198 // If the session is a secure one, we need to verify that the |
199 // server is authenticated to serve traffic for |host_port_proxy_pair| too. | 199 // server is authenticated to serve traffic for |host_port_proxy_pair| too. |
200 if (!available_session->VerifyDomainAuthentication( | 200 if (!available_session->VerifyDomainAuthentication( |
201 key.host_port_pair().host())) { | 201 key.host_port_pair().host())) { |
202 UMA_HISTOGRAM_ENUMERATION("Net.SpdyIPPoolDomainMatch", 0, 2); | 202 UMA_HISTOGRAM_ENUMERATION("Net.SpdyIPPoolDomainMatch", 0, 2); |
203 continue; | 203 continue; |
204 } | 204 } |
205 | 205 |
206 UMA_HISTOGRAM_ENUMERATION("Net.SpdyIPPoolDomainMatch", 1, 2); | 206 UMA_HISTOGRAM_ENUMERATION("Net.SpdyIPPoolDomainMatch", 1, 2); |
207 UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionGet", | 207 UMA_HISTOGRAM_ENUMERATION("Net.SpdySessionGet", |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 CloseCurrentSessionsHelper(ERR_ABORTED, "Closing all sessions.", | 266 CloseCurrentSessionsHelper(ERR_ABORTED, "Closing all sessions.", |
267 false /* idle_only */); | 267 false /* idle_only */); |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
271 void SpdySessionPool::RegisterUnclaimedPushedStream( | 271 void SpdySessionPool::RegisterUnclaimedPushedStream( |
272 GURL url, | 272 GURL url, |
273 base::WeakPtr<SpdySession> spdy_session) { | 273 base::WeakPtr<SpdySession> spdy_session) { |
274 DCHECK(!url.is_empty()); | 274 DCHECK(!url.is_empty()); |
275 // This SpdySessionPool must own |spdy_session|. | 275 // This SpdySessionPool must own |spdy_session|. |
276 DCHECK(ContainsKey(sessions_, spdy_session.get())); | 276 DCHECK(base::ContainsKey(sessions_, spdy_session.get())); |
277 UnclaimedPushedStreamMap::iterator url_it = | 277 UnclaimedPushedStreamMap::iterator url_it = |
278 unclaimed_pushed_streams_.lower_bound(url); | 278 unclaimed_pushed_streams_.lower_bound(url); |
279 if (url_it == unclaimed_pushed_streams_.end() || url_it->first != url) { | 279 if (url_it == unclaimed_pushed_streams_.end() || url_it->first != url) { |
280 WeakSessionList list; | 280 WeakSessionList list; |
281 list.push_back(std::move(spdy_session)); | 281 list.push_back(std::move(spdy_session)); |
282 UnclaimedPushedStreamMap::value_type value(std::move(url), std::move(list)); | 282 UnclaimedPushedStreamMap::value_type value(std::move(url), std::move(list)); |
283 unclaimed_pushed_streams_.insert(url_it, std::move(value)); | 283 unclaimed_pushed_streams_.insert(url_it, std::move(value)); |
284 return; | 284 return; |
285 } | 285 } |
286 url_it->second.push_back(spdy_session); | 286 url_it->second.push_back(spdy_session); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 it != available_sessions_.end(); ++it) { | 377 it != available_sessions_.end(); ++it) { |
378 if (it->second.get() == session.get()) | 378 if (it->second.get() == session.get()) |
379 return true; | 379 return true; |
380 } | 380 } |
381 return false; | 381 return false; |
382 } | 382 } |
383 | 383 |
384 void SpdySessionPool::MapKeyToAvailableSession( | 384 void SpdySessionPool::MapKeyToAvailableSession( |
385 const SpdySessionKey& key, | 385 const SpdySessionKey& key, |
386 const base::WeakPtr<SpdySession>& session) { | 386 const base::WeakPtr<SpdySession>& session) { |
387 DCHECK(ContainsKey(sessions_, session.get())); | 387 DCHECK(base::ContainsKey(sessions_, session.get())); |
388 std::pair<AvailableSessionMap::iterator, bool> result = | 388 std::pair<AvailableSessionMap::iterator, bool> result = |
389 available_sessions_.insert(std::make_pair(key, session)); | 389 available_sessions_.insert(std::make_pair(key, session)); |
390 CHECK(result.second); | 390 CHECK(result.second); |
391 } | 391 } |
392 | 392 |
393 SpdySessionPool::AvailableSessionMap::iterator | 393 SpdySessionPool::AvailableSessionMap::iterator |
394 SpdySessionPool::LookupAvailableSessionByKey( | 394 SpdySessionPool::LookupAvailableSessionByKey( |
395 const SpdySessionKey& key) { | 395 const SpdySessionKey& key) { |
396 return available_sessions_.find(key); | 396 return available_sessions_.find(key); |
397 } | 397 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 437 |
438 if (idle_only && (*it)->is_active()) | 438 if (idle_only && (*it)->is_active()) |
439 continue; | 439 continue; |
440 | 440 |
441 (*it)->CloseSessionOnError(error, description); | 441 (*it)->CloseSessionOnError(error, description); |
442 DCHECK(!IsSessionAvailable(*it)); | 442 DCHECK(!IsSessionAvailable(*it)); |
443 } | 443 } |
444 } | 444 } |
445 | 445 |
446 } // namespace net | 446 } // namespace net |
OLD | NEW |