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

Unified Diff: base/prefs/pref_member.cc

Issue 1100773004: base: Remove most uses of MessageLoopProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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: base/prefs/pref_member.cc
diff --git a/base/prefs/pref_member.cc b/base/prefs/pref_member.cc
index 8d80dd0049b3dc3f47c19c44fdff8ee18895623c..50f683f1731af5d52f458afa8e1a64d678c70a59 100644
--- a/base/prefs/pref_member.cc
+++ b/base/prefs/pref_member.cc
@@ -7,11 +7,10 @@
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/location.h"
-#include "base/message_loop/message_loop_proxy.h"
#include "base/prefs/pref_service.h"
+#include "base/thread_task_runner_handle.h"
#include "base/value_conversions.h"
-using base::MessageLoopProxy;
using base::SingleThreadTaskRunner;
namespace subtle {
@@ -91,15 +90,14 @@ void PrefMemberBase::InvokeUnnamedCallback(const base::Closure& callback,
}
PrefMemberBase::Internal::Internal()
- : thread_loop_(MessageLoopProxy::current()),
+ : thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
is_managed_(false),
is_user_modifiable_(false) {
}
PrefMemberBase::Internal::~Internal() { }
bool PrefMemberBase::Internal::IsOnCorrectThread() const {
- // In unit tests, there may not be a message loop.
- return thread_loop_.get() == NULL || thread_loop_->BelongsToCurrentThread();
+ return thread_task_runner_->BelongsToCurrentThread();
}
void PrefMemberBase::Internal::UpdateValue(
@@ -115,11 +113,10 @@ void PrefMemberBase::Internal::UpdateValue(
is_managed_ = is_managed;
is_user_modifiable_ = is_user_modifiable;
} else {
- bool may_run = thread_loop_->PostTask(
- FROM_HERE,
- base::Bind(&PrefMemberBase::Internal::UpdateValue, this,
- value.release(), is_managed, is_user_modifiable,
- closure_runner.Release()));
+ bool may_run = thread_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&PrefMemberBase::Internal::UpdateValue, this,
+ value.release(), is_managed, is_user_modifiable,
+ closure_runner.Release()));
DCHECK(may_run);
}
}
@@ -127,7 +124,7 @@ void PrefMemberBase::Internal::UpdateValue(
void PrefMemberBase::Internal::MoveToThread(
const scoped_refptr<SingleThreadTaskRunner>& task_runner) {
CheckOnCorrectThread();
- thread_loop_ = task_runner;
+ thread_task_runner_ = task_runner;
danakj 2015/04/21 20:16:30 nit: pass it by value to the method and .Pass() it
Sami 2015/04/23 17:48:24 Done.
}
bool PrefMemberVectorStringUpdate(const base::Value& value,

Powered by Google App Engine
This is Rietveld 408576698