diff options
author | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-23 03:53:47 +0000 |
---|---|---|
committer | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-23 03:53:47 +0000 |
commit | a4e9fa652fec9a69eb714b80868f18a04369349a (patch) | |
tree | e13cb277e0dec4e0f8724a8c8c12d60d93d73459 /chrome/browser/diagnostics | |
parent | 68d4b111067f18a789adee26ba3592510da61304 (diff) | |
download | chromium_src-a4e9fa652fec9a69eb714b80868f18a04369349a.zip chromium_src-a4e9fa652fec9a69eb714b80868f18a04369349a.tar.gz chromium_src-a4e9fa652fec9a69eb714b80868f18a04369349a.tar.bz2 |
Replace HistoryQuickProvider protobuf-based caching with an SQLite-based database.
The protobuf-based cache was only being read at startup and written at shutdown. (Except that when the cache could not be read at startup the cache would immediately be saved upon private data reconstruction from the History database.) With the new implementation using an SQLite database for the HQP cache the private data will be restored from the cache database at startup and continually updated during normal operation. There is no need to flush or write the cache at shutdown as it is constantly kept up-to-date.
Detailed comments about the changes made in this CL can be found in the document shared separately.
Previous reviewers: sky, pkasting, shess.
BUG=95686, 95876, 131668
TEST=New tests added, old tests updated, all tests pass.
To manually verify changes:
NOTE: For tests using chrome://omnibox be sure to check the "Show results per provider" and then look at the results for the HistoryQuickProvider.
1) New visits: Type an URL never visited before. Bring up new tab. Start typing the URL or parts of the page title or both and verify that the page is offered as a suggestion.
2) New visits: Type an URL never visited before. Do search using chrome://omnibox. New visit should show.
3) Delete visit: Visit some pages and verify they have been recorded. Bring up history and delete one of the visits. Check via chrome://omnibox that it was deleted.
4) Clear history: Visit some pages. Clear the visit history. Check via chrome://omnibox that none of the visits are still returned by the HQP.
5) Updated site: Create a local page and visit it. Search using chrome://omnibox by page title and verify it can be found. Change the page title dramatically and revisit the page. Verify via chrome://oomnibox that the page can be found by words from the new title.
Previously reviewed as: http://codereview.chromium.org/10477018/.
10477018 was reverted due to memory leaks detected by build bots.
Review URL: https://chromiumcodereview.appspot.com/10837244
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152946 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/diagnostics')
4 files changed, 20 insertions, 4 deletions
diff --git a/chrome/browser/diagnostics/diagnostics_model.cc b/chrome/browser/diagnostics/diagnostics_model.cc index 8182514..b40ba77 100644 --- a/chrome/browser/diagnostics/diagnostics_model.cc +++ b/chrome/browser/diagnostics/diagnostics_model.cc @@ -99,6 +99,7 @@ class DiagnosticsModelWin : public DiagnosticsModelImpl { tests_.push_back(MakeSqliteHistoryDbTest()); tests_.push_back(MakeSqliteArchivedHistoryDbTest()); tests_.push_back(MakeSqliteThumbnailsDbTest()); + tests_.push_back(MakeSqliteHQPCacheDbTest()); tests_.push_back(MakeSqliteAppCacheDbTest()); tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); } @@ -125,6 +126,7 @@ class DiagnosticsModelMac : public DiagnosticsModelImpl { tests_.push_back(MakeSqliteHistoryDbTest()); tests_.push_back(MakeSqliteArchivedHistoryDbTest()); tests_.push_back(MakeSqliteThumbnailsDbTest()); + tests_.push_back(MakeSqliteHistoryDbTest()); tests_.push_back(MakeSqliteAppCacheDbTest()); tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); } @@ -152,6 +154,7 @@ class DiagnosticsModelPosix : public DiagnosticsModelImpl { tests_.push_back(MakeSqliteHistoryDbTest()); tests_.push_back(MakeSqliteArchivedHistoryDbTest()); tests_.push_back(MakeSqliteThumbnailsDbTest()); + tests_.push_back(MakeSqliteHistoryDbTest()); tests_.push_back(MakeSqliteAppCacheDbTest()); tests_.push_back(MakeSqliteWebDatabaseTrackerDbTest()); } diff --git a/chrome/browser/diagnostics/diagnostics_model_unittest.cc b/chrome/browser/diagnostics/diagnostics_model_unittest.cc index 823ef9d..29b15c0 100644 --- a/chrome/browser/diagnostics/diagnostics_model_unittest.cc +++ b/chrome/browser/diagnostics/diagnostics_model_unittest.cc @@ -78,11 +78,11 @@ class UTObserver: public DiagnosticsModel::Observer { // We currently have more tests operational on windows. #if defined(OS_WIN) -const int kDiagnosticsTestCount = 19; +const int kDiagnosticsTestCount = 20; #elif defined(OS_MACOSX) -const int kDiagnosticsTestCount = 16; -#elif defined(OS_POSIX) const int kDiagnosticsTestCount = 17; +#elif defined(OS_POSIX) +const int kDiagnosticsTestCount = 18; #endif // Test that the initial state is correct. diff --git a/chrome/browser/diagnostics/sqlite_diagnostics.cc b/chrome/browser/diagnostics/sqlite_diagnostics.cc index 3fba29e..2a2bf3c 100644 --- a/chrome/browser/diagnostics/sqlite_diagnostics.cc +++ b/chrome/browser/diagnostics/sqlite_diagnostics.cc @@ -99,7 +99,8 @@ class HistogramUniquifier { "Sqlite.History.Error", "Sqlite.Thumbnail.Error", "Sqlite.Text.Error", - "Sqlite.Web.Error" + "Sqlite.Web.Error", + "Sqlite.HQPCache.Error" }; return kHistogramNames[unique]; } @@ -127,6 +128,10 @@ sql::ErrorDelegate* GetErrorHandlerForWebDb() { return new sql::DiagnosticErrorDelegate<HistogramUniquifier<4> >(); } +sql::ErrorDelegate* GetErrorHandlerForHQPCacheDb() { + return new sql::DiagnosticErrorDelegate<HistogramUniquifier<5> >(); +} + DiagnosticTest* MakeSqliteWebDbTest() { return new SqliteIntegrityTest(true, ASCIIToUTF16("Web DB"), FilePath(chrome::kWebDataFilename)); @@ -152,6 +157,12 @@ DiagnosticTest* MakeSqliteThumbnailsDbTest() { FilePath(chrome::kThumbnailsFilename)); } +DiagnosticTest* MakeSqliteHQPCacheDbTest() { + return new SqliteIntegrityTest(false, + ASCIIToUTF16("History Provider Cache DB"), + FilePath(chrome::kHQPCacheDBFilename)); +} + DiagnosticTest* MakeSqliteAppCacheDbTest() { FilePath appcache_dir(content::kAppCacheDirname); FilePath appcache_db = appcache_dir.Append(appcache::kAppCacheDatabaseName); diff --git a/chrome/browser/diagnostics/sqlite_diagnostics.h b/chrome/browser/diagnostics/sqlite_diagnostics.h index c416e88..f66d4cf1 100644 --- a/chrome/browser/diagnostics/sqlite_diagnostics.h +++ b/chrome/browser/diagnostics/sqlite_diagnostics.h @@ -18,6 +18,7 @@ sql::ErrorDelegate* GetErrorHandlerForHistoryDb(); sql::ErrorDelegate* GetErrorHandlerForThumbnailDb(); sql::ErrorDelegate* GetErrorHandlerForTextDb(); sql::ErrorDelegate* GetErrorHandlerForWebDb(); +sql::ErrorDelegate* GetErrorHandlerForHQPCacheDb(); // Factories for the db integrity tests we run in diagnostic mode. DiagnosticTest* MakeSqliteWebDbTest(); @@ -25,6 +26,7 @@ DiagnosticTest* MakeSqliteCookiesDbTest(); DiagnosticTest* MakeSqliteHistoryDbTest(); DiagnosticTest* MakeSqliteArchivedHistoryDbTest(); DiagnosticTest* MakeSqliteThumbnailsDbTest(); +DiagnosticTest* MakeSqliteHQPCacheDbTest(); DiagnosticTest* MakeSqliteAppCacheDbTest(); DiagnosticTest* MakeSqliteWebDatabaseTrackerDbTest(); |