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

Side by Side Diff: chrome/browser/history/history.cc

Issue 10837244: Replace HistoryQuickProvider protobuf-based caching with an SQLite-based database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Tweak suppression. Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // The history system runs on a background thread so that potentially slow 5 // The history system runs on a background thread so that potentially slow
6 // database operations don't delay the browser. This backend processing is 6 // database operations don't delay the browser. This backend processing is
7 // represented by HistoryBackend. The HistoryService's job is to dispatch to 7 // represented by HistoryBackend. The HistoryService's job is to dispatch to
8 // that thread. 8 // that thread.
9 // 9 //
10 // Main thread History thread 10 // Main thread History thread
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 void HistoryService::UnloadBackend() { 195 void HistoryService::UnloadBackend() {
196 if (!history_backend_) 196 if (!history_backend_)
197 return; // Already unloaded. 197 return; // Already unloaded.
198 198
199 // Get rid of the in-memory backend. 199 // Get rid of the in-memory backend.
200 in_memory_backend_.reset(); 200 in_memory_backend_.reset();
201 201
202 // Give the InMemoryURLIndex a chance to shutdown. 202 // Give the InMemoryURLIndex a chance to shutdown.
203 if (in_memory_url_index_.get()) 203 if (in_memory_url_index_.get())
204 in_memory_url_index_->ShutDown(); 204 in_memory_url_index_->Shutdown();
205 205
206 // The backend's destructor must run on the history thread since it is not 206 // The backend's destructor must run on the history thread since it is not
207 // threadsafe. So this thread must not be the last thread holding a reference 207 // threadsafe. So this thread must not be the last thread holding a reference
208 // to the backend, or a crash could happen. 208 // to the backend, or a crash could happen.
209 // 209 //
210 // We have a reference to the history backend. There is also an extra 210 // We have a reference to the history backend. There is also an extra
211 // reference held by our delegate installed in the backend, which 211 // reference held by our delegate installed in the backend, which
212 // HistoryBackend::Closing will release. This means if we scheduled a call 212 // HistoryBackend::Closing will release. This means if we scheduled a call
213 // to HistoryBackend::Closing and *then* released our backend reference, there 213 // to HistoryBackend::Closing and *then* released our backend reference, there
214 // will be a race between us and the backend's Closing function to see who is 214 // will be a race between us and the backend's Closing function to see who is
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 *(content::Details<TemplateURLID>(details).ptr())); 730 *(content::Details<TemplateURLID>(details).ptr()));
731 break; 731 break;
732 732
733 default: 733 default:
734 NOTREACHED(); 734 NOTREACHED();
735 } 735 }
736 } 736 }
737 737
738 bool HistoryService::Init(const FilePath& history_dir, 738 bool HistoryService::Init(const FilePath& history_dir,
739 BookmarkService* bookmark_service, 739 BookmarkService* bookmark_service,
740 bool no_db) { 740 bool no_db,
741 bool disable_index_cache) {
741 if (!thread_->Start()) { 742 if (!thread_->Start()) {
742 Cleanup(); 743 Cleanup();
743 return false; 744 return false;
744 } 745 }
745 746
746 history_dir_ = history_dir; 747 history_dir_ = history_dir;
747 bookmark_service_ = bookmark_service; 748 bookmark_service_ = bookmark_service;
748 no_db_ = no_db; 749 no_db_ = no_db;
749 750
750 #if !defined(OS_ANDROID) 751 #if !defined(OS_ANDROID)
751 // History quick provider is enabled on all platforms other than Android. 752 // History quick provider is enabled on all platforms other than Android.
752 // TODO(jcivelli): Enable the History Quick Provider on Android and figure out 753 // TODO(jcivelli): Enable the History Quick Provider on Android and figure out
753 // why it reports the wrong results for some pages. 754 // why it reports the wrong results for some pages.
754 if (profile_) { 755 if (profile_) {
755 std::string languages = 756 std::string languages =
756 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); 757 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
757 in_memory_url_index_.reset( 758 in_memory_url_index_.reset(
758 new history::InMemoryURLIndex(profile_, history_dir_, languages)); 759 new history::InMemoryURLIndex(profile_, history_dir_, languages));
759 in_memory_url_index_->Init(); 760 in_memory_url_index_->Init(disable_index_cache);
760 } 761 }
761 #endif // !OS_ANDROID 762 #endif // !OS_ANDROID
762 763
763 // Create the history backend. 764 // Create the history backend.
764 LoadBackendIfNecessary(); 765 LoadBackendIfNecessary();
765 return true; 766 return true;
766 } 767 }
767 768
768 void HistoryService::ScheduleAutocomplete(HistoryURLProvider* provider, 769 void HistoryService::ScheduleAutocomplete(HistoryURLProvider* provider,
769 HistoryURLProviderParams* params) { 770 HistoryURLProviderParams* params) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 void HistoryService::RemoveVisitDatabaseObserver( 940 void HistoryService::RemoveVisitDatabaseObserver(
940 history::VisitDatabaseObserver* observer) { 941 history::VisitDatabaseObserver* observer) {
941 visit_database_observers_->RemoveObserver(observer); 942 visit_database_observers_->RemoveObserver(observer);
942 } 943 }
943 944
944 void HistoryService::NotifyVisitDBObserversOnAddVisit( 945 void HistoryService::NotifyVisitDBObserversOnAddVisit(
945 const history::BriefVisitInfo& info) { 946 const history::BriefVisitInfo& info) {
946 visit_database_observers_->Notify( 947 visit_database_observers_->Notify(
947 &history::VisitDatabaseObserver::OnAddVisit, info); 948 &history::VisitDatabaseObserver::OnAddVisit, info);
948 } 949 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698