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

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

Issue 220493003: Safebrowsing: change gethash caching to match api 2.3 rules, fix some corner cases. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase (including 227613008) Created 6 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_util.h
diff --git a/chrome/browser/safe_browsing/safe_browsing_util.h b/chrome/browser/safe_browsing/safe_browsing_util.h
index 783369ec35168531ea4e6a5878f418634654d478..a4fb0e85df167286b986057100cbe40b259159ff 100644
--- a/chrome/browser/safe_browsing/safe_browsing_util.h
+++ b/chrome/browser/safe_browsing/safe_browsing_util.h
@@ -15,6 +15,7 @@
#include "base/basictypes.h"
#include "base/strings/string_piece.h"
+#include "base/time/time.h"
#include "chrome/browser/safe_browsing/chunk_range.h"
class GURL;
@@ -40,6 +41,10 @@ inline bool SBFullHashEqual(const SBFullHash& a, const SBFullHash& b) {
return !memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash));
}
+inline bool SBFullHashLess(const SBFullHash& a, const SBFullHash& b) {
+ return memcmp(a.full_hash, b.full_hash, sizeof(a.full_hash)) < 0;
+}
+
// Generate full hash for the given string.
SBFullHash SBFullHashForString(const base::StringPiece& str);
@@ -106,7 +111,15 @@ class SBChunkList {
struct SBFullHashResult {
SBFullHash hash;
std::string list_name;
- int add_chunk_id;
+};
+
+struct SBCachedFullHashResult {
+ SBCachedFullHashResult();
+ explicit SBCachedFullHashResult(const base::Time& in_expire_after);
+ ~SBCachedFullHashResult();
+
+ base::Time expire_after;
+ std::vector<SBFullHashResult> full_hashes;
};
// Contains information about a list in the database.
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_store_unittest.cc ('k') | chrome/browser/safe_browsing/safe_browsing_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698