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

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

Issue 285233012: Abstract history dependencies on bookmarks through HistoryClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android unit tests Created 6 years, 7 months 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
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | chrome/browser/history/history_service_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/history_service.cc
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
index 81043923e3bae018f35d1ab0ae11791b92fbe2eb..af61f108a548fc551b69d7e5627e17efa9b813c1 100644
--- a/chrome/browser/history/history_service.cc
+++ b/chrome/browser/history/history_service.cc
@@ -33,7 +33,6 @@
#include "base/threading/thread.h"
#include "base/time/time.h"
#include "chrome/browser/autocomplete/history_url_provider.h"
-#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/history/download_row.h"
@@ -56,7 +55,6 @@
#include "chrome/common/pref_names.h"
#include "chrome/common/thumbnail_score.h"
#include "chrome/common/url_constants.h"
-#include "components/bookmarks/browser/bookmark_model.h"
#include "components/history/core/browser/history_client.h"
#include "components/visitedlink/browser/visitedlink_master.h"
#include "content/public/browser/browser_thread.h"
@@ -196,7 +194,6 @@ HistoryService::HistoryService()
history_client_(NULL),
profile_(NULL),
backend_loaded_(false),
- bookmark_service_(NULL),
no_db_(false) {
}
@@ -208,7 +205,6 @@ HistoryService::HistoryService(history::HistoryClient* client, Profile* profile)
visitedlink_master_(new visitedlink::VisitedLinkMaster(
profile, this, true)),
backend_loaded_(false),
- bookmark_service_(NULL),
no_db_(false) {
DCHECK(profile_);
registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
@@ -331,19 +327,6 @@ history::TypedUrlSyncableService* HistoryService::GetTypedUrlSyncableService()
void HistoryService::Shutdown() {
DCHECK(thread_checker_.CalledOnValidThread());
- // It's possible that bookmarks haven't loaded and history is waiting for
- // bookmarks to complete loading. In such a situation history can't shutdown
- // (meaning if we invoked history_service_->Cleanup now, we would
- // deadlock). To break the deadlock we tell BookmarkModel it's about to be
- // deleted so that it can release the signal history is waiting on, allowing
- // history to shutdown (history_service_->Cleanup to complete). In such a
- // scenario history sees an incorrect view of bookmarks, but it's better
- // than a deadlock.
- BookmarkModel* bookmark_model = static_cast<BookmarkModel*>(
- BookmarkModelFactory::GetForProfileIfExists(profile_));
- if (bookmark_model)
- bookmark_model->Shutdown();
-
Cleanup();
}
@@ -911,9 +894,7 @@ void HistoryService::RebuildTable(
ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::IterateURLs, enumerator);
}
-bool HistoryService::Init(const base::FilePath& history_dir,
- BookmarkService* bookmark_service,
- bool no_db) {
+bool HistoryService::Init(const base::FilePath& history_dir, bool no_db) {
DCHECK(thread_checker_.CalledOnValidThread());
if (!thread_->Start()) {
Cleanup();
@@ -921,14 +902,13 @@ bool HistoryService::Init(const base::FilePath& history_dir,
}
history_dir_ = history_dir;
- bookmark_service_ = bookmark_service;
no_db_ = no_db;
if (profile_) {
std::string languages =
profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
- in_memory_url_index_.reset(
- new history::InMemoryURLIndex(profile_, history_dir_, languages));
+ in_memory_url_index_.reset(new history::InMemoryURLIndex(
+ profile_, history_dir_, languages, history_client_));
in_memory_url_index_->Init();
}
@@ -939,7 +919,7 @@ bool HistoryService::Init(const base::FilePath& history_dir,
weak_ptr_factory_.GetWeakPtr(),
base::ThreadTaskRunnerHandle::Get(),
profile_),
- bookmark_service_));
+ history_client_));
history_backend_.swap(backend);
// There may not be a profile when unit testing.
« no previous file with comments | « chrome/browser/history/history_service.h ('k') | chrome/browser/history/history_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698