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

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

Issue 16776004: Replace FTS in the history_service with a brute force text search. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix some typos Created 7 years, 6 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>
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 #endif // defined(OS_ANDROID) 402 #endif // defined(OS_ANDROID)
403 403
404 // Generic operations -------------------------------------------------------- 404 // Generic operations --------------------------------------------------------
405 405
406 void ProcessDBTask(scoped_refptr<HistoryDBTaskRequest> request); 406 void ProcessDBTask(scoped_refptr<HistoryDBTaskRequest> request);
407 407
408 virtual bool GetAllTypedURLs(URLRows* urls); 408 virtual bool GetAllTypedURLs(URLRows* urls);
409 409
410 virtual bool GetVisitsForURL(URLID id, VisitVector* visits); 410 virtual bool GetVisitsForURL(URLID id, VisitVector* visits);
411 411
412 virtual bool GetVisitsForURLWithOptions(URLID id,
413 const QueryOptions& options,
414 VisitVector* visits);
415
412 // Fetches up to |max_visits| most recent visits for the passed URL. 416 // Fetches up to |max_visits| most recent visits for the passed URL.
413 virtual bool GetMostRecentVisitsForURL(URLID id, 417 virtual bool GetMostRecentVisitsForURL(URLID id,
414 int max_visits, 418 int max_visits,
415 VisitVector* visits); 419 VisitVector* visits);
416 420
417 virtual bool UpdateURL(URLID id, const history::URLRow& url); 421 virtual bool UpdateURL(URLID id, const history::URLRow& url);
418 422
419 // While adding visits in batch, the source needs to be provided. 423 // While adding visits in batch, the source needs to be provided.
420 virtual bool AddVisits(const GURL& url, 424 virtual bool AddVisits(const GURL& url,
421 const std::vector<history::VisitInfo>& visits, 425 const std::vector<history::VisitInfo>& visits,
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 // When a simple GetMostRecentRedirectsFrom() fails, this method is 622 // When a simple GetMostRecentRedirectsFrom() fails, this method is
619 // called which searches the last N visit sessions instead of just 623 // called which searches the last N visit sessions instead of just
620 // the current one. Returns true and puts thumbnail data in |data| 624 // the current one. Returns true and puts thumbnail data in |data|
621 // if a proper thumbnail was found. Returns false otherwise. Assumes 625 // if a proper thumbnail was found. Returns false otherwise. Assumes
622 // that this HistoryBackend object has been Init()ed successfully. 626 // that this HistoryBackend object has been Init()ed successfully.
623 bool GetThumbnailFromOlderRedirect( 627 bool GetThumbnailFromOlderRedirect(
624 const GURL& page_url, std::vector<unsigned char>* data); 628 const GURL& page_url, std::vector<unsigned char>* data);
625 629
626 // Querying ------------------------------------------------------------------ 630 // Querying ------------------------------------------------------------------
627 631
628 // Backends for QueryHistory. *Basic() handles queries that are not FTS (full 632 // Backends for QueryHistory. *Basic() handles queries that are not
629 // text search) queries and can just be given directly to the history DB). 633 // text search queries and can just be given directly to the history DB.
630 // The FTS version queries the text_database, then merges with the history DB. 634 // The *Text() version performs a brute force query of the history DB to
635 // search for results which match the given text query.
631 // Both functions assume QueryHistory already checked the DB for validity. 636 // Both functions assume QueryHistory already checked the DB for validity.
632 void QueryHistoryBasic(URLDatabase* url_db, VisitDatabase* visit_db, 637 void QueryHistoryBasic(URLDatabase* url_db, VisitDatabase* visit_db,
633 const QueryOptions& options, QueryResults* result); 638 const QueryOptions& options, QueryResults* result);
639 void QueryHistoryText(URLDatabase* url_db,
640 VisitDatabase* visit_db,
641 const string16& text_query,
642 const QueryOptions& options,
643 QueryResults* result);
634 void QueryHistoryFTS(const string16& text_query, 644 void QueryHistoryFTS(const string16& text_query,
635 const QueryOptions& options, 645 const QueryOptions& options,
636 QueryResults* result); 646 QueryResults* result);
637 647
638 // Committing ---------------------------------------------------------------- 648 // Committing ----------------------------------------------------------------
639 649
640 // We always keep a transaction open on the history database so that multiple 650 // We always keep a transaction open on the history database so that multiple
641 // transactions can be batched. Periodically, these are flushed (use 651 // transactions can be batched. Periodically, these are flushed (use
642 // ScheduleCommit). This function does the commit to write any new changes to 652 // ScheduleCommit). This function does the commit to write any new changes to
643 // disk and opens a new transaction. This will be called automatically by 653 // disk and opens a new transaction. This will be called automatically by
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 // Used to manage syncing of the typed urls datatype. This will be NULL 919 // Used to manage syncing of the typed urls datatype. This will be NULL
910 // before Init is called. 920 // before Init is called.
911 scoped_ptr<TypedUrlSyncableService> typed_url_syncable_service_; 921 scoped_ptr<TypedUrlSyncableService> typed_url_syncable_service_;
912 922
913 DISALLOW_COPY_AND_ASSIGN(HistoryBackend); 923 DISALLOW_COPY_AND_ASSIGN(HistoryBackend);
914 }; 924 };
915 925
916 } // namespace history 926 } // namespace history
917 927
918 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_ 928 #endif // CHROME_BROWSER_HISTORY_HISTORY_BACKEND_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/history/history_backend.cc » ('j') | chrome/browser/history/history_backend.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698