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

Side by Side Diff: net/websockets/websocket_throttle.h

Issue 12033072: Include destination port for websocket throttling. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix things caught by toyoshim. Created 7 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
« no previous file with comments | « net/websockets/websocket_job_spdy3_unittest.cc ('k') | net/websockets/websocket_throttle.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef NET_WEBSOCKETS_WEBSOCKET_THROTTLE_H_ 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_THROTTLE_H_
6 #define NET_WEBSOCKETS_WEBSOCKET_THROTTLE_H_ 6 #define NET_WEBSOCKETS_WEBSOCKET_THROTTLE_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <map>
9 #include <string> 10 #include <string>
10 11
11 #include "base/hash_tables.h" 12 #include "net/base/ip_endpoint.h"
12 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
13 14
14 template <typename T> struct DefaultSingletonTraits; 15 template <typename T> struct DefaultSingletonTraits;
15 16
16 namespace net { 17 namespace net {
17 18
18 class SocketStream; 19 class SocketStream;
19 class WebSocketJob; 20 class WebSocketJob;
20 21
21 // SocketStreamThrottle for WebSocket protocol. 22 // SocketStreamThrottle for WebSocket protocol.
(...skipping 19 matching lines...) Expand all
41 void RemoveFromQueue(WebSocketJob* job); 42 void RemoveFromQueue(WebSocketJob* job);
42 43
43 // Checks sockets waiting in |queue_| and check the socket is the front of 44 // Checks sockets waiting in |queue_| and check the socket is the front of
44 // every queue for the destination addresses of |socket|. 45 // every queue for the destination addresses of |socket|.
45 // If so, the socket can resume estabilshing connection, so wake up 46 // If so, the socket can resume estabilshing connection, so wake up
46 // the socket. 47 // the socket.
47 void WakeupSocketIfNecessary(); 48 void WakeupSocketIfNecessary();
48 49
49 private: 50 private:
50 typedef std::deque<WebSocketJob*> ConnectingQueue; 51 typedef std::deque<WebSocketJob*> ConnectingQueue;
51 typedef base::hash_map<std::string, ConnectingQueue*> ConnectingAddressMap; 52 typedef std::map<IPEndPoint, ConnectingQueue*> ConnectingAddressMap;
52 53
53 WebSocketThrottle(); 54 WebSocketThrottle();
54 virtual ~WebSocketThrottle(); 55 ~WebSocketThrottle();
55 friend struct DefaultSingletonTraits<WebSocketThrottle>; 56 friend struct DefaultSingletonTraits<WebSocketThrottle>;
56 57
57 // Key: string of host's address. Value: queue of sockets for the address. 58 // Key: string of host's address. Value: queue of sockets for the address.
58 ConnectingAddressMap addr_map_; 59 ConnectingAddressMap addr_map_;
59 60
60 // Queue of sockets for websockets in opening state. 61 // Queue of sockets for websockets in opening state.
61 ConnectingQueue queue_; 62 ConnectingQueue queue_;
63
64 DISALLOW_COPY_AND_ASSIGN(WebSocketThrottle);
62 }; 65 };
63 66
64 } // namespace net 67 } // namespace net
65 68
66 #endif // NET_WEBSOCKETS_WEBSOCKET_THROTTLE_H_ 69 #endif // NET_WEBSOCKETS_WEBSOCKET_THROTTLE_H_
OLDNEW
« no previous file with comments | « net/websockets/websocket_job_spdy3_unittest.cc ('k') | net/websockets/websocket_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698