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

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

Issue 10217010: Completed the code path from AndroidProviderService to HistoryBackend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 8 years, 8 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_android.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 5095ef37cabf4f1a6052edcc7a1faff0d52dfb1d..59ad541be33234b62e0229b06aa7f576b89f31a8 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -36,6 +36,10 @@
#include "grit/generated_resources.h"
#include "net/base/registry_controlled_domain.h"
+#if defined(OS_ANDROID)
+#include "chrome/browser/history/android/android_provider_backend.h"
+#endif
+
using base::Time;
using base::TimeDelta;
using base::TimeTicks;
@@ -217,6 +221,11 @@ HistoryBackend::~HistoryBackend() {
DCHECK(!scheduled_commit_) << "Deleting without cleanup";
ReleaseDBTasks();
+#if defined(OS_ANDROID)
+ // Release AndroidProviderBackend before other objects.
+ android_provider_backend_.reset();
+#endif
+
// First close the databases before optionally running the "destroy" task.
if (db_.get()) {
// Commit the long-running transaction.
@@ -241,6 +250,10 @@ HistoryBackend::~HistoryBackend() {
DCHECK(backend_destroy_message_loop_);
backend_destroy_message_loop_->PostTask(FROM_HERE, backend_destroy_task_);
}
+
+#if defined(OS_ANDROID)
+ file_util::Delete(GetAndroidCacheFileName(), false);
+#endif
}
void HistoryBackend::Init(const std::string& languages, bool force_fail) {
@@ -283,6 +296,12 @@ FilePath HistoryBackend::GetArchivedFileName() const {
return history_dir_.Append(chrome::kArchivedHistoryFilename);
}
+#if defined(OS_ANDROID)
+FilePath HistoryBackend::GetAndroidCacheFileName() const {
+ return history_dir_.Append(chrome::kAndroidCacheFilename);
+}
+#endif
+
SegmentID HistoryBackend::GetLastSegmentID(VisitID from_visit) {
// Set is used to detect referrer loops. Should not happen, but can
// if the database is corrupt.
@@ -702,6 +721,14 @@ void HistoryBackend::InitImpl(const std::string& languages) {
// Start expiring old stuff.
expirer_.StartArchivingOldStuff(TimeDelta::FromDays(kArchiveDaysThreshold));
+#if defined(OS_ANDROID)
+ if (thumbnail_db_.get()) {
+ android_provider_backend_.reset(new AndroidProviderBackend(
+ GetAndroidCacheFileName(), db_.get(), thumbnail_db_.get(),
+ bookmark_service_, delegate_.get()));
+ }
+#endif
+
HISTOGRAM_TIMES("History.InitTime",
TimeTicks::Now() - beginning_time);
}
« no previous file with comments | « chrome/browser/history/history_backend.h ('k') | chrome/browser/history/history_backend_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698