Commit 81451d1b authored by Lowell Manners's avatar Lowell Manners Committed by Commit Bot

Shutdown dependencies in IdentityManager destructor.

Rather than calling IdentityManager::Shutdown explicitly, perform the
Shutdown logic as part of ~IdentityManager(), so we don't need to
remember to call it.

This means that IdentityManager's dependencies will be shutdown later
than they were before this CL, but this shouldn't matter (tm) since the
dependencies are wholly owned by IdentityManager.

Bug: 945385
Change-Id: I061e78f90f9754716a8f537116dd55d2c769589b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1578613
Commit-Queue: Lowell Manners <lowell@chromium.org>
Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#653554}
parent 00281713
......@@ -29,7 +29,3 @@ IdentityManagerWrapper::IdentityManagerWrapper(
std::move(accounts_mutator),
std::move(accounts_cookie_mutator),
std::move(diagnostics_provider)) {}
void IdentityManagerWrapper::Shutdown() {
IdentityManager::Shutdown();
}
......@@ -37,9 +37,6 @@ class IdentityManagerWrapper : public KeyedService,
std::unique_ptr<identity::AccountsMutator> accounts_mutator,
std::unique_ptr<identity::AccountsCookieMutator> accounts_cookie_mutator,
std::unique_ptr<identity::DiagnosticsProvider> diagnostics_provider);
// KeyedService overrides.
void Shutdown() override;
};
#endif // COMPONENTS_SIGNIN_CORE_BROWSER_IDENTITY_MANAGER_WRAPPER_H_
......@@ -69,6 +69,11 @@ IdentityManager::IdentityManager(
}
IdentityManager::~IdentityManager() {
account_fetcher_service_->Shutdown();
gaia_cookie_manager_service_->Shutdown();
token_service_->Shutdown();
account_tracker_service_->Shutdown();
signin_manager_->ClearObserver();
token_service_->RemoveObserver(this);
token_service_->RemoveDiagnosticsObserver(this);
......@@ -410,13 +415,6 @@ void IdentityManager::RemoveDiagnosticsObserver(DiagnosticsObserver* observer) {
diagnostics_observer_list_.RemoveObserver(observer);
}
void IdentityManager::Shutdown() {
account_fetcher_service_->Shutdown();
gaia_cookie_manager_service_->Shutdown();
token_service_->Shutdown();
account_tracker_service_->Shutdown();
}
SigninManagerBase* IdentityManager::GetSigninManager() {
return signin_manager_.get();
}
......
......@@ -474,9 +474,6 @@ class IdentityManager : public SigninManagerBase::Observer,
void AddDiagnosticsObserver(DiagnosticsObserver* observer);
void RemoveDiagnosticsObserver(DiagnosticsObserver* observer);
// Shut down IdentityManager and its owned dependencies.
void Shutdown();
private:
// These test helpers need to use some of the private methods below.
friend CoreAccountInfo SetPrimaryAccount(IdentityManager* identity_manager,
......
......@@ -219,7 +219,6 @@ class IdentityManagerTest : public testing::Test {
}
~IdentityManagerTest() override {
identity_manager_->Shutdown();
signin_client_.Shutdown();
}
......@@ -273,9 +272,6 @@ class IdentityManagerTest : public testing::Test {
// trigger a DCHECK because there are still living observers.
identity_manager_observer_.reset();
identity_manager_diagnostics_observer_.reset();
if (identity_manager_) {
identity_manager_->Shutdown();
}
identity_manager_.reset();
auto token_service =
......
......@@ -253,12 +253,6 @@ IdentityTestEnvironment::~IdentityTestEnvironment() {
// Remove the Observer that IdentityTestEnvironment added during its
// initialization.
identity_manager()->RemoveDiagnosticsObserver(this);
// Call shutdown only if we own the IdentityManager.
// It is the owner's responsibility to call Shutdown.
if (owned_identity_manager_) {
owned_identity_manager_->Shutdown();
}
}
IdentityManager* IdentityTestEnvironment::identity_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