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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_store_file.h

Issue 10093004: Double-check safe-browsing database validity on update failure. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Check size before reading. Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_store_file.h
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.h b/chrome/browser/safe_browsing/safe_browsing_store_file.h
index d4e4403a03256f4698bfc4a35e205c77552e4221..e0baf12b8a28d3bd8ef5cc936aaa86f607630671 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_file.h
+++ b/chrome/browser/safe_browsing/safe_browsing_store_file.h
@@ -153,6 +153,10 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore {
virtual void DeleteAddChunk(int32 chunk_id) OVERRIDE;
virtual void DeleteSubChunk(int32 chunk_id) OVERRIDE;
+ // Verify |file_|'s checksum, calling the corruption callback if it
+ // does not check out. Empty input is considered valid.
+ virtual bool CheckValidity() OVERRIDE;
+
// Returns the name of the temporary file used to buffer data for
// |filename|. Exported for unit tests.
static const FilePath TemporaryFileForFilename(const FilePath& filename) {
@@ -190,6 +194,12 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore {
FORMAT_EVENT_DELETED_ORIGINAL,
FORMAT_EVENT_DELETED_ORIGINAL_FAILED,
+ // The checksum did not check out in CheckValidity() or in
+ // FinishUpdate(). This most likely indicates that the machine
+ // crashed before the file was fully sync'ed to disk.
+ FORMAT_EVENT_VALIDITY_CHECKSUM_FAILURE,
+ FORMAT_EVENT_UPDATE_CHECKSUM_FAILURE,
+
// Memory space for histograms is determined by the max. ALWAYS
// ADD NEW VALUES BEFORE THIS ONE.
FORMAT_EVENT_MAX
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_store.h ('k') | chrome/browser/safe_browsing/safe_browsing_store_file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698