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

Side by Side Diff: net/socket/websocket_endpoint_lock_manager.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 years, 3 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/socket/websocket_endpoint_lock_manager.h ('k') | net/spdy/hpack/hpack_constants.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/socket/websocket_endpoint_lock_manager.h" 5 #include "net/socket/websocket_endpoint_lock_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 15 matching lines...) Expand all
26 } // namespace 26 } // namespace
27 27
28 WebSocketEndpointLockManager::Waiter::~Waiter() { 28 WebSocketEndpointLockManager::Waiter::~Waiter() {
29 if (next()) { 29 if (next()) {
30 DCHECK(previous()); 30 DCHECK(previous());
31 RemoveFromList(); 31 RemoveFromList();
32 } 32 }
33 } 33 }
34 34
35 WebSocketEndpointLockManager* WebSocketEndpointLockManager::GetInstance() { 35 WebSocketEndpointLockManager* WebSocketEndpointLockManager::GetInstance() {
36 return Singleton<WebSocketEndpointLockManager>::get(); 36 return base::Singleton<WebSocketEndpointLockManager>::get();
37 } 37 }
38 38
39 int WebSocketEndpointLockManager::LockEndpoint(const IPEndPoint& endpoint, 39 int WebSocketEndpointLockManager::LockEndpoint(const IPEndPoint& endpoint,
40 Waiter* waiter) { 40 Waiter* waiter) {
41 LockInfoMap::value_type insert_value(endpoint, LockInfo()); 41 LockInfoMap::value_type insert_value(endpoint, LockInfo());
42 std::pair<LockInfoMap::iterator, bool> rv = 42 std::pair<LockInfoMap::iterator, bool> rv =
43 lock_info_map_.insert(insert_value); 43 lock_info_map_.insert(insert_value);
44 LockInfo& lock_info_in_map = rv.first->second; 44 LockInfo& lock_info_in_map = rv.first->second;
45 if (rv.second) { 45 if (rv.second) {
46 DVLOG(3) << "Locking endpoint " << endpoint.ToString(); 46 DVLOG(3) << "Locking endpoint " << endpoint.ToString();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 LockInfoMap::iterator lock_info_it) { 163 LockInfoMap::iterator lock_info_it) {
164 DVLOG(3) << "Removing (StreamSocket*)" << lock_info_it->second.socket 164 DVLOG(3) << "Removing (StreamSocket*)" << lock_info_it->second.socket
165 << " for " << lock_info_it->first.ToString() << " (" 165 << " for " << lock_info_it->first.ToString() << " ("
166 << socket_lock_info_map_.size() << " socket(s) left)"; 166 << socket_lock_info_map_.size() << " socket(s) left)";
167 size_t erased = socket_lock_info_map_.erase(lock_info_it->second.socket); 167 size_t erased = socket_lock_info_map_.erase(lock_info_it->second.socket);
168 DCHECK_EQ(1U, erased); 168 DCHECK_EQ(1U, erased);
169 lock_info_it->second.socket = NULL; 169 lock_info_it->second.socket = NULL;
170 } 170 }
171 171
172 } // namespace net 172 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/websocket_endpoint_lock_manager.h ('k') | net/spdy/hpack/hpack_constants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698