Commit 47435535 authored by Nicolas Ouellet-Payeur's avatar Nicolas Ouellet-Payeur Committed by Commit Bot

[Sync] Clean up observers in ConfigurationRefresher

This is needed to enable DestroyProfileOnBrowserClose by default in
automated tests (crrev.com/c/2503629).

ConfigurationRefresher did not clean up its SyncObserver properly when
it received the OnSyncShutdown() event, causing a failed DCHECK() in
browser tests.

Bug: 88586
Change-Id: Ib37846afd26470563d58639e9fddff4928ffe907
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2510797Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Commit-Queue: Nicolas Ouellet-Payeur <nicolaso@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823184}
parent d95cfb37
...@@ -20,3 +20,7 @@ void ConfigurationRefresher::OnSyncConfigurationCompleted( ...@@ -20,3 +20,7 @@ void ConfigurationRefresher::OnSyncConfigurationCompleted(
sync_service->TriggerRefresh(syncer::Intersection( sync_service->TriggerRefresh(syncer::Intersection(
sync_service->GetActiveDataTypes(), syncer::ProtocolTypes())); sync_service->GetActiveDataTypes(), syncer::ProtocolTypes()));
} }
void ConfigurationRefresher::OnSyncShutdown(syncer::SyncService* sync_service) {
scoped_observer_.Remove(sync_service);
}
...@@ -27,6 +27,7 @@ class ConfigurationRefresher : public syncer::SyncServiceObserver { ...@@ -27,6 +27,7 @@ class ConfigurationRefresher : public syncer::SyncServiceObserver {
private: private:
// syncer::SyncServiceObserver implementation. // syncer::SyncServiceObserver implementation.
void OnSyncConfigurationCompleted(syncer::SyncService* sync_service) override; void OnSyncConfigurationCompleted(syncer::SyncService* sync_service) override;
void OnSyncShutdown(syncer::SyncService* sync_service) override;
ScopedObserver<syncer::SyncService, syncer::SyncServiceObserver> ScopedObserver<syncer::SyncService, syncer::SyncServiceObserver>
scoped_observer_{this}; scoped_observer_{this};
......
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