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

Unified Diff: net/socket/stream_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/server/http_server_unittest.cc ('k') | net/socket/tcp_listen_socket.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/stream_listen_socket.h
diff --git a/net/socket/stream_listen_socket.h b/net/socket/stream_listen_socket.h
index 4964b927f2b9dc5c5f0fb664a8e798b5444cf97a..9825a4ef12676bc43c56a8b18997328d0ce68875 100644
--- a/net/socket/stream_listen_socket.h
+++ b/net/socket/stream_listen_socket.h
@@ -30,6 +30,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"
#include "net/socket/socket_descriptor.h"
@@ -38,7 +39,7 @@ namespace net {
class IPEndPoint;
class NET_EXPORT StreamListenSocket
- : public base::RefCountedThreadSafe<StreamListenSocket>,
+ :
#if defined(OS_WIN)
public base::win::ObjectWatcher::Delegate {
#elif defined(OS_POSIX)
@@ -46,16 +47,17 @@ class NET_EXPORT StreamListenSocket
#endif
public:
+ virtual ~StreamListenSocket();
+
// TODO(erikkay): this delegate should really be split into two parts
// to split up the listener from the connected socket. Perhaps this class
// should be split up similarly.
class Delegate {
public:
// |server| is the original listening Socket, connection is the new
- // Socket that was created. Ownership of |connection| is transferred
- // to the delegate with this call.
+ // Socket that was created.
virtual void DidAccept(StreamListenSocket* server,
- StreamListenSocket* connection) = 0;
+ scoped_ptr<StreamListenSocket> connection) = 0;
virtual void DidRead(StreamListenSocket* connection,
const char* data,
int len) = 0;
@@ -82,7 +84,6 @@ class NET_EXPORT StreamListenSocket
};
StreamListenSocket(SocketDescriptor s, Delegate* del);
- virtual ~StreamListenSocket();
SocketDescriptor AcceptSocket();
virtual void Accept() = 0;
@@ -100,7 +101,6 @@ class NET_EXPORT StreamListenSocket
Delegate* const socket_delegate_;
private:
- friend class base::RefCountedThreadSafe<StreamListenSocket>;
friend class TransportClientSocketTest;
void SendInternal(const char* bytes, int len);
@@ -139,7 +139,7 @@ class NET_EXPORT StreamListenSocketFactory {
virtual ~StreamListenSocketFactory() {}
// Returns a new instance of StreamListenSocket or NULL if an error occurred.
- virtual scoped_refptr<StreamListenSocket> CreateAndListen(
+ virtual scoped_ptr<StreamListenSocket> CreateAndListen(
StreamListenSocket::Delegate* delegate) const = 0;
};
« no previous file with comments | « net/server/http_server_unittest.cc ('k') | net/socket/tcp_listen_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698