Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1986)

Unified Diff: chrome/browser/extensions/api/socket/socket_api_controller.cc

Issue 8824006: Migrate net/socket/socket.h, net/socket/stream_socket.h to base::Bind(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: small win fix Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/socket/socket_api_controller.cc
diff --git a/chrome/browser/extensions/api/socket/socket_api_controller.cc b/chrome/browser/extensions/api/socket/socket_api_controller.cc
index 21952973ef560f3f3809fcf7a86e1cbf79b163db..b141708727300c92dab7fa748eaff00d1118a170 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 {
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;

Powered by Google App Engine
This is Rietveld 408576698