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

Unified Diff: chrome/browser/net/network_stats.cc

Issue 8589012: base::Bind fixes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
Index: chrome/browser/net/network_stats.cc
diff --git a/chrome/browser/net/network_stats.cc b/chrome/browser/net/network_stats.cc
index 210bc15a847aea7606cfdf67955d7c1823cfd1da..77ec79c48870c08aeab4fd9fe649bf1e66c59fb0 100644
--- a/chrome/browser/net/network_stats.cc
+++ b/chrome/browser/net/network_stats.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/net/network_stats.h"
+#include "base/bind.h"
#include "base/callback_old.h"
#include "base/logging.h"
#include "base/message_loop.h"
@@ -89,7 +90,7 @@ NetworkStats::NetworkStats()
write_callback_(this, &NetworkStats::OnWriteComplete)),
finished_callback_(NULL),
start_time_(base::TimeTicks::Now()),
- ALLOW_THIS_IN_INITIALIZER_LIST(timers_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
}
NetworkStats::~NetworkStats() {
@@ -207,7 +208,7 @@ void NetworkStats::OnReadComplete(int result) {
const int kReadDataDelayMs = 1;
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
- timers_factory_.NewRunnableMethod(&NetworkStats::ReadData),
+ base::Bind(&NetworkStats::ReadData, weak_factory_.GetWeakPtr()),
kReadDataDelayMs);
}
}
@@ -283,7 +284,7 @@ int NetworkStats::SendData() {
void NetworkStats::StartReadDataTimer(int milliseconds) {
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
- timers_factory_.NewRunnableMethod(&NetworkStats::OnReadDataTimeout),
+ base::Bind(&NetworkStats::OnReadDataTimeout, weak_factory_.GetWeakPtr()),
milliseconds);
}
@@ -530,7 +531,7 @@ void CollectNetworkStats(const std::string& network_stats_server,
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- NewRunnableFunction(
+ base::Bind(
&CollectNetworkStats, network_stats_server, io_thread));
return;
}

Powered by Google App Engine
This is Rietveld 408576698