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

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

Issue 2229393003: net: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_stream_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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
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
OLDNEW
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_stream_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698