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 |