summaryrefslogtreecommitdiffstats
path: root/chrome/browser/io_thread.cc
diff options
context:
space:
mode:
authordcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-21 02:17:53 +0000
committerdcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-21 02:17:53 +0000
commit21ee224e0862f56ce9d88f2c91950a40cfae6aa0 (patch)
tree76155edd9268f689a5e6dfa4da2b529db0a95b41 /chrome/browser/io_thread.cc
parent40d347eadcce30d0528eb53b16ef3f62026075d6 (diff)
downloadchromium_src-21ee224e0862f56ce9d88f2c91950a40cfae6aa0.zip
chromium_src-21ee224e0862f56ce9d88f2c91950a40cfae6aa0.tar.gz
chromium_src-21ee224e0862f56ce9d88f2c91950a40cfae6aa0.tar.bz2
base::Bind() conversion for IOThread.
BUG=none TEST=trybots Review URL: http://codereview.chromium.org/8473009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110874 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/io_thread.cc')
-rw-r--r--chrome/browser/io_thread.cc23
1 files changed, 11 insertions, 12 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index c86f21e..18d1d2b 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -7,6 +7,8 @@
#include <vector>
#include "base/command_line.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
#include "base/debug/leak_tracker.h"
#include "base/logging.h"
#include "base/metrics/field_trial.h"
@@ -68,6 +70,9 @@
using content::BrowserThread;
+// The IOThread object must outlive any tasks posted to the IO thread before the
+// Quit task, so base::Bind() calls are not refcounted.
+
namespace {
// Custom URLRequestContext used by requests which aren't associated with a
@@ -328,10 +333,6 @@ SystemURLRequestContextGetter::GetIOMessageLoopProxy() const {
return io_message_loop_proxy_;
}
-// The IOThread object must outlive any tasks posted to the IO thread before the
-// Quit task.
-DISABLE_RUNNABLE_METHOD_REFCOUNT(IOThread);
-
IOThread::Globals::Globals() {}
IOThread::Globals::~Globals() {}
@@ -351,7 +352,7 @@ IOThread::IOThread(
extension_event_router_forwarder_(extension_event_router_forwarder),
globals_(NULL),
sdch_manager_(NULL),
- ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
// We call RegisterPrefs() here (instead of inside browser_prefs.cc) to make
// sure that everything is initialized in the right order.
RegisterPrefs(local_state);
@@ -370,9 +371,9 @@ IOThread::IOThread(
local_state);
ssl_config_service_manager_.reset(
SSLConfigServiceManager::CreateDefaultManager(local_state));
- MessageLoop::current()->PostTask(FROM_HERE,
- method_factory_.NewRunnableMethod(
- &IOThread::InitSystemRequestContext));
+ MessageLoop::current()->PostTask(
+ FROM_HERE, base::Bind(&IOThread::InitSystemRequestContext,
+ weak_factory_.GetWeakPtr()));
}
IOThread::~IOThread() {
@@ -593,10 +594,8 @@ void IOThread::InitSystemRequestContext() {
system_url_request_context_getter_ =
new SystemURLRequestContextGetter(this);
message_loop()->PostTask(
- FROM_HERE,
- NewRunnableMethod(
- this,
- &IOThread::InitSystemRequestContextOnIOThread));
+ FROM_HERE, base::Bind(&IOThread::InitSystemRequestContextOnIOThread,
+ base::Unretained(this)));
}
void IOThread::InitSystemRequestContextOnIOThread() {