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

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

Issue 10872032: Revert 152946 - Replace HistoryQuickProvider protobuf-based caching with an SQLite-based database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
« no previous file with comments | « chrome/browser/history/history.h ('k') | chrome/browser/history/history_backend.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
742 if (!thread_->Start()) { 741 if (!thread_->Start()) {
743 Cleanup(); 742 Cleanup();
744 return false; 743 return false;
745 } 744 }
746 745
747 history_dir_ = history_dir; 746 history_dir_ = history_dir;
748 bookmark_service_ = bookmark_service; 747 bookmark_service_ = bookmark_service;
749 no_db_ = no_db; 748 no_db_ = no_db;
750 749
751 #if !defined(OS_ANDROID) 750 #if !defined(OS_ANDROID)
752 // History quick provider is enabled on all platforms other than Android. 751 // History quick provider is enabled on all platforms other than Android.
753 // TODO(jcivelli): Enable the History Quick Provider on Android and figure out 752 // TODO(jcivelli): Enable the History Quick Provider on Android and figure out
754 // why it reports the wrong results for some pages. 753 // why it reports the wrong results for some pages.
755 if (profile_) { 754 if (profile_) {
756 std::string languages = 755 std::string languages =
757 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages); 756 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
758 in_memory_url_index_.reset( 757 in_memory_url_index_.reset(
759 new history::InMemoryURLIndex(profile_, history_dir_, languages)); 758 new history::InMemoryURLIndex(profile_, history_dir_, languages));
760 in_memory_url_index_->Init(disable_index_cache); 759 in_memory_url_index_->Init();
761 } 760 }
762 #endif // !OS_ANDROID 761 #endif // !OS_ANDROID
763 762
764 // Create the history backend. 763 // Create the history backend.
765 LoadBackendIfNecessary(); 764 LoadBackendIfNecessary();
766 return true; 765 return true;
767 } 766 }
768 767
769 void HistoryService::ScheduleAutocomplete(HistoryURLProvider* provider, 768 void HistoryService::ScheduleAutocomplete(HistoryURLProvider* provider,
770 HistoryURLProviderParams* params) { 769 HistoryURLProviderParams* params) {
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 void HistoryService::RemoveVisitDatabaseObserver( 939 void HistoryService::RemoveVisitDatabaseObserver(
941 history::VisitDatabaseObserver* observer) { 940 history::VisitDatabaseObserver* observer) {
942 visit_database_observers_->RemoveObserver(observer); 941 visit_database_observers_->RemoveObserver(observer);
943 } 942 }
944 943
945 void HistoryService::NotifyVisitDBObserversOnAddVisit( 944 void HistoryService::NotifyVisitDBObserversOnAddVisit(
946 const history::BriefVisitInfo& info) { 945 const history::BriefVisitInfo& info) {
947 visit_database_observers_->Notify( 946 visit_database_observers_->Notify(
948 &history::VisitDatabaseObserver::OnAddVisit, info); 947 &history::VisitDatabaseObserver::OnAddVisit, info);
949 } 948 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history.h ('k') | chrome/browser/history/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698