Commit 62c48de9 authored by Sigurdur Asgeirsson's avatar Sigurdur Asgeirsson Committed by Commit Bot

Retire ScopedObserver in /components/suggestions.

ScopedObserver is being deprecated in favor of two new classes:
- base::ScopedObservation for observers that only ever observe
  a single source.
- base::ScopedMultiSourceObservation for observers that do or may
  observe more than a single source.

This CL was uploaded by git cl split.

R=mathp@chromium.org

Bug: 1145565
Change-Id: Ia01c31b800dbb549e6b7daf7636b055c7f559111
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532958
Auto-Submit: Sigurður Ásgeirsson <siggi@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Sigurður Ásgeirsson <siggi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827810}
parent 30a9c2c3
......@@ -121,7 +121,7 @@ SuggestionsServiceImpl::SuggestionsServiceImpl(
blocklist_upload_timer_(tick_clock_) {
// |sync_service_| is null if switches::kDisableSync is set (tests use that).
if (sync_service_)
sync_service_observer_.Add(sync_service_);
sync_service_observation_.Observe(sync_service_);
// Immediately get the current sync state, so we'll flush the cache if
// necessary.
OnStateChanged(sync_service_);
......@@ -522,7 +522,8 @@ void SuggestionsServiceImpl::Shutdown() {
// Cancel pending request.
pending_request_.reset(nullptr);
sync_service_observer_.RemoveAll();
if (sync_service_observation_.IsObserving())
sync_service_observation_.RemoveObservation();
}
void SuggestionsServiceImpl::ScheduleBlocklistUpload() {
......
......@@ -16,7 +16,7 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "base/scoped_observer.h"
#include "base/scoped_observation.h"
#include "base/threading/thread_checker.h"
#include "base/time/tick_clock.h"
#include "base/time/time.h"
......@@ -174,8 +174,8 @@ class SuggestionsServiceImpl : public SuggestionsService,
signin::IdentityManager* identity_manager_;
syncer::SyncService* sync_service_;
ScopedObserver<syncer::SyncService, syncer::SyncServiceObserver>
sync_service_observer_{this};
base::ScopedObservation<syncer::SyncService, syncer::SyncServiceObserver>
sync_service_observation_{this};
// The state of history sync, i.e. are we uploading history data to Google?
syncer::UploadState history_sync_state_;
......
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