Chromium Code Reviews| Index: base/prefs/pref_member.h |
| diff --git a/base/prefs/pref_member.h b/base/prefs/pref_member.h |
| index 17f5b447eb4a6f3a1f58985b6e7be0b7dc718c5c..4d4540a904fc178b913ee0f6522851a0d391033c 100644 |
| --- a/base/prefs/pref_member.h |
| +++ b/base/prefs/pref_member.h |
| @@ -33,9 +33,9 @@ |
| #include "base/files/file_path.h" |
| #include "base/logging.h" |
| #include "base/memory/ref_counted.h" |
| -#include "base/message_loop/message_loop_proxy.h" |
| #include "base/prefs/base_prefs_export.h" |
| #include "base/prefs/pref_observer.h" |
| +#include "base/sequenced_task_runner.h" |
| #include "base/values.h" |
| class PrefService; |
| @@ -65,8 +65,8 @@ class BASE_PREFS_EXPORT PrefMemberBase : public PrefObserver { |
| bool is_user_modifiable, |
| const base::Closure& callback) const; |
| - void MoveToThread( |
| - const scoped_refptr<base::MessageLoopProxy>& message_loop); |
| + void MoveToTaskRunner( |
|
darin (slow to review)
2014/07/10 22:12:05
Hmm, MoveToThread seems like a better name. The co
Ryan Sleevi
2014/07/10 22:46:37
Correct, but with the caveat explained (below) tha
|
| + const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
|
darin (slow to review)
2014/07/10 22:12:05
shouldn't this be a SingleThreadTaskRunner given t
Ryan Sleevi
2014/07/10 22:46:37
This is not actually coupled to a particular threa
|
| // See PrefMember<> for description. |
| bool IsManaged() const { |
| @@ -92,7 +92,7 @@ class BASE_PREFS_EXPORT PrefMemberBase : public PrefObserver { |
| bool IsOnCorrectThread() const; |
| - scoped_refptr<base::MessageLoopProxy> thread_loop_; |
| + scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| mutable bool is_managed_; |
| mutable bool is_user_modifiable_; |
| @@ -112,7 +112,8 @@ class BASE_PREFS_EXPORT PrefMemberBase : public PrefObserver { |
| // See PrefMember<> for description. |
| void Destroy(); |
| - void MoveToThread(const scoped_refptr<base::MessageLoopProxy>& message_loop); |
| + void MoveToTaskRunner( |
| + const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
| // PrefObserver |
| virtual void OnPreferenceChanged(PrefService* service, |
| @@ -184,7 +185,7 @@ class PrefMember : public subtle::PrefMemberBase { |
| // Unsubscribes the PrefMember from the PrefService. After calling this |
| // function, the PrefMember may not be used any more on the UI thread. |
| - // Assuming |MoveToThread| was previously called, |GetValue|, |IsManaged|, |
| + // Assuming |MoveToTaskRunner| was previously called, |GetValue|, |IsManaged|, |
| // and |IsUserModifiable| can still be called from the other thread but |
| // the results will no longer update from the PrefService. |
| // This method should only be called on the UI thread. |
| @@ -197,15 +198,16 @@ class PrefMember : public subtle::PrefMemberBase { |
| // via PostTask. |
| // This method should only be used from the thread the PrefMember is currently |
| // on, which is the UI thread by default. |
| - void MoveToThread(const scoped_refptr<base::MessageLoopProxy>& message_loop) { |
| - subtle::PrefMemberBase::MoveToThread(message_loop); |
| + void MoveToTaskRunner( |
| + const scoped_refptr<base::SequencedTaskRunner>& task_runner) { |
| + subtle::PrefMemberBase::MoveToTaskRunner(task_runner); |
| } |
| // Check whether the pref is managed, i.e. controlled externally through |
| // enterprise configuration management (e.g. windows group policy). Returns |
| // false for unknown prefs. |
| // This method should only be used from the thread the PrefMember is currently |
| - // on, which is the UI thread unless changed by |MoveToThread|. |
| + // on, which is the UI thread unless changed by |MoveToTaskRunner|. |
| bool IsManaged() const { |
| VerifyPref(); |
| return internal_->IsManaged(); |
| @@ -215,7 +217,7 @@ class PrefMember : public subtle::PrefMemberBase { |
| // when the pref is managed by a policy or an extension, and when a command |
| // line flag overrides the pref. |
| // This method should only be used from the thread the PrefMember is currently |
| - // on, which is the UI thread unless changed by |MoveToThread|. |
| + // on, which is the UI thread unless changed by |MoveToTaskRunner|. |
| bool IsUserModifiable() const { |
| VerifyPref(); |
| return internal_->IsUserModifiable(); |
| @@ -223,7 +225,7 @@ class PrefMember : public subtle::PrefMemberBase { |
| // Retrieve the value of the member variable. |
| // This method should only be used from the thread the PrefMember is currently |
| - // on, which is the UI thread unless changed by |MoveToThread|. |
| + // on, which is the UI thread unless changed by |MoveToTaskRunner|. |
| ValueType GetValue() const { |
| VerifyPref(); |
| return internal_->value(); |