summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-25 21:11:36 +0000
committerrsleevi@chromium.org <rsleevi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-25 21:11:36 +0000
commit327e52b1a5e90c2af0b9c4e6ecb146d4510f7398 (patch)
treed8532f5934b28f7ef02e379cedb3d9397586cbc1
parent5f84a0ac03cbb9cab45e2b8fdd8c105c7fd69bbc (diff)
downloadchromium_src-327e52b1a5e90c2af0b9c4e6ecb146d4510f7398.zip
chromium_src-327e52b1a5e90c2af0b9c4e6ecb146d4510f7398.tar.gz
chromium_src-327e52b1a5e90c2af0b9c4e6ecb146d4510f7398.tar.bz2
Use base::ThreadChecker as a member var, rather than base::NonThreadSafe
BUG=123295 TEST=existing Review URL: https://chromiumcodereview.appspot.com/10663016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144011 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/invalidations/invalidator_storage.cc8
-rw-r--r--chrome/browser/sync/invalidations/invalidator_storage.h4
-rw-r--r--ipc/ipc_channel_win.cc4
-rw-r--r--ipc/ipc_channel_win.h4
-rw-r--r--jingle/notifier/listener/non_blocking_push_client.cc18
-rw-r--r--jingle/notifier/listener/non_blocking_push_client.h4
-rw-r--r--jingle/notifier/listener/xmpp_push_client.cc24
-rw-r--r--jingle/notifier/listener/xmpp_push_client.h4
-rw-r--r--sync/notifier/p2p_notifier.cc26
-rw-r--r--sync/notifier/p2p_notifier.h4
10 files changed, 50 insertions, 50 deletions
diff --git a/chrome/browser/sync/invalidations/invalidator_storage.cc b/chrome/browser/sync/invalidations/invalidator_storage.cc
index 4ca9f2d..533fb8f 100644
--- a/chrome/browser/sync/invalidations/invalidator_storage.cc
+++ b/chrome/browser/sync/invalidations/invalidator_storage.cc
@@ -86,7 +86,7 @@ InvalidatorStorage::~InvalidatorStorage() {
}
InvalidationVersionMap InvalidatorStorage::GetAllMaxVersions() const {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
InvalidationVersionMap max_versions;
if (!pref_service_) {
return max_versions;
@@ -100,7 +100,7 @@ InvalidationVersionMap InvalidatorStorage::GetAllMaxVersions() const {
void InvalidatorStorage::SetMaxVersion(const invalidation::ObjectId& id,
int64 max_version) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
CHECK(pref_service_);
InvalidationVersionMap max_versions = GetAllMaxVersions();
InvalidationVersionMap::iterator it = max_versions.find(id);
@@ -220,7 +220,7 @@ std::string InvalidatorStorage::GetInvalidationState() const {
}
void InvalidatorStorage::SetInvalidationState(const std::string& state) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
std::string utf8_state;
base::Base64Encode(state, &utf8_state);
pref_service_->SetString(prefs::kInvalidatorInvalidationState,
@@ -228,7 +228,7 @@ void InvalidatorStorage::SetInvalidationState(const std::string& state) {
}
void InvalidatorStorage::Clear() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
pref_service_->ClearPref(prefs::kInvalidatorMaxInvalidationVersions);
pref_service_->ClearPref(prefs::kInvalidatorInvalidationState);
}
diff --git a/chrome/browser/sync/invalidations/invalidator_storage.h b/chrome/browser/sync/invalidations/invalidator_storage.h
index af06ea2..f11a38a 100644
--- a/chrome/browser/sync/invalidations/invalidator_storage.h
+++ b/chrome/browser/sync/invalidations/invalidator_storage.h
@@ -12,7 +12,7 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/memory/weak_ptr.h"
-#include "base/threading/non_thread_safe.h"
+#include "base/threading/thread_checker.h"
#include "sync/notifier/invalidation_state_tracker.h"
class PrefService;
@@ -67,7 +67,7 @@ class InvalidatorStorage : public base::SupportsWeakPtr<InvalidatorStorage>,
FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeMapBasic);
FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, MigrateLegacyPreferences);
- base::NonThreadSafe non_thread_safe_;
+ base::ThreadChecker thread_checker_;
// Helpers to convert between InvalidationVersionMap <--> ListValue.
static void DeserializeFromList(
diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc
index 981e4b6..c4098f0 100644
--- a/ipc/ipc_channel_win.cc
+++ b/ipc/ipc_channel_win.cc
@@ -13,7 +13,7 @@
#include "base/process_util.h"
#include "base/rand_util.h"
#include "base/string_number_conversions.h"
-#include "base/threading/non_thread_safe.h"
+#include "base/threading/thread_checker.h"
#include "base/utf_string_conversions.h"
#include "base/win/scoped_handle.h"
#include "ipc/ipc_logging.h"
@@ -279,7 +279,7 @@ bool Channel::ChannelImpl::Connect() {
DLOG_IF(WARNING, thread_check_.get()) << "Connect called more than once";
if (!thread_check_.get())
- thread_check_.reset(new base::NonThreadSafe());
+ thread_check_.reset(new base::ThreadChecker());
if (pipe_ == INVALID_HANDLE_VALUE)
return false;
diff --git a/ipc/ipc_channel_win.h b/ipc/ipc_channel_win.h
index cb37f33..e8302fe 100644
--- a/ipc/ipc_channel_win.h
+++ b/ipc/ipc_channel_win.h
@@ -17,7 +17,7 @@
#include "ipc/ipc_channel_reader.h"
namespace base {
-class NonThreadSafe;
+class ThreadChecker;
}
namespace IPC {
@@ -95,7 +95,7 @@ class Channel::ChannelImpl : public internal::ChannelReader,
base::WeakPtrFactory<ChannelImpl> weak_factory_;
- scoped_ptr<base::NonThreadSafe> thread_check_;
+ scoped_ptr<base::ThreadChecker> thread_check_;
DISALLOW_COPY_AND_ASSIGN(ChannelImpl);
};
diff --git a/jingle/notifier/listener/non_blocking_push_client.cc b/jingle/notifier/listener/non_blocking_push_client.cc
index 57ec240..5765d37 100644
--- a/jingle/notifier/listener/non_blocking_push_client.cc
+++ b/jingle/notifier/listener/non_blocking_push_client.cc
@@ -151,7 +151,7 @@ NonBlockingPushClient::NonBlockingPushClient(
}
NonBlockingPushClient::~NonBlockingPushClient() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
delegate_task_runner_->PostTask(
FROM_HERE,
base::Bind(&NonBlockingPushClient::Core::DestroyOnDelegateThread,
@@ -159,18 +159,18 @@ NonBlockingPushClient::~NonBlockingPushClient() {
}
void NonBlockingPushClient::AddObserver(PushClientObserver* observer) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
observers_.AddObserver(observer);
}
void NonBlockingPushClient::RemoveObserver(PushClientObserver* observer) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
observers_.RemoveObserver(observer);
}
void NonBlockingPushClient::UpdateSubscriptions(
const SubscriptionList& subscriptions) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
delegate_task_runner_->PostTask(
FROM_HERE,
base::Bind(&NonBlockingPushClient::Core::UpdateSubscriptions,
@@ -179,7 +179,7 @@ void NonBlockingPushClient::UpdateSubscriptions(
void NonBlockingPushClient::UpdateCredentials(
const std::string& email, const std::string& token) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
delegate_task_runner_->PostTask(
FROM_HERE,
base::Bind(&NonBlockingPushClient::Core::UpdateCredentials,
@@ -188,7 +188,7 @@ void NonBlockingPushClient::UpdateCredentials(
void NonBlockingPushClient::SendNotification(
const Notification& notification) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
delegate_task_runner_->PostTask(
FROM_HERE,
base::Bind(&NonBlockingPushClient::Core::SendNotification, core_.get(),
@@ -196,21 +196,21 @@ void NonBlockingPushClient::SendNotification(
}
void NonBlockingPushClient::OnNotificationsEnabled() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
FOR_EACH_OBSERVER(PushClientObserver, observers_,
OnNotificationsEnabled());
}
void NonBlockingPushClient::OnNotificationsDisabled(
NotificationsDisabledReason reason) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
FOR_EACH_OBSERVER(PushClientObserver, observers_,
OnNotificationsDisabled(reason));
}
void NonBlockingPushClient::OnIncomingNotification(
const Notification& notification) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
FOR_EACH_OBSERVER(PushClientObserver, observers_,
OnIncomingNotification(notification));
}
diff --git a/jingle/notifier/listener/non_blocking_push_client.h b/jingle/notifier/listener/non_blocking_push_client.h
index 9205d71..434f5f4 100644
--- a/jingle/notifier/listener/non_blocking_push_client.h
+++ b/jingle/notifier/listener/non_blocking_push_client.h
@@ -12,7 +12,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/threading/non_thread_safe.h"
+#include "base/threading/thread_checker.h"
#include "jingle/notifier/listener/push_client.h"
#include "jingle/notifier/listener/push_client_observer.h"
@@ -57,7 +57,7 @@ class NonBlockingPushClient : public PushClient {
void OnNotificationsDisabled(NotificationsDisabledReason reason);
void OnIncomingNotification(const Notification& notification);
- base::NonThreadSafe non_thread_safe_;
+ base::ThreadChecker thread_checker_;
base::WeakPtrFactory<NonBlockingPushClient> weak_ptr_factory_;
const scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner_;
const scoped_refptr<Core> core_;
diff --git a/jingle/notifier/listener/xmpp_push_client.cc b/jingle/notifier/listener/xmpp_push_client.cc
index 66521f2..9b4811e 100644
--- a/jingle/notifier/listener/xmpp_push_client.cc
+++ b/jingle/notifier/listener/xmpp_push_client.cc
@@ -19,12 +19,12 @@ XmppPushClient::XmppPushClient(const NotifierOptions& notifier_options)
}
XmppPushClient::~XmppPushClient() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
}
void XmppPushClient::OnConnect(
base::WeakPtr<buzz::XmppTaskParentInterface> base_task) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
base_task_ = base_task;
if (!base_task_.get()) {
@@ -59,14 +59,14 @@ void XmppPushClient::OnConnect(
}
void XmppPushClient::OnTransientDisconnection() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
base_task_.reset();
FOR_EACH_OBSERVER(PushClientObserver, observers_,
OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR));
}
void XmppPushClient::OnCredentialsRejected() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
base_task_.reset();
FOR_EACH_OBSERVER(
PushClientObserver, observers_,
@@ -75,42 +75,42 @@ void XmppPushClient::OnCredentialsRejected() {
void XmppPushClient::OnNotificationReceived(
const Notification& notification) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
FOR_EACH_OBSERVER(PushClientObserver, observers_,
OnIncomingNotification(notification));
}
void XmppPushClient::OnSubscribed() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
FOR_EACH_OBSERVER(PushClientObserver, observers_,
OnNotificationsEnabled());
}
void XmppPushClient::OnSubscriptionError() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
FOR_EACH_OBSERVER(PushClientObserver, observers_,
OnNotificationsDisabled(TRANSIENT_NOTIFICATION_ERROR));
}
void XmppPushClient::AddObserver(PushClientObserver* observer) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
observers_.AddObserver(observer);
}
void XmppPushClient::RemoveObserver(PushClientObserver* observer) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
observers_.RemoveObserver(observer);
}
void XmppPushClient::UpdateSubscriptions(
const SubscriptionList& subscriptions) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
subscriptions_ = subscriptions;
}
void XmppPushClient::UpdateCredentials(
const std::string& email, const std::string& token) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
DVLOG(1) << "Push: Updating credentials for " << email;
xmpp_settings_ = MakeXmppClientSettings(notifier_options_, email, token);
if (login_.get()) {
@@ -129,7 +129,7 @@ void XmppPushClient::UpdateCredentials(
}
void XmppPushClient::SendNotification(const Notification& notification) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
if (!base_task_.get()) {
// TODO(akalin): Figure out whether we really need to do this.
DVLOG(1) << "Push: Cannot send notification "
diff --git a/jingle/notifier/listener/xmpp_push_client.h b/jingle/notifier/listener/xmpp_push_client.h
index 34cede5..64725d8 100644
--- a/jingle/notifier/listener/xmpp_push_client.h
+++ b/jingle/notifier/listener/xmpp_push_client.h
@@ -14,7 +14,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/threading/non_thread_safe.h"
+#include "base/threading/thread_checker.h"
#include "jingle/notifier/base/notifier_options.h"
#include "jingle/notifier/communicator/login.h"
#include "jingle/notifier/listener/notification_defines.h"
@@ -65,7 +65,7 @@ class XmppPushClient :
virtual void OnSubscriptionError() OVERRIDE;
private:
- base::NonThreadSafe non_thread_safe_;
+ base::ThreadChecker thread_checker_;
const NotifierOptions notifier_options_;
ObserverList<PushClientObserver> observers_;
diff --git a/sync/notifier/p2p_notifier.cc b/sync/notifier/p2p_notifier.cc
index a9e35aa..548e0f5 100644
--- a/sync/notifier/p2p_notifier.cc
+++ b/sync/notifier/p2p_notifier.cc
@@ -152,33 +152,33 @@ P2PNotifier::P2PNotifier(scoped_ptr<notifier::PushClient> push_client,
}
P2PNotifier::~P2PNotifier() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
push_client_->RemoveObserver(this);
}
void P2PNotifier::AddObserver(SyncNotifierObserver* observer) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
observer_list_.AddObserver(observer);
}
void P2PNotifier::RemoveObserver(SyncNotifierObserver* observer) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
observer_list_.RemoveObserver(observer);
}
void P2PNotifier::SetUniqueId(const std::string& unique_id) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
unique_id_ = unique_id;
}
void P2PNotifier::SetStateDeprecated(const std::string& state) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
// Do nothing.
}
void P2PNotifier::UpdateCredentials(
const std::string& email, const std::string& token) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
notifier::Subscription subscription;
subscription.channel = kSyncP2PNotificationChannel;
// There may be some subtle issues around case sensitivity of the
@@ -195,7 +195,7 @@ void P2PNotifier::UpdateCredentials(
void P2PNotifier::UpdateEnabledTypes(
syncable::ModelTypeSet enabled_types) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
const syncable::ModelTypeSet new_enabled_types =
Difference(enabled_types, enabled_types_);
enabled_types_ = enabled_types;
@@ -206,14 +206,14 @@ void P2PNotifier::UpdateEnabledTypes(
void P2PNotifier::SendNotification(
syncable::ModelTypeSet changed_types) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
const P2PNotificationData notification_data(
unique_id_, send_notification_target_, changed_types);
SendNotificationData(notification_data);
}
void P2PNotifier::OnNotificationsEnabled() {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
bool just_turned_on = (notifications_enabled_ == false);
notifications_enabled_ = true;
FOR_EACH_OBSERVER(
@@ -228,7 +228,7 @@ void P2PNotifier::OnNotificationsEnabled() {
void P2PNotifier::OnNotificationsDisabled(
notifier::NotificationsDisabledReason reason) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
FOR_EACH_OBSERVER(
SyncNotifierObserver, observer_list_,
OnNotificationsDisabled(FromNotifierReason(reason)));
@@ -236,7 +236,7 @@ void P2PNotifier::OnNotificationsDisabled(
void P2PNotifier::OnIncomingNotification(
const notifier::Notification& notification) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
DVLOG(1) << "Received notification " << notification.ToString();
if (!logged_in_) {
DVLOG(1) << "Not logged in yet -- not emitting notification";
@@ -275,13 +275,13 @@ void P2PNotifier::OnIncomingNotification(
void P2PNotifier::SendNotificationDataForTest(
const P2PNotificationData& notification_data) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
SendNotificationData(notification_data);
}
void P2PNotifier::SendNotificationData(
const P2PNotificationData& notification_data) {
- DCHECK(non_thread_safe_.CalledOnValidThread());
+ DCHECK(thread_checker_.CalledOnValidThread());
notifier::Notification notification;
notification.channel = kSyncP2PNotificationChannel;
notification.data = notification_data.ToString();
diff --git a/sync/notifier/p2p_notifier.h b/sync/notifier/p2p_notifier.h
index 52b184b..d449952 100644
--- a/sync/notifier/p2p_notifier.h
+++ b/sync/notifier/p2p_notifier.h
@@ -15,7 +15,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "base/threading/non_thread_safe.h"
+#include "base/threading/thread_checker.h"
#include "jingle/notifier/listener/push_client_observer.h"
#include "sync/internal_api/public/syncable/model_type.h"
#include "sync/notifier/notifications_disabled_reason.h"
@@ -120,7 +120,7 @@ class P2PNotifier
private:
void SendNotificationData(const P2PNotificationData& notification_data);
- base::NonThreadSafe non_thread_safe_;
+ base::ThreadChecker thread_checker_;
ObserverList<SyncNotifierObserver> observer_list_;