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

Unified Diff: net/websockets/websocket_throttle.h

Issue 723343002: Update from https://crrev.com/304121 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/websockets/websocket_net_log_params_test.cc ('k') | net/websockets/websocket_throttle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_throttle.h
diff --git a/net/websockets/websocket_throttle.h b/net/websockets/websocket_throttle.h
deleted file mode 100644
index 0b7a39f3b6baf3b3bdbb594c84620b34963a7299..0000000000000000000000000000000000000000
--- a/net/websockets/websocket_throttle.h
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NET_WEBSOCKETS_WEBSOCKET_THROTTLE_H_
-#define NET_WEBSOCKETS_WEBSOCKET_THROTTLE_H_
-
-#include <deque>
-#include <map>
-#include <set>
-#include <string>
-
-#include "net/base/ip_endpoint.h"
-#include "net/base/net_export.h"
-
-template <typename T> struct DefaultSingletonTraits;
-
-namespace net {
-
-class SocketStream;
-class WebSocketJob;
-
-// SocketStreamThrottle for WebSocket protocol.
-// Implements the client-side requirements in the spec.
-// http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol
-// 4.1 Handshake
-// 1. If the user agent already has a Web Socket connection to the
-// remote host (IP address) identified by /host/, even if known by
-// another name, wait until that connection has been established or
-// for that connection to have failed.
-class NET_EXPORT_PRIVATE WebSocketThrottle {
- public:
- // Returns the singleton instance.
- static WebSocketThrottle* GetInstance();
-
- // Puts |job| in |queue_| and queues for the destination addresses
- // of |job|.
- // If other job is using the same destination address, set |job| waiting.
- //
- // Returns true if successful. If the number of pending jobs will exceed
- // the limit, does nothing and returns false.
- bool PutInQueue(WebSocketJob* job);
-
- // Removes |job| from |queue_| and queues for the destination addresses
- // of |job|, and then wakes up jobs that can now resume establishing a
- // connection.
- void RemoveFromQueue(WebSocketJob* job);
-
- private:
- typedef std::deque<WebSocketJob*> ConnectingQueue;
- typedef std::map<IPEndPoint, ConnectingQueue> ConnectingAddressMap;
-
- WebSocketThrottle();
- ~WebSocketThrottle();
- friend struct DefaultSingletonTraits<WebSocketThrottle>;
-
- // Examines if any of the given jobs can resume establishing a connection. If
- // for all per-address queues for each resolved addresses
- // (job->address_list()) of a job, the job is at the front of the queues, the
- // job can resume establishing a connection, so wakes up the job.
- void WakeupSocketIfNecessary(
- const std::set<WebSocketJob*>& wakeup_candidates);
-
- // Key: string of host's address. Value: queue of sockets for the address.
- ConnectingAddressMap addr_map_;
-
- // Queue of sockets for websockets in opening state.
- ConnectingQueue queue_;
-
- DISALLOW_COPY_AND_ASSIGN(WebSocketThrottle);
-};
-
-} // namespace net
-
-#endif // NET_WEBSOCKETS_WEBSOCKET_THROTTLE_H_
« no previous file with comments | « net/websockets/websocket_net_log_params_test.cc ('k') | net/websockets/websocket_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698