Commit 29f298c7 authored by Sigurdur Asgeirsson's avatar Sigurdur Asgeirsson Committed by Commit Bot

Retire ScopedObserver in /components/history/core/browser/sync.

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=tschumann@chromium.org

Bug: 1145565
Change-Id: Iecd38a26630d7a6565455c42942b4b61144f1d2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532719
Auto-Submit: Sigurður Ásgeirsson <siggi@chromium.org>
Reviewed-by: default avatarTim Schumann <tschumann@chromium.org>
Commit-Queue: Tim Schumann <tschumann@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826716}
parent a733d09f
......@@ -436,7 +436,7 @@ void TypedURLSyncBridge::OnURLsDeleted(HistoryBackend* history_backend,
void TypedURLSyncBridge::Init() {
DCHECK(sequence_checker_.CalledOnValidSequence());
history_backend_observer_.Add(history_backend_);
history_backend_observation_.Observe(history_backend_);
LoadMetadata();
}
......
......@@ -12,7 +12,7 @@
#include <utility>
#include <vector>
#include "base/scoped_observer.h"
#include "base/scoped_observation.h"
#include "components/history/core/browser/history_backend.h"
#include "components/history/core/browser/history_backend_observer.h"
#include "components/history/core/browser/sync/typed_url_sync_metadata_database.h"
......@@ -247,8 +247,8 @@ class TypedURLSyncBridge : public syncer::ModelTypeSyncBridge,
// Tracks observed history backend, for receiving updates from history
// backend.
ScopedObserver<HistoryBackend, HistoryBackendObserver>
history_backend_observer_{this};
base::ScopedObservation<HistoryBackend, HistoryBackendObserver>
history_backend_observation_{this};
DISALLOW_COPY_AND_ASSIGN(TypedURLSyncBridge);
};
......
......@@ -313,7 +313,8 @@ class TypedURLSyncBridgeTest : public testing::Test {
mock_processor_.CreateForwardingProcessor());
typed_url_sync_bridge_ = bridge.get();
typed_url_sync_bridge_->Init();
typed_url_sync_bridge_->history_backend_observer_.RemoveAll();
if (typed_url_sync_bridge_->history_backend_observation_.IsObserving())
typed_url_sync_bridge_->history_backend_observation_.RemoveObservation();
fake_history_backend_->SetTypedURLSyncBridgeForTest(std::move(bridge));
}
......@@ -408,10 +409,12 @@ class TypedURLSyncBridgeTest : public testing::Test {
}
void AddObserver() {
bridge()->history_backend_observer_.Add(fake_history_backend_.get());
bridge()->history_backend_observation_.Observe(fake_history_backend_.get());
}
void RemoveObserver() { bridge()->history_backend_observer_.RemoveAll(); }
void RemoveObserver() {
bridge()->history_backend_observation_.RemoveObservation();
}
// Fills |specifics| with the sync data for |url| and |visits|.
static bool WriteToTypedUrlSpecifics(const URLRow& url,
......
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