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

Unified Diff: content/browser/device_orientation/provider_impl.cc

Issue 8556001: Convert NewRunnableFunction/NewRunnableMethod calls to use base::Bind(). (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
« no previous file with comments | « content/browser/device_orientation/provider_impl.h ('k') | content/browser/download/drag_download_file.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/device_orientation/provider_impl.cc
diff --git a/content/browser/device_orientation/provider_impl.cc b/content/browser/device_orientation/provider_impl.cc
index 433e806cb7784b8b9e652ad9c2aecdc53b3d4a35..e60cf2092f446b23d5b6b4cef4babd89ddf4ab28 100644
--- a/content/browser/device_orientation/provider_impl.cc
+++ b/content/browser/device_orientation/provider_impl.cc
@@ -6,9 +6,9 @@
#include <set>
#include <vector>
+#include "base/bind.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/task.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "content/browser/device_orientation/orientation.h"
@@ -18,7 +18,7 @@ namespace device_orientation {
ProviderImpl::ProviderImpl(const DataFetcherFactory factories[])
: creator_loop_(MessageLoop::current()),
- ALLOW_THIS_IN_INITIALIZER_LIST(do_poll_method_factory_(this)) {
+ ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {
for (const DataFetcherFactory* fp = factories; *fp; ++fp)
factories_.push_back(*fp);
}
@@ -98,11 +98,11 @@ void ProviderImpl::DoInitializePollingThread(
void ProviderImpl::ScheduleInitializePollingThread() {
DCHECK(MessageLoop::current() == creator_loop_);
- Task* task = NewRunnableMethod(this,
- &ProviderImpl::DoInitializePollingThread,
- factories_);
MessageLoop* polling_loop = polling_thread_->message_loop();
- polling_loop->PostTask(FROM_HERE, task);
+ polling_loop->PostTask(FROM_HERE,
+ base::Bind(&ProviderImpl::DoInitializePollingThread,
+ this,
+ factories_));
}
void ProviderImpl::DoNotify(const Orientation& orientation) {
@@ -124,8 +124,8 @@ void ProviderImpl::DoNotify(const Orientation& orientation) {
void ProviderImpl::ScheduleDoNotify(const Orientation& orientation) {
DCHECK(MessageLoop::current() == polling_thread_->message_loop());
- Task* task = NewRunnableMethod(this, &ProviderImpl::DoNotify, orientation);
- creator_loop_->PostTask(FROM_HERE, task);
+ creator_loop_->PostTask(
+ FROM_HERE, base::Bind(&ProviderImpl::DoNotify, this, orientation));
}
void ProviderImpl::DoPoll() {
@@ -150,9 +150,11 @@ void ProviderImpl::DoPoll() {
void ProviderImpl::ScheduleDoPoll() {
DCHECK(MessageLoop::current() == polling_thread_->message_loop());
- Task* task = do_poll_method_factory_.NewRunnableMethod(&ProviderImpl::DoPoll);
MessageLoop* polling_loop = polling_thread_->message_loop();
- polling_loop->PostDelayedTask(FROM_HERE, task, SamplingIntervalMs());
+ polling_loop->PostDelayedTask(
+ FROM_HERE,
+ base::Bind(&ProviderImpl::DoPoll, weak_factory_.GetWeakPtr()),
+ SamplingIntervalMs());
}
namespace {
« no previous file with comments | « content/browser/device_orientation/provider_impl.h ('k') | content/browser/download/drag_download_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698