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

Unified Diff: net/socket_stream/socket_stream_throttle.h

Issue 669157: Refactor WebSocket throttling feature. (Closed)
Patch Set: Fix for tyoshino's comment Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket_stream/socket_stream.cc ('k') | net/socket_stream/socket_stream_throttle.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket_stream/socket_stream_throttle.h
diff --git a/net/socket_stream/socket_stream_throttle.h b/net/socket_stream/socket_stream_throttle.h
deleted file mode 100644
index 7726cbe4e19c5afe9098a7b08d1120cac8e3a6d1..0000000000000000000000000000000000000000
--- a/net/socket_stream/socket_stream_throttle.h
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (c) 2009 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_SOCKET_STREAM_SOCKET_STREAM_THROTTLE_H_
-#define NET_SOCKET_STREAM_SOCKET_STREAM_THROTTLE_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "net/base/completion_callback.h"
-#include "net/base/net_errors.h"
-
-namespace net {
-
-class SocketStream;
-
-// Abstract interface to throttle SocketStream per URL scheme.
-// Each URL scheme (protocol) could define own SocketStreamThrottle.
-// These methods will be called on IO thread.
-class SocketStreamThrottle {
- public:
- // Called when |socket| is about to open connection.
- // Returns net::OK if the connection can open now.
- // Returns net::ERR_IO_PENDING if the connection should wait. In this case,
- // |callback| will be called when it's ready to open connection.
- virtual int OnStartOpenConnection(SocketStream* socket,
- CompletionCallback* callback) {
- // No throttle by default.
- return OK;
- }
-
- // Called when |socket| read |len| bytes of |data|.
- // May wake up another waiting socket.
- // Returns net::OK if |socket| can continue to run.
- // Returns net::ERR_IO_PENDING if |socket| should suspend to run. In this
- // case, |callback| will be called when it's ready to resume running.
- virtual int OnRead(SocketStream* socket, const char* data, int len,
- CompletionCallback* callback) {
- // No throttle by default.
- return OK;
- }
-
- // Called when |socket| wrote |len| bytes of |data|.
- // May wake up another waiting socket.
- // Returns net::OK if |socket| can continue to run.
- // Returns net::ERR_IO_PENDING if |socket| should suspend to run. In this
- // case, |callback| will be called when it's ready to resume running.
- virtual int OnWrite(SocketStream* socket, const char* data, int len,
- CompletionCallback* callback) {
- // No throttle by default.
- return OK;
- }
-
- // Called when |socket| is closed.
- // May wake up another waiting socket.
- virtual void OnClose(SocketStream* socket) {}
-
- // Gets SocketStreamThrottle for URL |scheme|.
- // Doesn't pass ownership of the SocketStreamThrottle.
- static SocketStreamThrottle* GetSocketStreamThrottleForScheme(
- const std::string& scheme);
-
- // Registers |throttle| for URL |scheme|.
- // Doesn't take ownership of |throttle|. Typically |throttle| is
- // singleton instance.
- static void RegisterSocketStreamThrottle(
- const std::string& scheme,
- SocketStreamThrottle* throttle);
-
- protected:
- SocketStreamThrottle() {}
- virtual ~SocketStreamThrottle() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(SocketStreamThrottle);
-};
-
-} // namespace net
-
-#endif // NET_SOCKET_STREAM_SOCKET_STREAM_THROTTLE_H_
« no previous file with comments | « net/socket_stream/socket_stream.cc ('k') | net/socket_stream/socket_stream_throttle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698