| Index: net/socket/unix_domain_socket_posix.cc
|
| diff --git a/net/socket/unix_domain_socket_posix.cc b/net/socket/unix_domain_socket_posix.cc
|
| index 5b6b2498245c21a0bf60b0c23925662a527d7198..2e0b974b86bdf63324867d07cd1d1f28e40a5279 100644
|
| --- a/net/socket/unix_domain_socket_posix.cc
|
| +++ b/net/socket/unix_domain_socket_posix.cc
|
| @@ -53,7 +53,7 @@ UnixDomainSocket::AuthCallback NoAuthentication() {
|
| }
|
|
|
| // static
|
| -UnixDomainSocket* UnixDomainSocket::CreateAndListenInternal(
|
| +scoped_ptr<UnixDomainSocket> UnixDomainSocket::CreateAndListenInternal(
|
| const std::string& path,
|
| const std::string& fallback_path,
|
| StreamListenSocket::Delegate* del,
|
| @@ -63,14 +63,15 @@ UnixDomainSocket* UnixDomainSocket::CreateAndListenInternal(
|
| if (s == kInvalidSocket && !fallback_path.empty())
|
| s = CreateAndBind(fallback_path, use_abstract_namespace);
|
| if (s == kInvalidSocket)
|
| - return NULL;
|
| - UnixDomainSocket* sock = new UnixDomainSocket(s, del, auth_callback);
|
| + return scoped_ptr<UnixDomainSocket>();
|
| + scoped_ptr<UnixDomainSocket> sock(
|
| + new UnixDomainSocket(s, del, auth_callback));
|
| sock->Listen();
|
| - return sock;
|
| + return sock.Pass();
|
| }
|
|
|
| // static
|
| -scoped_refptr<UnixDomainSocket> UnixDomainSocket::CreateAndListen(
|
| +scoped_ptr<UnixDomainSocket> UnixDomainSocket::CreateAndListen(
|
| const std::string& path,
|
| StreamListenSocket::Delegate* del,
|
| const AuthCallback& auth_callback) {
|
| @@ -79,14 +80,14 @@ scoped_refptr<UnixDomainSocket> UnixDomainSocket::CreateAndListen(
|
|
|
| #if defined(SOCKET_ABSTRACT_NAMESPACE_SUPPORTED)
|
| // static
|
| -scoped_refptr<UnixDomainSocket>
|
| +scoped_ptr<UnixDomainSocket>
|
| UnixDomainSocket::CreateAndListenWithAbstractNamespace(
|
| const std::string& path,
|
| const std::string& fallback_path,
|
| StreamListenSocket::Delegate* del,
|
| const AuthCallback& auth_callback) {
|
| - return make_scoped_refptr(
|
| - CreateAndListenInternal(path, fallback_path, del, auth_callback, true));
|
| + return
|
| + CreateAndListenInternal(path, fallback_path, del, auth_callback, true);
|
| }
|
| #endif
|
|
|
| @@ -147,11 +148,11 @@ void UnixDomainSocket::Accept() {
|
| LOG(ERROR) << "close() error";
|
| return;
|
| }
|
| - scoped_refptr<UnixDomainSocket> sock(
|
| + scoped_ptr<UnixDomainSocket> sock(
|
| new UnixDomainSocket(conn, socket_delegate_, auth_callback_));
|
| // It's up to the delegate to AddRef if it wants to keep it around.
|
| sock->WatchSocket(WAITING_READ);
|
| - socket_delegate_->DidAccept(this, sock.get());
|
| + socket_delegate_->DidAccept(this, sock.PassAs<StreamListenSocket>());
|
| }
|
|
|
| UnixDomainSocketFactory::UnixDomainSocketFactory(
|
| @@ -162,10 +163,10 @@ UnixDomainSocketFactory::UnixDomainSocketFactory(
|
|
|
| UnixDomainSocketFactory::~UnixDomainSocketFactory() {}
|
|
|
| -scoped_refptr<StreamListenSocket> UnixDomainSocketFactory::CreateAndListen(
|
| +scoped_ptr<StreamListenSocket> UnixDomainSocketFactory::CreateAndListen(
|
| StreamListenSocket::Delegate* delegate) const {
|
| return UnixDomainSocket::CreateAndListen(
|
| - path_, delegate, auth_callback_);
|
| + path_, delegate, auth_callback_).PassAs<StreamListenSocket>();
|
| }
|
|
|
| #if defined(SOCKET_ABSTRACT_NAMESPACE_SUPPORTED)
|
| @@ -181,11 +182,12 @@ UnixDomainSocketWithAbstractNamespaceFactory(
|
| UnixDomainSocketWithAbstractNamespaceFactory::
|
| ~UnixDomainSocketWithAbstractNamespaceFactory() {}
|
|
|
| -scoped_refptr<StreamListenSocket>
|
| +scoped_ptr<StreamListenSocket>
|
| UnixDomainSocketWithAbstractNamespaceFactory::CreateAndListen(
|
| StreamListenSocket::Delegate* delegate) const {
|
| return UnixDomainSocket::CreateAndListenWithAbstractNamespace(
|
| - path_, fallback_path_, delegate, auth_callback_);
|
| + path_, fallback_path_, delegate, auth_callback_)
|
| + .PassAs<StreamListenSocket>();
|
| }
|
|
|
| #endif
|
|
|