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 /net/curvecp | |
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 'net/curvecp')
-rw-r--r-- | net/curvecp/client_packetizer.cc | 6 | ||||
-rw-r--r-- | net/curvecp/client_packetizer.h | 8 | ||||
-rw-r--r-- | net/curvecp/curvecp_client_socket.cc | 6 | ||||
-rw-r--r-- | net/curvecp/curvecp_client_socket.h | 6 | ||||
-rw-r--r-- | net/curvecp/curvecp_server_socket.cc | 4 | ||||
-rw-r--r-- | net/curvecp/curvecp_server_socket.h | 4 | ||||
-rw-r--r-- | net/curvecp/curvecp_transfer_unittest.cc | 2 | ||||
-rw-r--r-- | net/curvecp/messenger.cc | 8 | ||||
-rw-r--r-- | net/curvecp/messenger.h | 10 | ||||
-rw-r--r-- | net/curvecp/packetizer.h | 2 | ||||
-rw-r--r-- | net/curvecp/server_packetizer.cc | 2 | ||||
-rw-r--r-- | net/curvecp/server_packetizer.h | 6 | ||||
-rw-r--r-- | net/curvecp/test_client.cc | 4 | ||||
-rw-r--r-- | net/curvecp/test_client.h | 10 | ||||
-rw-r--r-- | net/curvecp/test_server.h | 8 |
15 files changed, 43 insertions, 43 deletions
diff --git a/net/curvecp/client_packetizer.cc b/net/curvecp/client_packetizer.cc index c609e96..2d96b1f 100644 --- a/net/curvecp/client_packetizer.cc +++ b/net/curvecp/client_packetizer.cc @@ -50,7 +50,7 @@ ClientPacketizer::~ClientPacketizer() { int ClientPacketizer::Connect(const AddressList& server, Packetizer::Listener* listener, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(!user_callback_); DCHECK(!socket_.get()); DCHECK(!listener_); @@ -68,7 +68,7 @@ int ClientPacketizer::Connect(const AddressList& server, int ClientPacketizer::SendMessage(ConnectionKey key, const char* data, size_t length, - CompletionCallback* callback) { + OldCompletionCallback* callback) { // We can't send messages smaller than 16 bytes. if (length < 16) return ERR_UNEXPECTED; @@ -280,7 +280,7 @@ void ClientPacketizer::DoCallback(int result) { DCHECK_NE(result, ERR_IO_PENDING); DCHECK(user_callback_); - CompletionCallback* callback = user_callback_; + OldCompletionCallback* callback = user_callback_; user_callback_ = NULL; callback->Run(result); } diff --git a/net/curvecp/client_packetizer.h b/net/curvecp/client_packetizer.h index ff2a400..4946ce8 100644 --- a/net/curvecp/client_packetizer.h +++ b/net/curvecp/client_packetizer.h @@ -27,13 +27,13 @@ class ClientPacketizer : public Packetizer { int Connect(const AddressList& server, Packetizer::Listener* listener, - CompletionCallback* callback); + OldCompletionCallback* callback); // Packetizer methods virtual int SendMessage(ConnectionKey key, const char* data, size_t length, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual void Close(ConnectionKey key); virtual int GetPeerAddress(IPEndPoint* endpoint) const; virtual int max_message_payload() const; @@ -81,7 +81,7 @@ class ClientPacketizer : public Packetizer { StateType next_state_; scoped_ptr<UDPClientSocket> socket_; Packetizer::Listener* listener_; - CompletionCallback* user_callback_; + OldCompletionCallback* user_callback_; AddressList addresses_; const struct addrinfo* current_address_; int hello_attempts_; // Number of attempts to send a Hello Packet. @@ -91,7 +91,7 @@ class ClientPacketizer : public Packetizer { uchar shortterm_public_key_[32]; - CompletionCallbackImpl<ClientPacketizer> io_callback_; + OldCompletionCallbackImpl<ClientPacketizer> io_callback_; ScopedRunnableMethodFactory<ClientPacketizer> timers_factory_; DISALLOW_COPY_AND_ASSIGN(ClientPacketizer); diff --git a/net/curvecp/curvecp_client_socket.cc b/net/curvecp/curvecp_client_socket.cc index 95b36f6..cba3d0e 100644 --- a/net/curvecp/curvecp_client_socket.cc +++ b/net/curvecp/curvecp_client_socket.cc @@ -21,7 +21,7 @@ CurveCPClientSocket::CurveCPClientSocket(const AddressList& addresses, CurveCPClientSocket::~CurveCPClientSocket() { } -int CurveCPClientSocket::Connect(CompletionCallback* callback) { +int CurveCPClientSocket::Connect(OldCompletionCallback* callback) { return packetizer_.Connect(addresses_, &messenger_, callback); } @@ -98,13 +98,13 @@ base::TimeDelta CurveCPClientSocket::GetConnectTimeMicros() const { int CurveCPClientSocket::Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { return messenger_.Read(buf, buf_len, callback); } int CurveCPClientSocket::Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { return messenger_.Write(buf, buf_len, callback); } diff --git a/net/curvecp/curvecp_client_socket.h b/net/curvecp/curvecp_client_socket.h index c9faa63..e758359 100644 --- a/net/curvecp/curvecp_client_socket.h +++ b/net/curvecp/curvecp_client_socket.h @@ -25,7 +25,7 @@ class CurveCPClientSocket : public StreamSocket { virtual ~CurveCPClientSocket(); // ClientSocket methods: - virtual int Connect(CompletionCallback* callback); + virtual int Connect(OldCompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; virtual bool IsConnectedAndIdle() const; @@ -40,8 +40,8 @@ class CurveCPClientSocket : public StreamSocket { virtual base::TimeDelta GetConnectTimeMicros() const; // Socket methods: - virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); - virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); + virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); + virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); diff --git a/net/curvecp/curvecp_server_socket.cc b/net/curvecp/curvecp_server_socket.cc index 32d3786..15185ff 100644 --- a/net/curvecp/curvecp_server_socket.cc +++ b/net/curvecp/curvecp_server_socket.cc @@ -49,13 +49,13 @@ void CurveCPServerSocket::Close() { int CurveCPServerSocket::Read(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { return messenger_.Read(buf, buf_len, callback); } int CurveCPServerSocket::Write(IOBuffer* buf, int buf_len, - CompletionCallback* callback) { + OldCompletionCallback* callback) { return messenger_.Write(buf, buf_len, callback); } diff --git a/net/curvecp/curvecp_server_socket.h b/net/curvecp/curvecp_server_socket.h index 672a574..32be5a4 100644 --- a/net/curvecp/curvecp_server_socket.h +++ b/net/curvecp/curvecp_server_socket.h @@ -33,8 +33,8 @@ class CurveCPServerSocket : public Socket, void Close(); // Socket methods: - virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); - virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); + virtual int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); + virtual int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); diff --git a/net/curvecp/curvecp_transfer_unittest.cc b/net/curvecp/curvecp_transfer_unittest.cc index e433118..1c092f3 100644 --- a/net/curvecp/curvecp_transfer_unittest.cc +++ b/net/curvecp/curvecp_transfer_unittest.cc @@ -30,7 +30,7 @@ void RunEchoTest(int bytes) { EXPECT_TRUE(server.Start(1234)); HostPortPair server_address("localhost", 1234); - TestCompletionCallback cb; + TestOldCompletionCallback cb; EXPECT_TRUE(client.Start(server_address, bytes, &cb)); int rv = cb.WaitForResult(); diff --git a/net/curvecp/messenger.cc b/net/curvecp/messenger.cc index ad6ed31..07f7d82 100644 --- a/net/curvecp/messenger.cc +++ b/net/curvecp/messenger.cc @@ -70,7 +70,7 @@ Messenger::Messenger(Packetizer* packetizer) Messenger::~Messenger() { } -int Messenger::Read(IOBuffer* buf, int buf_len, CompletionCallback* callback) { +int Messenger::Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); DCHECK(!receive_complete_callback_); @@ -86,7 +86,7 @@ int Messenger::Read(IOBuffer* buf, int buf_len, CompletionCallback* callback) { return bytes_read; } -int Messenger::Write(IOBuffer* buf, int buf_len, CompletionCallback* callback) { +int Messenger::Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback) { DCHECK(CalledOnValidThread()); DCHECK(!pending_send_.get()); // Already a write pending! DCHECK(!send_complete_callback_); @@ -156,7 +156,7 @@ IOBufferWithSize* Messenger::CreateBufferFromSendQueue() { int len = send_buffer_.write(pending_send_->data(), pending_send_length_); if (len) { pending_send_ = NULL; - CompletionCallback* callback = send_complete_callback_; + OldCompletionCallback* callback = send_complete_callback_; send_complete_callback_ = NULL; callback->Run(len); } @@ -341,7 +341,7 @@ void Messenger::RecvMessage() { if (received_list_.bytes_available() && receive_complete_callback_) { // Pass the data up to the caller. int bytes_read = InternalRead(pending_receive_, pending_receive_length_); - CompletionCallback* callback = receive_complete_callback_; + OldCompletionCallback* callback = receive_complete_callback_; receive_complete_callback_ = NULL; callback->Run(bytes_read); } diff --git a/net/curvecp/messenger.h b/net/curvecp/messenger.h index 7bd1bb8..8377358 100644 --- a/net/curvecp/messenger.h +++ b/net/curvecp/messenger.h @@ -34,8 +34,8 @@ class Messenger : public base::NonThreadSafe, explicit Messenger(Packetizer* packetizer); virtual ~Messenger(); - int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); - int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); + int Read(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); + int Write(IOBuffer* buf, int buf_len, OldCompletionCallback* callback); // Packetizer::Listener methods: virtual void OnConnection(ConnectionKey key); @@ -71,13 +71,13 @@ class Messenger : public base::NonThreadSafe, // The send_buffer is a list of pending data to pack into messages and send // to the remote. CircularBuffer send_buffer_; - CompletionCallback* send_complete_callback_; + OldCompletionCallback* send_complete_callback_; scoped_refptr<IOBuffer> pending_send_; int pending_send_length_; // The read_buffer is a list of pending data which has been unpacked from // messages and is awaiting delivery to the application. - CompletionCallback* receive_complete_callback_; + OldCompletionCallback* receive_complete_callback_; scoped_refptr<IOBuffer> pending_receive_; int pending_receive_length_; @@ -93,7 +93,7 @@ class Messenger : public base::NonThreadSafe, // A timer to fire when we can send data. base::OneShotTimer<Messenger> send_timer_; - CompletionCallbackImpl<Messenger> send_message_callback_; + OldCompletionCallbackImpl<Messenger> send_message_callback_; ScopedRunnableMethodFactory<Messenger> factory_; DISALLOW_COPY_AND_ASSIGN(Messenger); diff --git a/net/curvecp/packetizer.h b/net/curvecp/packetizer.h index cca680b..14b526a 100644 --- a/net/curvecp/packetizer.h +++ b/net/curvecp/packetizer.h @@ -34,7 +34,7 @@ class Packetizer { virtual int SendMessage(ConnectionKey key, const char* data, size_t length, - CompletionCallback* callback) = 0; + OldCompletionCallback* callback) = 0; // Close an existing connection. virtual void Close(ConnectionKey key) = 0; diff --git a/net/curvecp/server_packetizer.cc b/net/curvecp/server_packetizer.cc index 4715a3b..d5d9d67 100644 --- a/net/curvecp/server_packetizer.cc +++ b/net/curvecp/server_packetizer.cc @@ -46,7 +46,7 @@ bool ServerPacketizer::Open(ConnectionKey key, Packetizer::Listener* listener) { int ServerPacketizer::SendMessage(ConnectionKey key, const char* data, size_t length, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(socket_.get()); DCHECK_LT(0u, length); DCHECK_GT(kMaxPacketLength - sizeof(ServerMessagePacket), length); diff --git a/net/curvecp/server_packetizer.h b/net/curvecp/server_packetizer.h index 2fa60c7..68a91c0 100644 --- a/net/curvecp/server_packetizer.h +++ b/net/curvecp/server_packetizer.h @@ -37,7 +37,7 @@ class ServerPacketizer : public base::RefCounted<ServerPacketizer>, virtual int SendMessage(ConnectionKey key, const char* data, size_t length, - CompletionCallback* callback); + OldCompletionCallback* callback); virtual void Close(ConnectionKey key); virtual int GetPeerAddress(IPEndPoint* endpoint) const; virtual int max_message_payload() const; @@ -86,8 +86,8 @@ class ServerPacketizer : public base::RefCounted<ServerPacketizer>, // The listener map tracks active message listeners known to the packetizer. ListenerMap listener_map_; - CompletionCallbackImpl<ServerPacketizer> read_callback_; - CompletionCallbackImpl<ServerPacketizer> write_callback_; + OldCompletionCallbackImpl<ServerPacketizer> read_callback_; + OldCompletionCallbackImpl<ServerPacketizer> write_callback_; DISALLOW_COPY_AND_ASSIGN(ServerPacketizer); }; diff --git a/net/curvecp/test_client.cc b/net/curvecp/test_client.cc index 9eced0d..abf5957 100644 --- a/net/curvecp/test_client.cc +++ b/net/curvecp/test_client.cc @@ -45,7 +45,7 @@ TestClient::~TestClient() { bool TestClient::Start(const HostPortPair& server_host_port_pair, int bytes_to_send, - CompletionCallback* callback) { + OldCompletionCallback* callback) { DCHECK(!socket_); DCHECK(!finished_callback_); @@ -171,7 +171,7 @@ void TestClient::Finish(int result) { DCHECK(finished_callback_); LOG(ERROR) << "TestClient Done!"; - CompletionCallback* callback = finished_callback_; + OldCompletionCallback* callback = finished_callback_; finished_callback_ = NULL; callback->Run(result); } diff --git a/net/curvecp/test_client.h b/net/curvecp/test_client.h index e992ce8..59a3d59 100644 --- a/net/curvecp/test_client.h +++ b/net/curvecp/test_client.h @@ -35,7 +35,7 @@ class TestClient { // Returns true if successful in starting the client. bool Start(const HostPortPair& server, int bytes_to_send, - CompletionCallback* callback); + OldCompletionCallback* callback); // Returns the number of errors this server encountered. int error_count() { return errors_; } @@ -59,10 +59,10 @@ class TestClient { int bytes_to_send_; TestDataStream sent_stream_; TestDataStream received_stream_; - CompletionCallbackImpl<TestClient> connect_callback_; - CompletionCallbackImpl<TestClient> read_callback_; - CompletionCallbackImpl<TestClient> write_callback_; - CompletionCallback* finished_callback_; + OldCompletionCallbackImpl<TestClient> connect_callback_; + OldCompletionCallbackImpl<TestClient> read_callback_; + OldCompletionCallbackImpl<TestClient> write_callback_; + OldCompletionCallback* finished_callback_; }; } // namespace net diff --git a/net/curvecp/test_server.h b/net/curvecp/test_server.h index a941401..3ece594 100644 --- a/net/curvecp/test_server.h +++ b/net/curvecp/test_server.h @@ -19,7 +19,7 @@ class IOBuffer; // TestServer is the server which processes the listen socket. // It will create an EchoServer instance to handle each connection. -class TestServer : public CompletionCallback, +class TestServer : public OldCompletionCallback, public CurveCPServerSocket::Acceptor { public: TestServer(); @@ -27,7 +27,7 @@ class TestServer : public CompletionCallback, bool Start(int port); - // CompletionCallback methods: + // OldCompletionCallback methods: virtual void RunWithParams(const Tuple1<int>& params); // CurveCPServerSocket::Acceptor methods: @@ -65,8 +65,8 @@ class EchoServer { scoped_refptr<DrainableIOBuffer> write_buffer_; TestDataStream received_stream_; int bytes_received_; - CompletionCallbackImpl<EchoServer> read_callback_; - CompletionCallbackImpl<EchoServer> write_callback_; + OldCompletionCallbackImpl<EchoServer> read_callback_; + OldCompletionCallbackImpl<EchoServer> write_callback_; }; } // namespace net |