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

Side by Side Diff: chrome/browser/history/history_backend.h

Issue 16951015: Remove TextDatabase from the history service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@replace_fts
Patch Set: Fix unit test for Windows. Created 7 years, 5 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
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 #ifndef CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ 5 #ifndef CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_
6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ 6 #define CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/containers/mru_cache.h" 13 #include "base/containers/mru_cache.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "chrome/browser/history/archived_database.h" 17 #include "chrome/browser/history/archived_database.h"
18 #include "chrome/browser/history/expire_history_backend.h" 18 #include "chrome/browser/history/expire_history_backend.h"
19 #include "chrome/browser/history/history_database.h" 19 #include "chrome/browser/history/history_database.h"
20 #include "chrome/browser/history/history_marshaling.h" 20 #include "chrome/browser/history/history_marshaling.h"
21 #include "chrome/browser/history/history_types.h" 21 #include "chrome/browser/history/history_types.h"
22 #include "chrome/browser/history/text_database_manager.h"
23 #include "chrome/browser/history/thumbnail_database.h" 22 #include "chrome/browser/history/thumbnail_database.h"
24 #include "chrome/browser/history/visit_tracker.h" 23 #include "chrome/browser/history/visit_tracker.h"
25 #include "chrome/browser/search_engines/template_url_id.h" 24 #include "chrome/browser/search_engines/template_url_id.h"
26 #include "sql/init_status.h" 25 #include "sql/init_status.h"
27 #include "ui/base/layout.h" 26 #include "ui/base/layout.h"
28 27
29 class BookmarkService; 28 class BookmarkService;
30 class TestingProfile; 29 class TestingProfile;
31 class TypedUrlSyncableService; 30 class TypedUrlSyncableService;
32 struct ThumbnailScore; 31 struct ThumbnailScore;
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // The page can be identified by the combination of the pointer to 153 // The page can be identified by the combination of the pointer to
155 // a RenderProcessHost, the page id and the url. 154 // a RenderProcessHost, the page id and the url.
156 // 155 //
157 // The given pointer will not be dereferenced, it is only used for 156 // The given pointer will not be dereferenced, it is only used for
158 // identification purposes, hence it is a void*. 157 // identification purposes, hence it is a void*.
159 void UpdateWithPageEndTime(const void* host, 158 void UpdateWithPageEndTime(const void* host,
160 int32 page_id, 159 int32 page_id,
161 const GURL& url, 160 const GURL& url,
162 base::Time end_ts); 161 base::Time end_ts);
163 162
164
165 // Indexing ------------------------------------------------------------------
166
167 void SetPageContents(const GURL& url, const string16& contents);
168
169 // Querying ------------------------------------------------------------------ 163 // Querying ------------------------------------------------------------------
170 164
171 // ScheduleAutocomplete() never frees |provider| (which is globally live). 165 // ScheduleAutocomplete() never frees |provider| (which is globally live).
172 // It passes |params| on to the autocomplete system which will eventually 166 // It passes |params| on to the autocomplete system which will eventually
173 // free it. 167 // free it.
174 void ScheduleAutocomplete(HistoryURLProvider* provider, 168 void ScheduleAutocomplete(HistoryURLProvider* provider,
175 HistoryURLProviderParams* params); 169 HistoryURLProviderParams* params);
176 170
177 void IterateURLs( 171 void IterateURLs(
178 const scoped_refptr<visitedlink::VisitedLinkDelegate::URLEnumerator>& 172 const scoped_refptr<visitedlink::VisitedLinkDelegate::URLEnumerator>&
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBSingleIconURL); 550 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBSingleIconURL);
557 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType); 551 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBIconType);
558 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired); 552 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, GetFaviconsFromDBExpired);
559 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 553 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
560 UpdateFaviconMappingsAndFetchNoDB); 554 UpdateFaviconMappingsAndFetchNoDB);
561 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, 555 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest,
562 CloneFaviconIsRestrictedToSameDomain); 556 CloneFaviconIsRestrictedToSameDomain);
563 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, QueryFilteredURLs); 557 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, QueryFilteredURLs);
564 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, UpdateVisitDuration); 558 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, UpdateVisitDuration);
565 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, ExpireHistoryForTimes); 559 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, ExpireHistoryForTimes);
560 FRIEND_TEST_ALL_PREFIXES(HistoryBackendTest, DeleteFTSIndexDatabases);
566 561
567 friend class ::TestingProfile; 562 friend class ::TestingProfile;
568 563
569 // Computes the name of the specified database on disk. 564 // Computes the name of the specified database on disk.
570 base::FilePath GetThumbnailFileName() const; 565 base::FilePath GetThumbnailFileName() const;
571 566
572 // Returns the name of the Favicons database. This is the new name 567 // Returns the name of the Favicons database. This is the new name
573 // of the Thumbnails database. 568 // of the Thumbnails database.
574 // See ThumbnailDatabase::RenameAndDropThumbnails. 569 // See ThumbnailDatabase::RenameAndDropThumbnails.
575 base::FilePath GetFaviconsFileName() const; 570 base::FilePath GetFaviconsFileName() const;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 // The *Text() version performs a brute force query of the history DB to 641 // The *Text() version performs a brute force query of the history DB to
647 // search for results which match the given text query. 642 // search for results which match the given text query.
648 // Both functions assume QueryHistory already checked the DB for validity. 643 // Both functions assume QueryHistory already checked the DB for validity.
649 void QueryHistoryBasic(URLDatabase* url_db, VisitDatabase* visit_db, 644 void QueryHistoryBasic(URLDatabase* url_db, VisitDatabase* visit_db,
650 const QueryOptions& options, QueryResults* result); 645 const QueryOptions& options, QueryResults* result);
651 void QueryHistoryText(URLDatabase* url_db, 646 void QueryHistoryText(URLDatabase* url_db,
652 VisitDatabase* visit_db, 647 VisitDatabase* visit_db,
653 const string16& text_query, 648 const string16& text_query,
654 const QueryOptions& options, 649 const QueryOptions& options,
655 QueryResults* result); 650 QueryResults* result);
656 void QueryHistoryFTS(const string16& text_query,
657 const QueryOptions& options,
658 QueryResults* result);
659 651
660 // Committing ---------------------------------------------------------------- 652 // Committing ----------------------------------------------------------------
661 653
662 // We always keep a transaction open on the history database so that multiple 654 // We always keep a transaction open on the history database so that multiple
663 // transactions can be batched. Periodically, these are flushed (use 655 // transactions can be batched. Periodically, these are flushed (use
664 // ScheduleCommit). This function does the commit to write any new changes to 656 // ScheduleCommit). This function does the commit to write any new changes to
665 // disk and opens a new transaction. This will be called automatically by 657 // disk and opens a new transaction. This will be called automatically by
666 // ScheduleCommit, or it can be called explicitly if a caller really wants 658 // ScheduleCommit, or it can be called explicitly if a caller really wants
667 // to write something to disk. 659 // to write something to disk.
668 void Commit(); 660 void Commit();
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 // vector to reference the new IDs. 823 // vector to reference the new IDs.
832 bool ClearAllThumbnailHistory(URLRows* kept_urls); 824 bool ClearAllThumbnailHistory(URLRows* kept_urls);
833 825
834 // Deletes all information in the history database, except for the supplied 826 // Deletes all information in the history database, except for the supplied
835 // set of URLs in the URL table (these should correspond to the bookmarked 827 // set of URLs in the URL table (these should correspond to the bookmarked
836 // URLs). 828 // URLs).
837 // 829 //
838 // The IDs of the URLs may change. 830 // The IDs of the URLs may change.
839 bool ClearAllMainHistory(const URLRows& kept_urls); 831 bool ClearAllMainHistory(const URLRows& kept_urls);
840 832
833 // Deletes the FTS index database files, which are no longer used.
834 void DeleteFTSIndexDatabases();
835
841 // Returns the BookmarkService, blocking until it is loaded. This may return 836 // Returns the BookmarkService, blocking until it is loaded. This may return
842 // NULL during testing. 837 // NULL during testing.
843 BookmarkService* GetBookmarkService(); 838 BookmarkService* GetBookmarkService();
844 839
845 // Notify any observers of an addition to the visit database. 840 // Notify any observers of an addition to the visit database.
846 void NotifyVisitObservers(const VisitRow& visit); 841 void NotifyVisitObservers(const VisitRow& visit);
847 842
848 // Data ---------------------------------------------------------------------- 843 // Data ----------------------------------------------------------------------
849 844
850 // Delegate. See the class definition above for more information. This will 845 // Delegate. See the class definition above for more information. This will
(...skipping 12 matching lines...) Expand all
863 // not be opened, all users must first check for NULL and return immediately 858 // not be opened, all users must first check for NULL and return immediately
864 // if it is. The thumbnail DB may be NULL when the history one isn't, but not 859 // if it is. The thumbnail DB may be NULL when the history one isn't, but not
865 // vice-versa. 860 // vice-versa.
866 scoped_ptr<HistoryDatabase> db_; 861 scoped_ptr<HistoryDatabase> db_;
867 bool scheduled_kill_db_; // Database is being killed due to error. 862 bool scheduled_kill_db_; // Database is being killed due to error.
868 scoped_ptr<ThumbnailDatabase> thumbnail_db_; 863 scoped_ptr<ThumbnailDatabase> thumbnail_db_;
869 864
870 // Stores old history in a larger, slower database. 865 // Stores old history in a larger, slower database.
871 scoped_ptr<ArchivedDatabase> archived_db_; 866 scoped_ptr<ArchivedDatabase> archived_db_;
872 867
873 // Full text database manager, possibly NULL if the database could not be
874 // created.
875 scoped_ptr<TextDatabaseManager> text_database_;
876
877 // Manages expiration between the various databases. 868 // Manages expiration between the various databases.
878 ExpireHistoryBackend expirer_; 869 ExpireHistoryBackend expirer_;
879 870
880 // A commit has been scheduled to occur sometime in the future. We can check 871 // A commit has been scheduled to occur sometime in the future. We can check
881 // non-null-ness to see if there is a commit scheduled in the future, and we 872 // non-null-ness to see if there is a commit scheduled in the future, and we
882 // can use the pointer to cancel the scheduled commit. There can be only one 873 // can use the pointer to cancel the scheduled commit. There can be only one
883 // scheduled commit at a time (see ScheduleCommit). 874 // scheduled commit at a time (see ScheduleCommit).
884 scoped_refptr<CommitLaterTask> scheduled_commit_; 875 scoped_refptr<CommitLaterTask> scheduled_commit_;
885 876
886 // Maps recent redirect destination pages to the chain of redirects that 877 // Maps recent redirect destination pages to the chain of redirects that
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 // Used to manage syncing of the typed urls datatype. This will be NULL 929 // Used to manage syncing of the typed urls datatype. This will be NULL
939 // before Init is called. 930 // before Init is called.
940 scoped_ptr<TypedUrlSyncableService> typed_url_syncable_service_; 931 scoped_ptr<TypedUrlSyncableService> typed_url_syncable_service_;
941 932
942 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); 933 DISALLOW_COPY_AND_ASSIGN(HistoryBackend);
943 }; 934 };
944 935
945 } // namespace history 936 } // namespace history
946 937
947 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ 938 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698