diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-01 20:38:10 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-01 20:38:10 +0000 |
commit | f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8 (patch) | |
tree | 6ccdd87ccfc89adbcb372c517559fa61fbc6c6b2 /jingle/glue | |
parent | d1666539b57bf8552e203d355fd09909d36f9732 (diff) | |
download | chromium_src-f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8.zip chromium_src-f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8.tar.gz chromium_src-f1f3f0f8af3740ec2afaebcaed410950a9cc0ac8.tar.bz2 |
Begin CompletionCallback switchover.
Rename CompletionCallback to OldCompletionCallback in preparation for introducing a new CompletionCallback based on base::Callback.
Also renames other CompletionCallback types like CancelableCompletionCallback and TestCompletionCallback and CompletionCallbackImpl. All using sed with s/CompletionCallback/OldCompletionCallback/g.
BUG=98719
TEST=none
Review URL: http://codereview.chromium.org/8070013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103650 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle/glue')
-rw-r--r-- | jingle/glue/channel_socket_adapter.cc | 12 | ||||
-rw-r--r-- | jingle/glue/channel_socket_adapter.h | 8 | ||||
-rw-r--r-- | jingle/glue/channel_socket_adapter_unittest.cc | 2 | ||||
-rw-r--r-- | jingle/glue/pseudotcp_adapter.cc | 40 | ||||
-rw-r--r-- | jingle/glue/pseudotcp_adapter.h | 6 | ||||
-rw-r--r-- | jingle/glue/pseudotcp_adapter_unittest.cc | 24 |
6 files changed, 46 insertions, 46 deletions
diff --git a/jingle/glue/channel_socket_adapter.cc b/jingle/glue/channel_socket_adapter.cc index ca13af1..64cfa7f 100644 --- a/jingle/glue/channel_socket_adapter.cc +++ b/jingle/glue/channel_socket_adapter.cc @@ -35,7 +35,7 @@ TransportChannelSocketAdapter::~TransportChannelSocketAdapter() { } int TransportChannelSocketAdapter::Read( - net::IOBuffer* buf, int buffer_size, net::CompletionCallback* callback) { + net::IOBuffer* buf, int buffer_size, net::OldCompletionCallback* callback) { DCHECK_EQ(MessageLoop::current(), message_loop_); DCHECK(buf); DCHECK(callback); @@ -54,7 +54,7 @@ int TransportChannelSocketAdapter::Read( } int TransportChannelSocketAdapter::Write( - net::IOBuffer* buffer, int buffer_size, net::CompletionCallback* callback) { + net::IOBuffer* buffer, int buffer_size, net::OldCompletionCallback* callback) { DCHECK_EQ(MessageLoop::current(), message_loop_); DCHECK(buffer); DCHECK(callback); @@ -111,14 +111,14 @@ void TransportChannelSocketAdapter::Close(int error_code) { channel_ = NULL; if (read_callback_) { - net::CompletionCallback* callback = read_callback_; + net::OldCompletionCallback* callback = read_callback_; read_callback_ = NULL; read_buffer_ = NULL; callback->Run(error_code); } if (write_callback_) { - net::CompletionCallback* callback = write_callback_; + net::OldCompletionCallback* callback = write_callback_; write_callback_ = NULL; write_buffer_ = NULL; callback->Run(error_code); @@ -141,7 +141,7 @@ void TransportChannelSocketAdapter::OnNewPacket( memcpy(read_buffer_->data(), data, data_size); - net::CompletionCallback* callback = read_callback_; + net::OldCompletionCallback* callback = read_callback_; read_callback_ = NULL; read_buffer_ = NULL; @@ -163,7 +163,7 @@ void TransportChannelSocketAdapter::OnWritableState( result = net::MapSystemError(channel_->GetError()); if (result != net::ERR_IO_PENDING) { - net::CompletionCallback* callback = write_callback_; + net::OldCompletionCallback* callback = write_callback_; write_callback_ = NULL; write_buffer_ = NULL; callback->Run(result); diff --git a/jingle/glue/channel_socket_adapter.h b/jingle/glue/channel_socket_adapter.h index 8c63fd9..4a3eafb 100644 --- a/jingle/glue/channel_socket_adapter.h +++ b/jingle/glue/channel_socket_adapter.h @@ -34,9 +34,9 @@ class TransportChannelSocketAdapter : public net::Socket, // Socket interface. virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); @@ -51,11 +51,11 @@ class TransportChannelSocketAdapter : public net::Socket, cricket::TransportChannel* channel_; - net::CompletionCallback* read_callback_; // Not owned. + net::OldCompletionCallback* read_callback_; // Not owned. scoped_refptr<net::IOBuffer> read_buffer_; int read_buffer_size_; - net::CompletionCallback* write_callback_; // Not owned. + net::OldCompletionCallback* write_callback_; // Not owned. scoped_refptr<net::IOBuffer> write_buffer_; int write_buffer_size_; diff --git a/jingle/glue/channel_socket_adapter_unittest.cc b/jingle/glue/channel_socket_adapter_unittest.cc index 8eb4d23..e8b34b5 100644 --- a/jingle/glue/channel_socket_adapter_unittest.cc +++ b/jingle/glue/channel_socket_adapter_unittest.cc @@ -59,7 +59,7 @@ class TransportChannelSocketAdapterTest : public testing::Test { MockTransportChannel channel_; scoped_ptr<TransportChannelSocketAdapter> target_; - net::CompletionCallbackImpl<TransportChannelSocketAdapterTest> callback_; + net::OldCompletionCallbackImpl<TransportChannelSocketAdapterTest> callback_; int callback_result_; MessageLoopForIO message_loop_; }; diff --git a/jingle/glue/pseudotcp_adapter.cc b/jingle/glue/pseudotcp_adapter.cc index 94c81aa..d800d99 100644 --- a/jingle/glue/pseudotcp_adapter.cc +++ b/jingle/glue/pseudotcp_adapter.cc @@ -29,10 +29,10 @@ class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify, // Functions used to implement net::StreamSocket. int Read(net::IOBuffer* buffer, int buffer_size, - net::CompletionCallback* callback); + net::OldCompletionCallback* callback); int Write(net::IOBuffer* buffer, int buffer_size, - net::CompletionCallback* callback); - int Connect(net::CompletionCallback* callback); + net::OldCompletionCallback* callback); + int Connect(net::OldCompletionCallback* callback); void Disconnect(); bool IsConnected() const; @@ -67,9 +67,9 @@ class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify, // This re-sets |timer| without triggering callbacks. void AdjustClock(); - net::CompletionCallback* connect_callback_; - net::CompletionCallback* read_callback_; - net::CompletionCallback* write_callback_; + net::OldCompletionCallback* connect_callback_; + net::OldCompletionCallback* read_callback_; + net::OldCompletionCallback* write_callback_; cricket::PseudoTcp pseudo_tcp_; scoped_ptr<net::Socket> socket_; @@ -82,8 +82,8 @@ class PseudoTcpAdapter::Core : public cricket::IPseudoTcpNotify, bool socket_write_pending_; scoped_refptr<net::IOBuffer> socket_read_buffer_; - net::CompletionCallbackImpl<Core> socket_read_callback_; - net::CompletionCallbackImpl<Core> socket_write_callback_; + net::OldCompletionCallbackImpl<Core> socket_read_callback_; + net::OldCompletionCallbackImpl<Core> socket_write_callback_; base::OneShotTimer<Core> timer_; @@ -110,7 +110,7 @@ PseudoTcpAdapter::Core::~Core() { } int PseudoTcpAdapter::Core::Read(net::IOBuffer* buffer, int buffer_size, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { DCHECK(!read_callback_); // Reference the Core in case a callback deletes the adapter. @@ -134,7 +134,7 @@ int PseudoTcpAdapter::Core::Read(net::IOBuffer* buffer, int buffer_size, } int PseudoTcpAdapter::Core::Write(net::IOBuffer* buffer, int buffer_size, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { DCHECK(!write_callback_); // Reference the Core in case a callback deletes the adapter. @@ -157,7 +157,7 @@ int PseudoTcpAdapter::Core::Write(net::IOBuffer* buffer, int buffer_size, return result; } -int PseudoTcpAdapter::Core::Connect(net::CompletionCallback* callback) { +int PseudoTcpAdapter::Core::Connect(net::OldCompletionCallback* callback) { DCHECK_EQ(pseudo_tcp_.State(), cricket::PseudoTcp::TCP_LISTEN); // Reference the Core in case a callback deletes the adapter. @@ -202,7 +202,7 @@ void PseudoTcpAdapter::Core::OnTcpOpen(PseudoTcp* tcp) { DCHECK(tcp == &pseudo_tcp_); if (connect_callback_) { - net::CompletionCallback* callback = connect_callback_; + net::OldCompletionCallback* callback = connect_callback_; connect_callback_ = NULL; callback->Run(net::OK); } @@ -226,7 +226,7 @@ void PseudoTcpAdapter::Core::OnTcpReadable(PseudoTcp* tcp) { AdjustClock(); - net::CompletionCallback* callback = read_callback_; + net::OldCompletionCallback* callback = read_callback_; read_callback_ = NULL; read_buffer_ = NULL; callback->Run(result); @@ -247,7 +247,7 @@ void PseudoTcpAdapter::Core::OnTcpWriteable(PseudoTcp* tcp) { AdjustClock(); - net::CompletionCallback* callback = write_callback_; + net::OldCompletionCallback* callback = write_callback_; write_callback_ = NULL; write_buffer_ = NULL; callback->Run(result); @@ -257,19 +257,19 @@ void PseudoTcpAdapter::Core::OnTcpClosed(PseudoTcp* tcp, uint32 error) { DCHECK_EQ(tcp, &pseudo_tcp_); if (connect_callback_) { - net::CompletionCallback* callback = connect_callback_; + net::OldCompletionCallback* callback = connect_callback_; connect_callback_ = NULL; callback->Run(net::MapSystemError(error)); } if (read_callback_) { - net::CompletionCallback* callback = read_callback_; + net::OldCompletionCallback* callback = read_callback_; read_callback_ = NULL; callback->Run(net::MapSystemError(error)); } if (write_callback_) { - net::CompletionCallback* callback = write_callback_; + net::OldCompletionCallback* callback = write_callback_; write_callback_ = NULL; callback->Run(net::MapSystemError(error)); } @@ -394,13 +394,13 @@ PseudoTcpAdapter::~PseudoTcpAdapter() { } int PseudoTcpAdapter::Read(net::IOBuffer* buffer, int buffer_size, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); return core_->Read(buffer, buffer_size, callback); } int PseudoTcpAdapter::Write(net::IOBuffer* buffer, int buffer_size, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); return core_->Write(buffer, buffer_size, callback); } @@ -419,7 +419,7 @@ bool PseudoTcpAdapter::SetSendBufferSize(int32 size) { return false; } -int PseudoTcpAdapter::Connect(net::CompletionCallback* callback) { +int PseudoTcpAdapter::Connect(net::OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); // net::StreamSocket requires that Connect return OK if already connected. diff --git a/jingle/glue/pseudotcp_adapter.h b/jingle/glue/pseudotcp_adapter.h index a764182..5edb3e0 100644 --- a/jingle/glue/pseudotcp_adapter.h +++ b/jingle/glue/pseudotcp_adapter.h @@ -31,14 +31,14 @@ class PseudoTcpAdapter : public net::StreamSocket, base::NonThreadSafe { // net::Socket implementation. virtual int Read(net::IOBuffer* buffer, int buffer_size, - net::CompletionCallback* callback) OVERRIDE; + net::OldCompletionCallback* callback) OVERRIDE; virtual int Write(net::IOBuffer* buffer, int buffer_size, - net::CompletionCallback* callback) OVERRIDE; + net::OldCompletionCallback* callback) OVERRIDE; virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; virtual bool SetSendBufferSize(int32 size) OVERRIDE; // net::StreamSocket implementation. - virtual int Connect(net::CompletionCallback* callback) OVERRIDE; + virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; virtual void Disconnect() OVERRIDE; virtual bool IsConnected() const OVERRIDE; virtual bool IsConnectedAndIdle() const OVERRIDE; diff --git a/jingle/glue/pseudotcp_adapter_unittest.cc b/jingle/glue/pseudotcp_adapter_unittest.cc index 12a6dbe..d418826 100644 --- a/jingle/glue/pseudotcp_adapter_unittest.cc +++ b/jingle/glue/pseudotcp_adapter_unittest.cc @@ -92,7 +92,7 @@ class FakeSocket : public net::Socket { if (read_callback_) { int size = std::min(read_buffer_size_, static_cast<int>(data.size())); memcpy(read_buffer_->data(), &data[0], data.size()); - net::CompletionCallback* cb = read_callback_; + net::OldCompletionCallback* cb = read_callback_; read_callback_ = NULL; read_buffer_ = NULL; cb->Run(size); @@ -113,7 +113,7 @@ class FakeSocket : public net::Socket { // net::Socket interface. virtual int Read(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) { + net::OldCompletionCallback* callback) { CHECK(!read_callback_); CHECK(buf); @@ -133,7 +133,7 @@ class FakeSocket : public net::Socket { } virtual int Write(net::IOBuffer* buf, int buf_len, - net::CompletionCallback* callback) OVERRIDE { + net::OldCompletionCallback* callback) OVERRIDE { DCHECK(buf); if (peer_socket_) { MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod( @@ -156,7 +156,7 @@ class FakeSocket : public net::Socket { private: scoped_refptr<net::IOBuffer> read_buffer_; int read_buffer_size_; - net::CompletionCallback* read_callback_; + net::OldCompletionCallback* read_callback_; std::deque<std::vector<char> > incoming_packets_; @@ -292,8 +292,8 @@ class TCPChannelTester : public base::RefCountedThreadSafe<TCPChannelTester> { scoped_refptr<net::DrainableIOBuffer> output_buffer_; scoped_refptr<net::GrowableIOBuffer> input_buffer_; - net::CompletionCallbackImpl<TCPChannelTester> write_cb_; - net::CompletionCallbackImpl<TCPChannelTester> read_cb_; + net::OldCompletionCallbackImpl<TCPChannelTester> write_cb_; + net::OldCompletionCallbackImpl<TCPChannelTester> read_cb_; int write_errors_; int read_errors_; }; @@ -322,8 +322,8 @@ class PseudoTcpAdapterTest : public testing::Test { }; TEST_F(PseudoTcpAdapterTest, DataTransfer) { - TestCompletionCallback host_connect_cb; - TestCompletionCallback client_connect_cb; + TestOldCompletionCallback host_connect_cb; + TestOldCompletionCallback client_connect_cb; int rv1 = host_pseudotcp_->Connect(&host_connect_cb); int rv2 = client_pseudotcp_->Connect(&client_connect_cb); @@ -357,8 +357,8 @@ TEST_F(PseudoTcpAdapterTest, LimitedChannel) { host_socket_->set_latency(kLatencyMs); client_socket_->set_rate_limiter(&client_limiter); - TestCompletionCallback host_connect_cb; - TestCompletionCallback client_connect_cb; + TestOldCompletionCallback host_connect_cb; + TestOldCompletionCallback client_connect_cb; int rv1 = host_pseudotcp_->Connect(&host_connect_cb); int rv2 = client_pseudotcp_->Connect(&client_connect_cb); @@ -396,9 +396,9 @@ TEST_F(PseudoTcpAdapterTest, DeleteOnConnected) { // This test verifies that deleting the adapter mid-callback doesn't lead // to deleted structures being touched as the stack unrolls, so the failure // mode is a crash rather than a normal test failure. - TestCompletionCallback client_connect_cb; + TestOldCompletionCallback client_connect_cb; DeleteOnConnected host_delete(&message_loop_, &host_pseudotcp_); - net::CompletionCallbackImpl<DeleteOnConnected> + net::OldCompletionCallbackImpl<DeleteOnConnected> host_connect_cb(&host_delete, &DeleteOnConnected::OnConnected); host_pseudotcp_->Connect(&host_connect_cb); |