scoped_refptr<base::MessageLoopProxy> response_message_loop,
const AndroidDeviceManager::SocketCallback& callback,
int result,
- scoped_ptr<net::StreamSocket> socket) {
- response_message_loop->PostTask(
- FROM_HERE, base::Bind(callback, result, base::Passed(&socket)));
+ net::StreamSocket* socket) {
+ response_message_loop->PostTask(FROM_HERE,
+ base::Bind(callback, result, socket));
}
class HttpRequest {
typedef AndroidDeviceManager::SocketCallback SocketCallback;
static void CommandRequest(const std::string& request,
- const CommandCallback& callback,
- int result,
- scoped_ptr<net::StreamSocket> socket) {
+ const CommandCallback& callback,
+ int result,
+ net::StreamSocket* socket) {
if (result != net::OK) {
callback.Run(result, std::string());
return;
}
- new HttpRequest(socket.Pass(), request, callback);
+ new HttpRequest(socket, request, callback);
}
static void SocketRequest(const std::string& request,
- const SocketCallback& callback,
- int result,
- scoped_ptr<net::StreamSocket> socket) {
+ const SocketCallback& callback,
+ int result,
+ net::StreamSocket* socket) {
if (result != net::OK) {
- callback.Run(result, make_scoped_ptr<net::StreamSocket>(NULL));
+ callback.Run(result, NULL);
return;
}
- new HttpRequest(socket.Pass(), request, callback);
+ new HttpRequest(socket, request, callback);
}
private:
- HttpRequest(scoped_ptr<net::StreamSocket> socket,
+ HttpRequest(net::StreamSocket* socket,
const std::string& request,
const CommandCallback& callback)
- : socket_(socket.Pass()),
- command_callback_(callback),
- body_pos_(0) {
+ : socket_(socket), command_callback_(callback), body_pos_(0) {
SendRequest(request);
}
- HttpRequest(scoped_ptr<net::StreamSocket> socket,
- const std::string& request,
- const SocketCallback& callback)
- : socket_(socket.Pass()),
+ HttpRequest(net::StreamSocket* socket,
+ const std::string& request,
+ const SocketCallback& callback)
+ : socket_(socket),
socket_callback_(callback),
body_pos_(0) {
SendRequest(request);
if (!command_callback_.is_null())
command_callback_.Run(net::OK, response_.substr(body_pos_));
else
- socket_callback_.Run(net::OK, socket_.Pass());
+ socket_callback_.Run(net::OK, socket_.release());
delete this;
return;
}
if (!command_callback_.is_null())
command_callback_.Run(result, std::string());
else
- socket_callback_.Run(result, make_scoped_ptr<net::StreamSocket>(NULL));
+ socket_callback_.Run(result, NULL);
delete this;
return false;
}