summaryrefslogtreecommitdiffstats
path: root/net/socket_stream/socket_stream.h
diff options
context:
space:
mode:
authorukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 10:02:28 +0000
committerukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-04 10:02:28 +0000
commit4c4eac006bdbf1ad0f3e37db47c488f7c3ee4949 (patch)
tree16237134b9e037cf609ca4211b5c9efbcd8759ee /net/socket_stream/socket_stream.h
parent8ecd3aade85b825c8206735f16c23880023782db (diff)
downloadchromium_src-4c4eac006bdbf1ad0f3e37db47c488f7c3ee4949.zip
chromium_src-4c4eac006bdbf1ad0f3e37db47c488f7c3ee4949.tar.gz
chromium_src-4c4eac006bdbf1ad0f3e37db47c488f7c3ee4949.tar.bz2
Implement websocket throttling.
Implement the client-side requirements in the spec. 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. BUG=none TEST=net_unittests passes Review URL: http://codereview.chromium.org/342052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30949 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket_stream/socket_stream.h')
-rw-r--r--net/socket_stream/socket_stream.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h
index 37b723a..14dfd36 100644
--- a/net/socket_stream/socket_stream.h
+++ b/net/socket_stream/socket_stream.h
@@ -31,6 +31,7 @@ class ClientSocketFactory;
class HostResolver;
class SSLConfigService;
class SingleRequestHostResolver;
+class SocketStreamThrottle;
// SocketStream is used to implement Web Sockets.
// It provides plain full-duplex stream with proxy and SSL support.
@@ -96,6 +97,7 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
void SetUserData(const void* key, UserData* data);
const GURL& url() const { return url_; }
+ const AddressList& address_list() const { return addresses_; }
Delegate* delegate() const { return delegate_; }
int max_pending_send_allowed() const { return max_pending_send_allowed_; }
@@ -191,14 +193,20 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
friend class base::RefCountedThreadSafe<SocketStream>;
~SocketStream();
+ friend class WebSocketThrottleTest;
+
+ // Copies the given addrinfo list in |addresses_|.
+ // Used for WebSocketThrottleTest.
+ void CopyAddrInfo(struct addrinfo* head);
+
// Finishes the job.
// Calls OnError and OnClose of delegate, and no more
// notifications will be sent to delegate.
void Finish(int result);
int DidEstablishConnection();
- void DidReceiveData(int result);
- void DidSendData(int result);
+ int DidReceiveData(int result);
+ int DidSendData(int result);
void OnIOCompleted(int result);
void OnReadCompleted(int result);
@@ -289,6 +297,8 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> {
int write_buf_size_;
PendingDataQueue pending_write_bufs_;
+ SocketStreamThrottle* throttle_;
+
DISALLOW_COPY_AND_ASSIGN(SocketStream);
};