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

Unified Diff: net/tools/fetch/http_listen_socket.h

Issue 20142003: Remove ref-counting from StreamListenSocket (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 4 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/test/embedded_test_server/http_connection.cc ('k') | net/tools/fetch/http_listen_socket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/fetch/http_listen_socket.h
diff --git a/net/tools/fetch/http_listen_socket.h b/net/tools/fetch/http_listen_socket.h
index 246948bbaada929c7faa9721915ff3a1d87fc699..e0a58c03e2c0ca9f2f8e409aa3db1eb405d210ca 100644
--- a/net/tools/fetch/http_listen_socket.h
+++ b/net/tools/fetch/http_listen_socket.h
@@ -5,6 +5,8 @@
#ifndef NET_BASE_TOOLS_HTTP_LISTEN_SOCKET_H_
#define NET_BASE_TOOLS_HTTP_LISTEN_SOCKET_H_
+#include <set>
+
#include "base/message_loop/message_loop.h"
#include "net/socket/stream_listen_socket.h"
#include "net/socket/tcp_listen_socket.h"
@@ -25,7 +27,9 @@ class HttpListenSocket : public net::TCPListenSocket,
virtual ~Delegate() {}
};
- static scoped_refptr<HttpListenSocket> CreateAndListen(
+ virtual ~HttpListenSocket();
+
+ static scoped_ptr<HttpListenSocket> CreateAndListen(
const std::string& ip, int port, HttpListenSocket::Delegate* delegate);
// Send a server response.
@@ -33,8 +37,9 @@ class HttpListenSocket : public net::TCPListenSocket,
void Respond(HttpServerResponseInfo* info, std::string& data);
// StreamListenSocket::Delegate.
- virtual void DidAccept(net::StreamListenSocket* server,
- net::StreamListenSocket* connection) OVERRIDE;
+ virtual void DidAccept(
+ net::StreamListenSocket* server,
+ scoped_ptr<net::StreamListenSocket> connection) OVERRIDE;
virtual void DidRead(net::StreamListenSocket* connection,
const char* data, int len) OVERRIDE;
virtual void DidClose(net::StreamListenSocket* sock) OVERRIDE;
@@ -44,13 +49,10 @@ class HttpListenSocket : public net::TCPListenSocket,
virtual void Accept() OVERRIDE;
private:
- friend class base::RefCountedThreadSafe<net::StreamListenSocket>;
-
static const int kReadBufSize = 16 * 1024;
// Must run in the IO thread.
HttpListenSocket(net::SocketDescriptor s, HttpListenSocket::Delegate* del);
- virtual ~HttpListenSocket();
// Expects the raw data to be stored in recv_data_. If parsing is successful,
// will remove the data parsed from recv_data_, leaving only the unused
@@ -60,6 +62,8 @@ class HttpListenSocket : public net::TCPListenSocket,
HttpListenSocket::Delegate* const delegate_;
std::string recv_data_;
+ std::set<StreamListenSocket*> connections_;
+
DISALLOW_COPY_AND_ASSIGN(HttpListenSocket);
};
« no previous file with comments | « net/test/embedded_test_server/http_connection.cc ('k') | net/tools/fetch/http_listen_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698