diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-09 18:43:55 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-09 18:43:55 +0000 |
commit | 83039bbf2f2ec0e918f7000b5212d104f60f2bb7 (patch) | |
tree | b22dbd0051b57a437a588772a874271f0d02ffdb /chrome/browser/extensions/api/socket/socket_api_controller.cc | |
parent | e7456a206fe5b50aeb322ebabd6c26adc869a5fd (diff) | |
download | chromium_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 'chrome/browser/extensions/api/socket/socket_api_controller.cc')
-rw-r--r-- | chrome/browser/extensions/api/socket/socket_api_controller.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/chrome/browser/extensions/api/socket/socket_api_controller.cc b/chrome/browser/extensions/api/socket/socket_api_controller.cc index 8758719..30e3a3a 100644 --- a/chrome/browser/extensions/api/socket/socket_api_controller.cc +++ b/chrome/browser/extensions/api/socket/socket_api_controller.cc @@ -40,7 +40,6 @@ class Socket { scoped_ptr<net::UDPClientSocket> udp_client_socket_; bool is_connected_; - net::OldCompletionCallbackImpl<Socket> io_callback_; // A callback required by UDPClientSocket::Write(). void OnIOComplete(int result); @@ -56,9 +55,7 @@ Socket::Socket(const Profile* profile, const std::string& src_extension_id, RandIntCallback(), NULL, NetLog::Source())), - is_connected_(false), - ALLOW_THIS_IN_INITIALIZER_LIST( - io_callback_(this, &Socket::OnIOComplete)) {} + is_connected_(false) {} Socket::~Socket() { if (is_connected_) { @@ -88,9 +85,9 @@ int Socket::Write(const std::string message) { int bytes_sent = 0; while (buffer->BytesRemaining()) { - int rv = udp_client_socket_->Write(buffer, - buffer->BytesRemaining(), - &io_callback_); + int rv = udp_client_socket_->Write( + buffer, buffer->BytesRemaining(), + base::Bind(&Socket::OnIOComplete, base::Unretained(this))); if (rv <= 0) { // We pass all errors, including ERROR_IO_PENDING, back to the caller. return bytes_sent > 0 ? bytes_sent : rv; |