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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_database.cc

Issue 2447443002: Log the size of each of the stores and complete DB on launch and after each (Closed)
Patch Set: shess@'s review Created 4 years, 2 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_database.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index 586ee45841db2d6e9d1b19a5c9b00709ede92b11..60d1b6474cf68af12459864df0cf5569bc75b749 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -27,6 +27,7 @@
#include "build/build_config.h"
#include "chrome/browser/safe_browsing/safe_browsing_store_file.h"
#include "components/safe_browsing_db/prefix_set.h"
+#include "components/safe_browsing_db/v4_protocol_manager_util.h"
#include "content/public/browser/browser_thread.h"
#include "crypto/sha2.h"
#include "net/base/ip_address.h"
@@ -226,15 +227,6 @@ void UpdateChunkRangesForList(
UpdateChunkRanges(store, std::vector<std::string>(1, listname), lists);
}
-// This code always checks for non-zero file size. This helper makes
-// that less verbose.
-int64_t GetFileSizeOrZero(const base::FilePath& file_path) {
- int64_t size_64;
- if (!base::GetFileSize(file_path, &size_64))
- return 0;
- return size_64;
-}
-
// Helper for PrefixSetContainsUrlHashes(). Returns true if an un-expired match
// for |full_hash| is found in |cache|, with any matches appended to |results|
// (true can be returned with zero matches). |expire_base| is used to check the
@@ -1601,7 +1593,7 @@ void SafeBrowsingDatabaseNew::LoadPrefixSet(const base::FilePath& db_filename,
DCHECK(!db_state_manager_.filename_base().empty());
// Only use the prefix set if database is present and non-empty.
- if (!GetFileSizeOrZero(db_filename))
+ if (!V4ProtocolManagerUtil::GetFileSizeOrZero(db_filename))
return;
// Cleanup any stale bloom filter (no longer used).
@@ -1822,7 +1814,7 @@ SafeBrowsingDatabaseNew::GetUnsynchronizedPrefixGetHashCacheForTesting() {
void SafeBrowsingDatabaseNew::RecordFileSizeHistogram(
const base::FilePath& file_path) {
- const int64_t file_size = GetFileSizeOrZero(file_path);
+ const int64_t file_size = V4ProtocolManagerUtil::GetFileSizeOrZero(file_path);
const int file_size_kilobytes = static_cast<int>(file_size / 1024);
base::FilePath::StringType filename = file_path.BaseName().value();
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_database.h » ('j') | components/safe_browsing_db/v4_protocol_manager_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698