| Index: chrome/browser/browsing_data/history_counter.cc
|
| diff --git a/chrome/browser/browsing_data/history_counter.cc b/chrome/browser/browsing_data/history_counter.cc
|
| index bad51a2a5b93a49a952bef264fe943f2e16aa6d6..58ede7365a6a2c8b2ebde8dce82c04323373b05d 100644
|
| --- a/chrome/browser/browsing_data/history_counter.cc
|
| +++ b/chrome/browser/browsing_data/history_counter.cc
|
| @@ -30,14 +30,14 @@ HistoryCounter::HistoryCounter() : pref_name_(prefs::kDeleteBrowsingHistory),
|
| }
|
|
|
| HistoryCounter::~HistoryCounter() {
|
| - DCHECK(sync_service_);
|
| - sync_service_->RemoveObserver(this);
|
| + if (sync_service_)
|
| + sync_service_->RemoveObserver(this);
|
| }
|
|
|
| void HistoryCounter::OnInitialized() {
|
| sync_service_ = ProfileSyncServiceFactory::GetForProfile(GetProfile());
|
| - DCHECK(sync_service_);
|
| - sync_service_->AddObserver(this);
|
| + if (sync_service_)
|
| + sync_service_->AddObserver(this);
|
| history_sync_enabled_ =
|
| !!WebHistoryServiceFactory::GetForProfile(GetProfile());
|
| }
|
| @@ -65,7 +65,8 @@ void HistoryCounter::Count() {
|
| local_counting_finished_ = false;
|
|
|
| history::HistoryService* service =
|
| - HistoryServiceFactory::GetForProfileWithoutCreating(GetProfile());
|
| + HistoryServiceFactory::GetForProfile(
|
| + GetProfile(), ServiceAccessType::EXPLICIT_ACCESS);
|
|
|
| service->GetHistoryCount(
|
| GetPeriodStart(),
|
|
|