| 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();
|
|
|