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

Unified Diff: net/curvecp/client_packetizer.cc

Issue 8734017: base::Bind: More random cleanups. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mac build fix 2. Created 9 years, 1 month 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 | « net/curvecp/client_packetizer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/curvecp/client_packetizer.cc
diff --git a/net/curvecp/client_packetizer.cc b/net/curvecp/client_packetizer.cc
index 2d96b1f38412ba5fa361438f4f31f6aa4eba8b60..72bf4a0e8b4e625d53fa7bd1dcab786448f5e1a5 100644
--- a/net/curvecp/client_packetizer.cc
+++ b/net/curvecp/client_packetizer.cc
@@ -4,6 +4,7 @@
#include "net/curvecp/client_packetizer.h"
+#include "base/bind.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/sys_addrinfo.h"
@@ -38,7 +39,7 @@ ClientPacketizer::ClientPacketizer()
initiate_sent_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(
io_callback_(this, &ClientPacketizer::OnIOComplete)),
- ALLOW_THIS_IN_INITIALIZER_LIST(timers_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
// TODO(mbelshe): Initialize our keys and such properly.
// for now we use random values to keep them unique.
for (int i = 0; i < 32; ++i)
@@ -315,12 +316,12 @@ int ClientPacketizer::ConnectNextAddress() {
void ClientPacketizer::StartHelloTimer(int milliseconds) {
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
- timers_factory_.NewRunnableMethod(&ClientPacketizer::OnHelloTimeout),
+ base::Bind(&ClientPacketizer::OnHelloTimeout, weak_factory_.GetWeakPtr()),
milliseconds);
}
void ClientPacketizer::RevokeHelloTimer() {
- timers_factory_.RevokeAll();
+ weak_factory_.InvalidateWeakPtrs();
}
void ClientPacketizer::OnHelloTimeout() {
« no previous file with comments | « net/curvecp/client_packetizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698