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

Unified Diff: remoting/base/scoped_thread_proxy.cc

Issue 10454018: MessageLoopProxy cleanups in remoting client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months 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: remoting/base/scoped_thread_proxy.cc
diff --git a/remoting/base/scoped_thread_proxy.cc b/remoting/base/scoped_thread_proxy.cc
index d1dcc2618b8a41f8ab99970ce699a235e2422da6..462fe4f3f7702a28e169b48fa4b9da31fd472b37 100644
--- a/remoting/base/scoped_thread_proxy.cc
+++ b/remoting/base/scoped_thread_proxy.cc
@@ -5,20 +5,21 @@
#include "remoting/base/scoped_thread_proxy.h"
#include "base/bind.h"
+#include "base/single_thread_task_runner.h"
namespace remoting {
class ScopedThreadProxy::Core : public base::RefCountedThreadSafe<Core> {
public:
- Core(base::MessageLoopProxy* message_loop)
- : message_loop_(message_loop),
+ Core(base::SingleThreadTaskRunner* task_runner)
+ : task_runner_(task_runner),
canceled_(false) {
}
void PostTask(const tracked_objects::Location& from_here,
const base::Closure& closure) {
if (!canceled_)
- message_loop_->PostTask(from_here, Wrap(closure));
+ task_runner_->PostTask(from_here, Wrap(closure));
}
void PostDelayedTask(
@@ -26,12 +27,12 @@ class ScopedThreadProxy::Core : public base::RefCountedThreadSafe<Core> {
const base::Closure& closure,
int64 delay_ms) {
if (!canceled_) {
- message_loop_->PostDelayedTask(from_here, Wrap(closure), delay_ms);
+ task_runner_->PostDelayedTask(from_here, Wrap(closure), delay_ms);
}
}
void Detach() {
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
canceled_ = true;
}
@@ -47,20 +48,20 @@ class ScopedThreadProxy::Core : public base::RefCountedThreadSafe<Core> {
}
void CallClosure(const base::Closure& closure) {
- DCHECK(message_loop_->BelongsToCurrentThread());
+ DCHECK(task_runner_->BelongsToCurrentThread());
if (!canceled_)
closure.Run();
}
- scoped_refptr<base::MessageLoopProxy> message_loop_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
bool canceled_;
DISALLOW_COPY_AND_ASSIGN(Core);
};
-ScopedThreadProxy::ScopedThreadProxy(base::MessageLoopProxy* message_loop)
- : core_(new Core(message_loop)) {
+ScopedThreadProxy::ScopedThreadProxy(base::SingleThreadTaskRunner* task_runner)
+ : core_(new Core(task_runner)) {
}
ScopedThreadProxy::~ScopedThreadProxy() {

Powered by Google App Engine
This is Rietveld 408576698