diff options
author | pliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-16 09:22:30 +0000 |
---|---|---|
committer | pliard@chromium.org <pliard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-16 09:22:30 +0000 |
commit | 36633f403b4ba6c5f592bc65d387869aa5403fc1 (patch) | |
tree | 6a2f7fef89c837ed5d390aa878439761e948085b /net/server/http_server.h | |
parent | ead613da9d4731a38b583b2fc141ccc10bfb9e77 (diff) | |
download | chromium_src-36633f403b4ba6c5f592bc65d387869aa5403fc1.zip chromium_src-36633f403b4ba6c5f592bc65d387869aa5403fc1.tar.gz chromium_src-36633f403b4ba6c5f592bc65d387869aa5403fc1.tar.bz2 |
Refactor TCPListenSocket.
This is part of Chrome for Android upstreaming.
This CL adds a common base class, StreamListenSocket, providing a default implementation inherited by TCPListenSocket and the upcoming UnixDomainSocket.
That lets us share the common code used by both TCPListenSocket and UnixDomainSocket.
This also removes the recently introduced ListenSocket class which is unnecessary now we have StreamListenSocket.
TEST=net_unittests
Review URL: https://chromiumcodereview.appspot.com/10161005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137387 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/server/http_server.h')
-rw-r--r-- | net/server/http_server.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/net/server/http_server.h b/net/server/http_server.h index 526558e..aaf5336 100644 --- a/net/server/http_server.h +++ b/net/server/http_server.h @@ -11,7 +11,7 @@ #include "base/basictypes.h" #include "base/memory/ref_counted.h" -#include "net/base/listen_socket.h" +#include "net/base/stream_listen_socket.h" namespace net { @@ -19,7 +19,7 @@ class HttpConnection; class HttpServerRequestInfo; class WebSocket; -class HttpServer : public ListenSocket::ListenSocketDelegate, +class HttpServer : public StreamListenSocket::Delegate, public base::RefCountedThreadSafe<HttpServer> { public: class Delegate { @@ -54,11 +54,12 @@ class HttpServer : public ListenSocket::ListenSocketDelegate, void Close(int connection_id); // ListenSocketDelegate - virtual void DidAccept(ListenSocket* server, ListenSocket* socket) OVERRIDE; - virtual void DidRead(ListenSocket* socket, + virtual void DidAccept(StreamListenSocket* server, + StreamListenSocket* socket) OVERRIDE; + virtual void DidRead(StreamListenSocket* socket, const char* data, int len) OVERRIDE; - virtual void DidClose(ListenSocket* socket) OVERRIDE; + virtual void DidClose(StreamListenSocket* socket) OVERRIDE; protected: virtual ~HttpServer(); @@ -75,13 +76,13 @@ class HttpServer : public ListenSocket::ListenSocketDelegate, size_t* pos); HttpConnection* FindConnection(int connection_id); - HttpConnection* FindConnection(ListenSocket* socket); + HttpConnection* FindConnection(StreamListenSocket* socket); HttpServer::Delegate* delegate_; - scoped_refptr<ListenSocket> server_; + scoped_refptr<StreamListenSocket> server_; typedef std::map<int, HttpConnection*> IdToConnectionMap; IdToConnectionMap id_to_connection_; - typedef std::map<ListenSocket*, HttpConnection*> SocketToConnectionMap; + typedef std::map<StreamListenSocket*, HttpConnection*> SocketToConnectionMap; SocketToConnectionMap socket_to_connection_; DISALLOW_COPY_AND_ASSIGN(HttpServer); |