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

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

Issue 849323002: Componentize HistoryDatabase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android compilation Created 5 years, 11 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_backend.h ('k') | chrome/browser/history/history_backend_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/history_backend.cc
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index 8ac71f254a358569cbb567bd0a52cefa6ff36e36..0dd1007bac3f9583b7ecf3b872f93be4f59a09bb 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -39,6 +39,8 @@
#include "components/history/core/browser/history_backend_observer.h"
#include "components/history/core/browser/history_client.h"
#include "components/history/core/browser/history_constants.h"
+#include "components/history/core/browser/history_database.h"
+#include "components/history/core/browser/history_database_params.h"
#include "components/history/core/browser/history_db_task.h"
#include "components/history/core/browser/keyword_search_term.h"
#include "components/history/core/browser/page_usage_data.h"
@@ -231,9 +233,12 @@ HistoryBackend::~HistoryBackend() {
#endif
}
-void HistoryBackend::Init(const std::string& languages, bool force_fail) {
+void HistoryBackend::Init(
+ const std::string& languages,
+ bool force_fail,
+ const HistoryDatabaseParams& history_database_params) {
if (!force_fail)
- InitImpl(languages);
+ InitImpl(languages, history_database_params);
delegate_->DBLoaded();
typed_url_syncable_service_.reset(new TypedUrlSyncableService(this));
memory_pressure_listener_.reset(new base::MemoryPressureListener(
@@ -579,7 +584,9 @@ void HistoryBackend::AddPage(const HistoryAddPageArgs& request) {
ScheduleCommit();
}
-void HistoryBackend::InitImpl(const std::string& languages) {
+void HistoryBackend::InitImpl(
+ const std::string& languages,
+ const HistoryDatabaseParams& history_database_params) {
DCHECK(!db_) << "Initializing HistoryBackend twice";
// In the rare case where the db fails to initialize a dialog may get shown
// the blocks the caller, yet allows other messages through. For this reason
@@ -589,7 +596,9 @@ void HistoryBackend::InitImpl(const std::string& languages) {
TimeTicks beginning_time = TimeTicks::Now();
// Compute the file names.
- base::FilePath history_name = history_dir_.Append(history::kHistoryFilename);
+ DCHECK(history_dir_ == history_database_params.history_dir);
+ base::FilePath history_name =
+ history_database_params.history_dir.Append(history::kHistoryFilename);
base::FilePath thumbnail_name = GetFaviconsFileName();
base::FilePath archived_name = GetArchivedFileName();
@@ -597,7 +606,9 @@ void HistoryBackend::InitImpl(const std::string& languages) {
DeleteFTSIndexDatabases();
// History database.
- db_.reset(new HistoryDatabase());
+ db_.reset(new HistoryDatabase(
+ history_database_params.download_interrupt_reason_none,
+ history_database_params.download_interrupt_reason_crash));
// Unretained to avoid a ref loop with db_.
db_->set_error_callback(
« no previous file with comments | « chrome/browser/history/history_backend.h ('k') | chrome/browser/history/history_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698