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

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: fixup Created 7 years, 5 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
Index: net/socket/stream_listen_socket.h
diff --git a/net/socket/stream_listen_socket.h b/net/socket/stream_listen_socket.h
index 6f03eefaca2af7f3431a21623f58570c8e11496e..4fbb4c9331b531f99097831ad8c806a21912ce1c 100644
--- a/net/socket/stream_listen_socket.h
+++ b/net/socket/stream_listen_socket.h
@@ -30,8 +30,8 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
#include "net/base/net_export.h"
-#include "net/socket/stream_listen_socket.h"
#if defined(OS_POSIX)
typedef int SocketDescriptor;
@@ -44,7 +44,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)
@@ -52,16 +52,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;
@@ -89,7 +90,6 @@ class NET_EXPORT StreamListenSocket
};
StreamListenSocket(SocketDescriptor s, Delegate* del);
- virtual ~StreamListenSocket();
SocketDescriptor AcceptSocket();
virtual void Accept() = 0;
@@ -107,7 +107,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);
@@ -146,7 +145,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;
};

Powered by Google App Engine
This is Rietveld 408576698