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

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: rebased 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
« no previous file with comments | « chrome/browser/chromeos/web_socket_proxy.cc ('k') | chrome/browser/net/network_stats.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8758719458442af53305e5f6c9b2019b253a093d..30e3a3ae71f5667cd5c2a812734a5d3476738ef3 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;
« no previous file with comments | « chrome/browser/chromeos/web_socket_proxy.cc ('k') | chrome/browser/net/network_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698