summaryrefslogtreecommitdiffstats
path: root/jingle/notifier/base
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-09 18:43:55 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-09 18:43:55 +0000
commit83039bbf2f2ec0e918f7000b5212d104f60f2bb7 (patch)
treeb22dbd0051b57a437a588772a874271f0d02ffdb /jingle/notifier/base
parente7456a206fe5b50aeb322ebabd6c26adc869a5fd (diff)
downloadchromium_src-83039bbf2f2ec0e918f7000b5212d104f60f2bb7.zip
chromium_src-83039bbf2f2ec0e918f7000b5212d104f60f2bb7.tar.gz
chromium_src-83039bbf2f2ec0e918f7000b5212d104f60f2bb7.tar.bz2
Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind().
This changes Socket::Read(), Socket::Write, and StreamSocket::Connect() to use CompletionCallback and fixes all users. BUG=none TEST=existing. Review URL: http://codereview.chromium.org/8824006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113825 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle/notifier/base')
-rw-r--r--jingle/notifier/base/chrome_async_socket.cc26
-rw-r--r--jingle/notifier/base/chrome_async_socket.h6
-rw-r--r--jingle/notifier/base/fake_ssl_client_socket.cc65
-rw-r--r--jingle/notifier/base/fake_ssl_client_socket.h13
-rw-r--r--jingle/notifier/base/fake_ssl_client_socket_unittest.cc22
-rw-r--r--jingle/notifier/base/proxy_resolving_client_socket.cc59
-rw-r--r--jingle/notifier/base/proxy_resolving_client_socket.h6
-rw-r--r--jingle/notifier/base/proxy_resolving_client_socket_unittest.cc8
8 files changed, 54 insertions, 151 deletions
diff --git a/jingle/notifier/base/chrome_async_socket.cc b/jingle/notifier/base/chrome_async_socket.cc
index 131f733..e3a243f 100644
--- a/jingle/notifier/base/chrome_async_socket.cc
+++ b/jingle/notifier/base/chrome_async_socket.cc
@@ -32,15 +32,7 @@ ChromeAsyncSocket::ChromeAsyncSocket(
ResolvingClientSocketFactory* client_socket_factory,
size_t read_buf_size,
size_t write_buf_size)
- : connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
- &ChromeAsyncSocket::ProcessConnectDone),
- read_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
- &ChromeAsyncSocket::ProcessReadDone),
- write_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
- &ChromeAsyncSocket::ProcessWriteDone),
- ssl_connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
- &ChromeAsyncSocket::ProcessSSLConnectDone),
- client_socket_factory_(client_socket_factory),
+ : client_socket_factory_(client_socket_factory),
state_(STATE_CLOSED),
error_(ERROR_NONE),
net_error_(net::OK),
@@ -119,7 +111,9 @@ bool ChromeAsyncSocket::Connect(const talk_base::SocketAddress& address) {
transport_socket_.reset(
client_socket_factory_->CreateTransportClientSocket(
dest_host_port_pair));
- int status = transport_socket_->Connect(&connect_callback_);
+ int status = transport_socket_->Connect(
+ base::Bind(&ChromeAsyncSocket::ProcessConnectDone,
+ base::Unretained(this)));
if (status != net::ERR_IO_PENDING) {
// We defer execution of ProcessConnectDone instead of calling it
// directly here as the caller may not expect an error/close to
@@ -182,7 +176,9 @@ void ChromeAsyncSocket::DoRead() {
// done).
int status =
transport_socket_->Read(
- read_buf_.get(), read_buf_->size(), &read_callback_);
+ read_buf_.get(), read_buf_->size(),
+ base::Bind(&ChromeAsyncSocket::ProcessReadDone,
+ base::Unretained(this)));
read_state_ = PENDING;
if (status != net::ERR_IO_PENDING) {
ProcessReadDone(status);
@@ -312,7 +308,9 @@ void ChromeAsyncSocket::DoWrite() {
// before we send the next message.
int status =
transport_socket_->Write(
- write_buf_.get(), write_end_, &write_callback_);
+ write_buf_.get(), write_end_,
+ base::Bind(&ChromeAsyncSocket::ProcessWriteDone,
+ base::Unretained(this)));
write_state_ = PENDING;
if (status != net::ERR_IO_PENDING) {
ProcessWriteDone(status);
@@ -408,7 +406,9 @@ bool ChromeAsyncSocket::StartTls(const std::string& domain_name) {
transport_socket_.reset(
client_socket_factory_->CreateSSLClientSocket(
socket_handle, net::HostPortPair(domain_name, 443)));
- int status = transport_socket_->Connect(&ssl_connect_callback_);
+ int status = transport_socket_->Connect(
+ base::Bind(&ChromeAsyncSocket::ProcessSSLConnectDone,
+ base::Unretained(this)));
if (status != net::ERR_IO_PENDING) {
MessageLoop* message_loop = MessageLoop::current();
CHECK(message_loop);
diff --git a/jingle/notifier/base/chrome_async_socket.h b/jingle/notifier/base/chrome_async_socket.h
index 6e41a6c..d2df8df 100644
--- a/jingle/notifier/base/chrome_async_socket.h
+++ b/jingle/notifier/base/chrome_async_socket.h
@@ -176,12 +176,6 @@ class ChromeAsyncSocket : public buzz::AsyncSocket {
// Close functions.
void DoClose();
- // Callbacks passed to |transport_socket_|.
- net::OldCompletionCallbackImpl<ChromeAsyncSocket> connect_callback_;
- net::OldCompletionCallbackImpl<ChromeAsyncSocket> read_callback_;
- net::OldCompletionCallbackImpl<ChromeAsyncSocket> write_callback_;
- net::OldCompletionCallbackImpl<ChromeAsyncSocket> ssl_connect_callback_;
-
scoped_ptr<ResolvingClientSocketFactory> client_socket_factory_;
// buzz::AsyncSocket state.
diff --git a/jingle/notifier/base/fake_ssl_client_socket.cc b/jingle/notifier/base/fake_ssl_client_socket.cc
index bdad879..922bda4 100644
--- a/jingle/notifier/base/fake_ssl_client_socket.cc
+++ b/jingle/notifier/base/fake_ssl_client_socket.cc
@@ -78,18 +78,9 @@ base::StringPiece FakeSSLClientSocket::GetSslServerHello() {
FakeSSLClientSocket::FakeSSLClientSocket(
net::StreamSocket* transport_socket)
- : connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this),
- &FakeSSLClientSocket::OnConnectDone),
- send_client_hello_callback_(
- ALLOW_THIS_IN_INITIALIZER_LIST(this),
- &FakeSSLClientSocket::OnSendClientHelloDone),
- verify_server_hello_callback_(
- ALLOW_THIS_IN_INITIALIZER_LIST(this),
- &FakeSSLClientSocket::OnVerifyServerHelloDone),
- transport_socket_(transport_socket),
+ : transport_socket_(transport_socket),
next_handshake_state_(STATE_NONE),
handshake_completed_(false),
- old_user_connect_callback_(NULL),
write_buf_(NewDrainableIOBufferWithSize(arraysize(kSslClientHello))),
read_buf_(NewDrainableIOBufferWithSize(arraysize(kSslServerHello))) {
CHECK(transport_socket_.get());
@@ -99,12 +90,6 @@ FakeSSLClientSocket::FakeSSLClientSocket(
FakeSSLClientSocket::~FakeSSLClientSocket() {}
int FakeSSLClientSocket::Read(net::IOBuffer* buf, int buf_len,
- net::OldCompletionCallback* callback) {
- DCHECK_EQ(next_handshake_state_, STATE_NONE);
- DCHECK(handshake_completed_);
- return transport_socket_->Read(buf, buf_len, callback);
-}
-int FakeSSLClientSocket::Read(net::IOBuffer* buf, int buf_len,
const net::CompletionCallback& callback) {
DCHECK_EQ(next_handshake_state_, STATE_NONE);
DCHECK(handshake_completed_);
@@ -112,7 +97,7 @@ int FakeSSLClientSocket::Read(net::IOBuffer* buf, int buf_len,
}
int FakeSSLClientSocket::Write(net::IOBuffer* buf, int buf_len,
- net::OldCompletionCallback* callback) {
+ const net::CompletionCallback& callback) {
DCHECK_EQ(next_handshake_state_, STATE_NONE);
DCHECK(handshake_completed_);
return transport_socket_->Write(buf, buf_len, callback);
@@ -126,23 +111,6 @@ bool FakeSSLClientSocket::SetSendBufferSize(int32 size) {
return transport_socket_->SetSendBufferSize(size);
}
-int FakeSSLClientSocket::Connect(net::OldCompletionCallback* callback) {
- // We don't support synchronous operation, even if
- // |transport_socket_| does.
- DCHECK(callback);
- DCHECK_EQ(next_handshake_state_, STATE_NONE);
- DCHECK(!handshake_completed_);
- DCHECK(!old_user_connect_callback_);
- DCHECK_EQ(write_buf_->BytesConsumed(), 0);
- DCHECK_EQ(read_buf_->BytesConsumed(), 0);
-
- next_handshake_state_ = STATE_CONNECT;
- int status = DoHandshakeLoop();
- if (status == net::ERR_IO_PENDING) {
- old_user_connect_callback_ = callback;
- }
- return status;
-}
int FakeSSLClientSocket::Connect(const net::CompletionCallback& callback) {
// We don't support synchronous operation, even if
// |transport_socket_| does.
@@ -190,16 +158,9 @@ int FakeSSLClientSocket::DoHandshakeLoop() {
void FakeSSLClientSocket::RunUserConnectCallback(int status) {
DCHECK_LE(status, net::OK);
next_handshake_state_ = STATE_NONE;
- if (old_user_connect_callback_) {
- net::OldCompletionCallback* user_connect_callback =
- old_user_connect_callback_;
- old_user_connect_callback_ = NULL;
- user_connect_callback->Run(status);
- } else {
- net::CompletionCallback user_connect_callback = user_connect_callback_;
- user_connect_callback_.Reset();
- user_connect_callback.Run(status);
- }
+ net::CompletionCallback user_connect_callback = user_connect_callback_;
+ user_connect_callback_.Reset();
+ user_connect_callback.Run(status);
}
void FakeSSLClientSocket::DoHandshakeLoopWithUserConnectCallback() {
@@ -210,7 +171,8 @@ void FakeSSLClientSocket::DoHandshakeLoopWithUserConnectCallback() {
}
int FakeSSLClientSocket::DoConnect() {
- int status = transport_socket_->Connect(&connect_callback_);
+ int status = transport_socket_->Connect(
+ base::Bind(&FakeSSLClientSocket::OnConnectDone, base::Unretained(this)));
if (status != net::OK) {
return status;
}
@@ -221,7 +183,7 @@ int FakeSSLClientSocket::DoConnect() {
void FakeSSLClientSocket::OnConnectDone(int status) {
DCHECK_NE(status, net::ERR_IO_PENDING);
DCHECK_LE(status, net::OK);
- DCHECK(old_user_connect_callback_ || !user_connect_callback_.is_null());
+ DCHECK(!user_connect_callback_.is_null());
if (status != net::OK) {
RunUserConnectCallback(status);
return;
@@ -239,7 +201,8 @@ void FakeSSLClientSocket::ProcessConnectDone() {
int FakeSSLClientSocket::DoSendClientHello() {
int status = transport_socket_->Write(
write_buf_, write_buf_->BytesRemaining(),
- &send_client_hello_callback_);
+ base::Bind(&FakeSSLClientSocket::OnSendClientHelloDone,
+ base::Unretained(this)));
if (status < net::OK) {
return status;
}
@@ -249,7 +212,7 @@ int FakeSSLClientSocket::DoSendClientHello() {
void FakeSSLClientSocket::OnSendClientHelloDone(int status) {
DCHECK_NE(status, net::ERR_IO_PENDING);
- DCHECK(old_user_connect_callback_ || !user_connect_callback_.is_null());
+ DCHECK(!user_connect_callback_.is_null());
if (status < net::OK) {
RunUserConnectCallback(status);
return;
@@ -272,7 +235,8 @@ void FakeSSLClientSocket::ProcessSendClientHelloDone(size_t written) {
int FakeSSLClientSocket::DoVerifyServerHello() {
int status = transport_socket_->Read(
read_buf_, read_buf_->BytesRemaining(),
- &verify_server_hello_callback_);
+ base::Bind(&FakeSSLClientSocket::OnVerifyServerHelloDone,
+ base::Unretained(this)));
if (status < net::OK) {
return status;
}
@@ -282,7 +246,7 @@ int FakeSSLClientSocket::DoVerifyServerHello() {
void FakeSSLClientSocket::OnVerifyServerHelloDone(int status) {
DCHECK_NE(status, net::ERR_IO_PENDING);
- DCHECK(old_user_connect_callback_ || !user_connect_callback_.is_null());
+ DCHECK(!user_connect_callback_.is_null());
if (status < net::OK) {
RunUserConnectCallback(status);
return;
@@ -325,7 +289,6 @@ void FakeSSLClientSocket::Disconnect() {
transport_socket_->Disconnect();
next_handshake_state_ = STATE_NONE;
handshake_completed_ = false;
- old_user_connect_callback_ = NULL;
user_connect_callback_.Reset();
write_buf_->SetOffset(0);
read_buf_->SetOffset(0);
diff --git a/jingle/notifier/base/fake_ssl_client_socket.h b/jingle/notifier/base/fake_ssl_client_socket.h
index 623e21b..3e428cd 100644
--- a/jingle/notifier/base/fake_ssl_client_socket.h
+++ b/jingle/notifier/base/fake_ssl_client_socket.h
@@ -47,14 +47,11 @@ class FakeSSLClientSocket : public net::StreamSocket {
// net::StreamSocket implementation.
virtual int Read(net::IOBuffer* buf, int buf_len,
- net::OldCompletionCallback* callback) OVERRIDE;
- virtual int Read(net::IOBuffer* buf, int buf_len,
const net::CompletionCallback& callback) OVERRIDE;
virtual int Write(net::IOBuffer* buf, int buf_len,
- net::OldCompletionCallback* callback) OVERRIDE;
+ const net::CompletionCallback& callback) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
- virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE;
virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
virtual void Disconnect() OVERRIDE;
virtual bool IsConnected() const OVERRIDE;
@@ -93,13 +90,6 @@ class FakeSSLClientSocket : public net::StreamSocket {
void OnVerifyServerHelloDone(int status);
net::Error ProcessVerifyServerHelloDone(size_t read);
- // Callbacks passed to |transport_socket_|.
- net::OldCompletionCallbackImpl<FakeSSLClientSocket> connect_callback_;
- net::OldCompletionCallbackImpl<FakeSSLClientSocket>
- send_client_hello_callback_;
- net::OldCompletionCallbackImpl<FakeSSLClientSocket>
- verify_server_hello_callback_;
-
scoped_ptr<net::StreamSocket> transport_socket_;
// During the handshake process, holds a value from HandshakeState.
@@ -110,7 +100,6 @@ class FakeSSLClientSocket : public net::StreamSocket {
bool handshake_completed_;
// The callback passed to Connect().
- net::OldCompletionCallback* old_user_connect_callback_;
net::CompletionCallback user_connect_callback_;
scoped_refptr<net::DrainableIOBuffer> write_buf_;
diff --git a/jingle/notifier/base/fake_ssl_client_socket_unittest.cc b/jingle/notifier/base/fake_ssl_client_socket_unittest.cc
index eb3ba5a..1a3260d 100644
--- a/jingle/notifier/base/fake_ssl_client_socket_unittest.cc
+++ b/jingle/notifier/base/fake_ssl_client_socket_unittest.cc
@@ -47,13 +47,12 @@ class MockClientSocket : public net::StreamSocket {
public:
virtual ~MockClientSocket() {}
- MOCK_METHOD3(Read, int(net::IOBuffer*, int, net::OldCompletionCallback*));
MOCK_METHOD3(Read, int(net::IOBuffer*, int,
const net::CompletionCallback&));
- MOCK_METHOD3(Write, int(net::IOBuffer*, int, net::OldCompletionCallback*));
+ MOCK_METHOD3(Write, int(net::IOBuffer*, int,
+ const net::CompletionCallback&));
MOCK_METHOD1(SetReceiveBufferSize, bool(int32));
MOCK_METHOD1(SetSendBufferSize, bool(int32));
- MOCK_METHOD1(Connect, int(net::OldCompletionCallback*));
MOCK_METHOD1(Connect, int(const net::CompletionCallback&));
MOCK_METHOD0(Disconnect, void());
MOCK_CONST_METHOD0(IsConnected, bool());
@@ -111,7 +110,7 @@ class FakeSSLClientSocketTest : public testing::Test {
void ExpectStatus(
bool async, int expected_status, int immediate_status,
- TestOldCompletionCallback* test_completion_callback) {
+ net::TestCompletionCallback* test_completion_callback) {
if (async) {
EXPECT_EQ(net::ERR_IO_PENDING, immediate_status);
int status = test_completion_callback->WaitForResult();
@@ -152,8 +151,9 @@ class FakeSSLClientSocketTest : public testing::Test {
for (int i = 0; i < num_resets + 1; ++i) {
SCOPED_TRACE(i);
- TestOldCompletionCallback test_completion_callback;
- int status = fake_ssl_client_socket.Connect(&test_completion_callback);
+ net::TestCompletionCallback test_completion_callback;
+ int status = fake_ssl_client_socket.Connect(
+ test_completion_callback.callback());
if (async) {
EXPECT_FALSE(fake_ssl_client_socket.IsConnected());
}
@@ -164,13 +164,14 @@ class FakeSSLClientSocketTest : public testing::Test {
scoped_refptr<net::IOBuffer> read_buf(
new net::IOBuffer(read_buf_len));
int read_status = fake_ssl_client_socket.Read(
- read_buf, read_buf_len, &test_completion_callback);
+ read_buf, read_buf_len, test_completion_callback.callback());
ExpectStatus(async, read_len, read_status, &test_completion_callback);
scoped_refptr<net::IOBuffer> write_buf(
new net::StringIOBuffer(kWriteTestData));
int write_status = fake_ssl_client_socket.Write(
- write_buf, arraysize(kWriteTestData), &test_completion_callback);
+ write_buf, arraysize(kWriteTestData),
+ test_completion_callback.callback());
ExpectStatus(async, arraysize(kWriteTestData), write_status,
&test_completion_callback);
} else {
@@ -245,8 +246,9 @@ class FakeSSLClientSocketTest : public testing::Test {
(error == ERR_MALFORMED_SERVER_HELLO)) ?
net::ERR_UNEXPECTED : error;
- TestOldCompletionCallback test_completion_callback;
- int status = fake_ssl_client_socket.Connect(&test_completion_callback);
+ net::TestCompletionCallback test_completion_callback;
+ int status = fake_ssl_client_socket.Connect(
+ test_completion_callback.callback());
EXPECT_FALSE(fake_ssl_client_socket.IsConnected());
ExpectStatus(async, expected_status, status, &test_completion_callback);
EXPECT_FALSE(fake_ssl_client_socket.IsConnected());
diff --git a/jingle/notifier/base/proxy_resolving_client_socket.cc b/jingle/notifier/base/proxy_resolving_client_socket.cc
index 3d46ed6b..6314bb2 100644
--- a/jingle/notifier/base/proxy_resolving_client_socket.cc
+++ b/jingle/notifier/base/proxy_resolving_client_socket.cc
@@ -36,8 +36,7 @@ ProxyResolvingClientSocket::ProxyResolvingClientSocket(
net::BoundNetLog::Make(
request_context_getter->GetURLRequestContext()->net_log(),
net::NetLog::SOURCE_SOCKET)),
- ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
- old_user_connect_callback_(NULL) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
DCHECK(request_context_getter);
net::URLRequestContext* request_context =
request_context_getter->GetURLRequestContext();
@@ -68,13 +67,6 @@ ProxyResolvingClientSocket::~ProxyResolvingClientSocket() {
}
int ProxyResolvingClientSocket::Read(net::IOBuffer* buf, int buf_len,
- net::OldCompletionCallback* callback) {
- if (transport_.get() && transport_->socket())
- return transport_->socket()->Read(buf, buf_len, callback);
- NOTREACHED();
- return net::ERR_SOCKET_NOT_CONNECTED;
-}
-int ProxyResolvingClientSocket::Read(net::IOBuffer* buf, int buf_len,
const net::CompletionCallback& callback) {
if (transport_.get() && transport_->socket())
return transport_->socket()->Read(buf, buf_len, callback);
@@ -82,8 +74,10 @@ int ProxyResolvingClientSocket::Read(net::IOBuffer* buf, int buf_len,
return net::ERR_SOCKET_NOT_CONNECTED;
}
-int ProxyResolvingClientSocket::Write(net::IOBuffer* buf, int buf_len,
- net::OldCompletionCallback* callback) {
+int ProxyResolvingClientSocket::Write(
+ net::IOBuffer* buf,
+ int buf_len,
+ const net::CompletionCallback& callback) {
if (transport_.get() && transport_->socket())
return transport_->socket()->Write(buf, buf_len, callback);
NOTREACHED();
@@ -104,36 +98,9 @@ bool ProxyResolvingClientSocket::SetSendBufferSize(int32 size) {
return false;
}
-int ProxyResolvingClientSocket::Connect(net::OldCompletionCallback* callback) {
- DCHECK(!old_user_connect_callback_ && user_connect_callback_.is_null());
-
- tried_direct_connect_fallback_ = false;
-
- // First we try and resolve the proxy.
- GURL url("http://" + dest_host_port_pair_.ToString());
- int status = network_session_->proxy_service()->ResolveProxy(
- url,
- &proxy_info_,
- &proxy_resolve_callback_,
- &pac_request_,
- bound_net_log_);
- if (status != net::ERR_IO_PENDING) {
- // We defer execution of ProcessProxyResolveDone instead of calling it
- // directly here for simplicity. From the caller's point of view,
- // the connect always happens asynchronously.
- MessageLoop* message_loop = MessageLoop::current();
- CHECK(message_loop);
- message_loop->PostTask(
- FROM_HERE,
- base::Bind(&ProxyResolvingClientSocket::ProcessProxyResolveDone,
- weak_factory_.GetWeakPtr(), status));
- }
- old_user_connect_callback_ = callback;
- return net::ERR_IO_PENDING;
-}
int ProxyResolvingClientSocket::Connect(
const net::CompletionCallback& callback) {
- DCHECK(!old_user_connect_callback_ && user_connect_callback_.is_null());
+ DCHECK(user_connect_callback_.is_null());
tried_direct_connect_fallback_ = false;
@@ -162,16 +129,9 @@ int ProxyResolvingClientSocket::Connect(
void ProxyResolvingClientSocket::RunUserConnectCallback(int status) {
DCHECK_LE(status, net::OK);
- if (old_user_connect_callback_) {
- net::OldCompletionCallback* user_connect_callback =
- old_user_connect_callback_;
- old_user_connect_callback_ = NULL;
- user_connect_callback->Run(status);
- } else {
- net::CompletionCallback user_connect_callback = user_connect_callback_;
- user_connect_callback_.Reset();
- user_connect_callback.Run(status);
- }
+ net::CompletionCallback user_connect_callback = user_connect_callback_;
+ user_connect_callback_.Reset();
+ user_connect_callback.Run(status);
}
// Always runs asynchronously.
@@ -330,7 +290,6 @@ void ProxyResolvingClientSocket::Disconnect() {
CloseTransportSocket();
if (pac_request_)
network_session_->proxy_service()->CancelPacRequest(pac_request_);
- old_user_connect_callback_ = NULL;
user_connect_callback_.Reset();
}
diff --git a/jingle/notifier/base/proxy_resolving_client_socket.h b/jingle/notifier/base/proxy_resolving_client_socket.h
index 4463364..68aa718 100644
--- a/jingle/notifier/base/proxy_resolving_client_socket.h
+++ b/jingle/notifier/base/proxy_resolving_client_socket.h
@@ -47,14 +47,11 @@ class ProxyResolvingClientSocket : public net::StreamSocket {
// net::StreamSocket implementation.
virtual int Read(net::IOBuffer* buf, int buf_len,
- net::OldCompletionCallback* callback) OVERRIDE;
- virtual int Read(net::IOBuffer* buf, int buf_len,
const net::CompletionCallback& callback) OVERRIDE;
virtual int Write(net::IOBuffer* buf, int buf_len,
- net::OldCompletionCallback* callback) OVERRIDE;
+ const net::CompletionCallback& callback) OVERRIDE;
virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
virtual bool SetSendBufferSize(int32 size) OVERRIDE;
- virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE;
virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
virtual void Disconnect() OVERRIDE;
virtual bool IsConnected() const OVERRIDE;
@@ -98,7 +95,6 @@ class ProxyResolvingClientSocket : public net::StreamSocket {
base::WeakPtrFactory<ProxyResolvingClientSocket> weak_factory_;
// The callback passed to Connect().
- net::OldCompletionCallback* old_user_connect_callback_;
net::CompletionCallback user_connect_callback_;
};
diff --git a/jingle/notifier/base/proxy_resolving_client_socket_unittest.cc b/jingle/notifier/base/proxy_resolving_client_socket_unittest.cc
index acbac4a..e1f4480 100644
--- a/jingle/notifier/base/proxy_resolving_client_socket_unittest.cc
+++ b/jingle/notifier/base/proxy_resolving_client_socket_unittest.cc
@@ -74,8 +74,8 @@ TEST_F(ProxyResolvingClientSocketTest, DISABLED_ConnectError) {
url_request_context_getter_,
net::SSLConfig(),
dest);
- TestOldCompletionCallback callback;
- int status = proxy_resolving_socket.Connect(&callback);
+ net::TestCompletionCallback callback;
+ int status = proxy_resolving_socket.Connect(callback.callback());
// Connect always returns ERR_IO_PENDING because it is always asynchronous.
EXPECT_EQ(net::ERR_IO_PENDING, status);
status = callback.WaitForResult();
@@ -112,8 +112,8 @@ TEST_F(ProxyResolvingClientSocketTest, ReportsBadProxies) {
net::SSLConfig(),
dest);
- TestOldCompletionCallback callback;
- int status = proxy_resolving_socket.Connect(&callback);
+ net::TestCompletionCallback callback;
+ int status = proxy_resolving_socket.Connect(callback.callback());
EXPECT_EQ(net::ERR_IO_PENDING, status);
status = callback.WaitForResult();
EXPECT_EQ(net::OK, status);