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

Unified Diff: content/public/browser/notification_registrar.cc

Issue 2909053003: Replace deprecated base::NonThreadSafe in content in favor of SequenceChecker. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « content/public/browser/notification_registrar.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/notification_registrar.cc
diff --git a/content/public/browser/notification_registrar.cc b/content/public/browser/notification_registrar.cc
index 21a2167975c03c6ac910363639e949de305ff5b6..189008957cb988b63d1930d04c33cd830b94fe82 100644
--- a/content/public/browser/notification_registrar.cc
+++ b/content/public/browser/notification_registrar.cc
@@ -36,17 +36,18 @@ NotificationRegistrar::NotificationRegistrar() {
NotificationServiceImpl::current();
// It is OK to create a NotificationRegistrar instance on one thread and then
// use it (exclusively) on another, so we detach from the initial thread.
- DetachFromThread();
+ DETACH_FROM_SEQUENCE(sequence_checker_);
}
NotificationRegistrar::~NotificationRegistrar() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
RemoveAll();
}
void NotificationRegistrar::Add(NotificationObserver* observer,
int type,
const NotificationSource& source) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!IsRegistered(observer, type, source)) << "Duplicate registration.";
Record record = { observer, type, source };
@@ -58,7 +59,7 @@ void NotificationRegistrar::Add(NotificationObserver* observer,
void NotificationRegistrar::Remove(NotificationObserver* observer,
int type,
const NotificationSource& source) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
Record record = { observer, type, source };
RecordVector::iterator found = std::find(
@@ -75,7 +76,7 @@ void NotificationRegistrar::Remove(NotificationObserver* observer,
}
void NotificationRegistrar::RemoveAll() {
- CHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Early-exit if no registrations, to avoid calling
// NotificationService::current. If we've constructed an object with a
// NotificationRegistrar member, but haven't actually used the notification
@@ -99,14 +100,14 @@ void NotificationRegistrar::RemoveAll() {
}
bool NotificationRegistrar::IsEmpty() const {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
return registered_.empty();
}
bool NotificationRegistrar::IsRegistered(NotificationObserver* observer,
int type,
const NotificationSource& source) {
- DCHECK(CalledOnValidThread());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
Record record = { observer, type, source };
return std::find(registered_.begin(), registered_.end(), record) !=
registered_.end();
« no previous file with comments | « content/public/browser/notification_registrar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698