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

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
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..7e9f4d007a5bbca77681ba38e508df9b63e37cdd 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"
@@ -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, do_poll_method_factory_.GetWeakPtr()),
+ SamplingIntervalMs());
}
namespace {

Powered by Google App Engine
This is Rietveld 408576698