Commit 8d861814 authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Use "checked" ObserverList in //chrome and //ios/chrome IdentityManagerFactory observers

This is a follow up of [1] and [2], where droger asked to move
away from using "unchecked" ObserverLists.

[1] https://crrev.com/c/1448473
[2] https://crrev.com/c/1448754

BUG=927341,927343

Change-Id: I5d91a6af2f51af50eb3a803e908c79c8f1789bc4
Reviewed-on: https://chromium-review.googlesource.com/c/1452818
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629103}
parent b7a48bda
...@@ -22,7 +22,7 @@ class Profile; ...@@ -22,7 +22,7 @@ class Profile;
// Profiles. // Profiles.
class IdentityManagerFactory : public BrowserContextKeyedServiceFactory { class IdentityManagerFactory : public BrowserContextKeyedServiceFactory {
public: public:
class Observer { class Observer : public base::CheckedObserver {
public: public:
// Called when a IdentityManager instance is created. // Called when a IdentityManager instance is created.
virtual void IdentityManagerCreated( virtual void IdentityManagerCreated(
...@@ -34,7 +34,7 @@ class IdentityManagerFactory : public BrowserContextKeyedServiceFactory { ...@@ -34,7 +34,7 @@ class IdentityManagerFactory : public BrowserContextKeyedServiceFactory {
identity::IdentityManager* identity_manager) {} identity::IdentityManager* identity_manager) {}
protected: protected:
virtual ~Observer() {} ~Observer() override {}
}; };
static identity::IdentityManager* GetForProfile(Profile* profile); static identity::IdentityManager* GetForProfile(Profile* profile);
...@@ -70,7 +70,8 @@ class IdentityManagerFactory : public BrowserContextKeyedServiceFactory { ...@@ -70,7 +70,8 @@ class IdentityManagerFactory : public BrowserContextKeyedServiceFactory {
void BrowserContextShutdown(content::BrowserContext* profile) override; void BrowserContextShutdown(content::BrowserContext* profile) override;
// List of observers. Checks that list is empty on destruction. // List of observers. Checks that list is empty on destruction.
base::ObserverList<Observer, true>::Unchecked observer_list_; base::ObserverList<Observer, /*check_empty=*/true, /*allow_reentrancy=*/false>
observer_list_;
DISALLOW_COPY_AND_ASSIGN(IdentityManagerFactory); DISALLOW_COPY_AND_ASSIGN(IdentityManagerFactory);
}; };
......
...@@ -44,7 +44,9 @@ class IdentityManagerFactory : public BrowserStateKeyedServiceFactory { ...@@ -44,7 +44,9 @@ class IdentityManagerFactory : public BrowserStateKeyedServiceFactory {
~IdentityManagerFactory() override; ~IdentityManagerFactory() override;
// List of observers. Checks that list is empty on destruction. // List of observers. Checks that list is empty on destruction.
mutable base::ObserverList<IdentityManagerFactoryObserver, true>::Unchecked base::ObserverList<IdentityManagerFactoryObserver,
/*check_empty=*/true,
/*allow_reentrancy=*/false>
observer_list_; observer_list_;
// BrowserStateKeyedServiceFactory: // BrowserStateKeyedServiceFactory:
......
...@@ -6,16 +6,17 @@ ...@@ -6,16 +6,17 @@
#define IOS_CHROME_BROWSER_SIGNIN_IDENTITY_MANAGER_FACTORY_OBSERVER_H_ #define IOS_CHROME_BROWSER_SIGNIN_IDENTITY_MANAGER_FACTORY_OBSERVER_H_
#include "base/macros.h" #include "base/macros.h"
#include "base/observer_list_types.h"
namespace identity { namespace identity {
class IdentityManager; class IdentityManager;
} }
// Observer for IdentityManagerFactory. // Observer for IdentityManagerFactory.
class IdentityManagerFactoryObserver { class IdentityManagerFactoryObserver : public base::CheckedObserver {
public: public:
IdentityManagerFactoryObserver() {} IdentityManagerFactoryObserver() {}
virtual ~IdentityManagerFactoryObserver() {} ~IdentityManagerFactoryObserver() override {}
// Called when an IdentityManager instance is created. // Called when an IdentityManager instance is created.
virtual void IdentityManagerCreated(identity::IdentityManager* manager) {} virtual void IdentityManagerCreated(identity::IdentityManager* manager) {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment