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

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

Issue 9316109: Move Ownership of IMUI to HistoryService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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
Index: chrome/browser/history/history.cc
===================================================================
--- chrome/browser/history/history.cc (revision 120346)
+++ chrome/browser/history/history.cc (working copy)
@@ -25,6 +25,7 @@
#include "chrome/browser/history/history.h"
#include "base/callback.h"
+#include "base/command_line.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
#include "base/path_service.h"
@@ -37,6 +38,7 @@
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/history/in_memory_database.h"
#include "chrome/browser/history/in_memory_history_backend.h"
+#include "chrome/browser/history/in_memory_url_index.h"
#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -44,6 +46,7 @@
#include "chrome/browser/visitedlink/visitedlink_master.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_notification_types.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/thumbnail_score.h"
#include "chrome/common/url_constants.h"
@@ -181,6 +184,10 @@
// Get rid of the in-memory backend.
in_memory_backend_.reset();
+ // Give the InMemoryURLIndex a chance to shutdown.
+ if (in_memory_url_index_.get())
+ in_memory_url_index_->ShutDown();
+
// The backend's destructor must run on the history thread since it is not
// threadsafe. So this thread must not be the last thread holding a reference
// to the backend, or a crash could happen.
@@ -243,15 +250,17 @@
return NULL;
}
+#if 0
Peter Kasting 2012/02/04 02:20:31 Shouldn't have #if 0s by commit time...
mrossetti 2012/02/04 04:30:53 No, again I'm embarrassed.
history::InMemoryURLIndex* HistoryService::InMemoryIndex() {
// NOTE: See comments in BackendLoaded() as to why we call
// LoadBackendIfNecessary() here even though it won't affect the return value
// for this call.
LoadBackendIfNecessary();
- if (in_memory_backend_.get())
- return in_memory_backend_->InMemoryIndex();
+ if (history_backend_.get())
+ return history_backend_->InMemoryIndex();
return NULL;
}
+#endif
void HistoryService::SetSegmentPresentationIndex(int64 segment_id, int index) {
ScheduleAndForget(PRIORITY_UI,
@@ -690,6 +699,15 @@
bookmark_service_ = bookmark_service;
no_db_ = no_db;
+ if (profile_ && !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableHistoryQuickProvider)) {
+ std::string languages =
+ profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
+ in_memory_url_index_.reset(
+ new history::InMemoryURLIndex(profile_, history_dir_, languages));
+ in_memory_url_index_->Init();
+ }
+
// Create the history backend.
LoadBackendIfNecessary();
return true;

Powered by Google App Engine
This is Rietveld 408576698