Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Unified Diff: chrome/browser/history/in_memory_history_backend.cc

Issue 573553004: Eliminate NOTIFICATION_HISTORY_LOADED notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ScopedObserver to InMemoryHistoryBackend,PrerenderLocalPredictor,ChromeTemplateURLServiceClient Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/in_memory_history_backend.cc
diff --git a/chrome/browser/history/in_memory_history_backend.cc b/chrome/browser/history/in_memory_history_backend.cc
index b56772764503900c9f7256dbee3d83bd5641bae5..1660e00e90ab8d3996cca80b8745cb4b9fe618f7 100644
--- a/chrome/browser/history/in_memory_history_backend.cc
+++ b/chrome/browser/history/in_memory_history_backend.cc
@@ -23,12 +23,12 @@
namespace history {
InMemoryHistoryBackend::InMemoryHistoryBackend()
- : profile_(nullptr), history_service_(nullptr) {
+ : profile_(nullptr),
+ history_service_observer_(this),
+ history_service_(nullptr) {
}
InMemoryHistoryBackend::~InMemoryHistoryBackend() {
- if (history_service_)
- history_service_->RemoveObserver(this);
}
bool InMemoryHistoryBackend::Init(const base::FilePath& history_filename) {
@@ -44,11 +44,11 @@ void InMemoryHistoryBackend::AttachToHistoryService(
return;
}
+ profile_ = profile;
+
DCHECK(history_service);
+ history_service_observer_.Add(history_service);
history_service_ = history_service;
- history_service_->AddObserver(this);
-
- profile_ = profile;
// TODO(evanm): this is currently necessitated by generate_profile, which
// runs without a browser process. generate_profile should really create

Powered by Google App Engine
This is Rietveld 408576698