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

Unified Diff: net/base/hash_value.cc

Issue 1745283002: Pickle (serialize and deserialize) MultiThreadedCertVerifier's |cache_| (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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: net/base/hash_value.cc
diff --git a/net/base/hash_value.cc b/net/base/hash_value.cc
index f72aa454df6e79fca65d1c6528753c434c6f3af5..6b207d92798c3b85617486027befdb5006287ed7 100644
--- a/net/base/hash_value.cc
+++ b/net/base/hash_value.cc
@@ -30,6 +30,19 @@ bool SHA1HashValue::Equals(const SHA1HashValue& other) const {
return memcmp(data, other.data, sizeof(data)) == 0;
}
+bool SHA1HashValue::Persist(base::Pickle* pickle) const {
+ return pickle->WriteBytes(data, sizeof(data));
+}
+
+bool SHA1HashValue::CreateFromPickle(base::PickleIterator* iter,
+ SHA1HashValue* hash) {
+ const char* outdata_char = NULL;
+ if (!iter->ReadBytes(&outdata_char, sizeof(hash->data)))
+ return false;
+ memcpy(&hash->data, outdata_char, sizeof(hash->data));
+ return true;
+}
+
bool SHA256HashValue::Equals(const SHA256HashValue& other) const {
return memcmp(data, other.data, sizeof(data)) == 0;
}

Powered by Google App Engine
This is Rietveld 408576698