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

Unified Diff: components/safe_browsing_db/v4_protocol_manager_util.cc

Issue 1727033003: v4_update_protocol_manager: Basic implementation with TODOs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback. Created 4 years, 9 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: components/safe_browsing_db/v4_protocol_manager_util.cc
diff --git a/components/safe_browsing_db/v4_protocol_manager_util.cc b/components/safe_browsing_db/v4_protocol_manager_util.cc
index 5f91bfbaab0672c2a94b56fc9208ba54f76176bf..2dddc161e563115576fe844dd36e1e4dd36dfdde 100644
--- a/components/safe_browsing_db/v4_protocol_manager_util.cc
+++ b/components/safe_browsing_db/v4_protocol_manager_util.cc
@@ -18,6 +18,25 @@ namespace safe_browsing {
// The Safe Browsing V4 server URL prefix.
const char kSbV4UrlPrefix[] = "https://safebrowsing.googleapis.com/v4";
+bool UpdateListIdentifier::operator==(const UpdateListIdentifier& other) const {
+ return platform_type == other.platform_type &&
+ threat_entry_type == other.threat_entry_type &&
+ threat_type == other.threat_type;
+}
+
+bool UpdateListIdentifier::operator!=(const UpdateListIdentifier& other) const {
+ return !operator==(other);
+}
+
+size_t UpdateListIdentifier::hash() const {
+ std::size_t first = std::hash<unsigned int>()(platform_type);
+ std::size_t second = std::hash<unsigned int>()(threat_entry_type);
+ std::size_t third = std::hash<unsigned int>()(threat_type);
+
+ std::size_t interim = base::HashInts(first, second);
+ return base::HashInts(interim, third);
+}
+
// static
// Backoff interval is MIN(((2^(n-1))*15 minutes) * (RAND + 1), 24 hours) where
// n is the number of consecutive errors.
« no previous file with comments | « components/safe_browsing_db/v4_protocol_manager_util.h ('k') | components/safe_browsing_db/v4_update_protocol_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698