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

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

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

Powered by Google App Engine
This is Rietveld 408576698