diff options
Diffstat (limited to 'chrome/browser/safe_browsing')
4 files changed, 14 insertions, 11 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_store.h b/chrome/browser/safe_browsing/safe_browsing_store.h index b6b44bd..418c55f 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store.h +++ b/chrome/browser/safe_browsing/safe_browsing_store.h @@ -69,7 +69,7 @@ struct SBAddFullHash { int32 received; SBFullHash full_hash; - SBAddFullHash(int32 id, base::Time r, SBFullHash h) + SBAddFullHash(int32 id, base::Time r, const SBFullHash& h) : chunk_id(id), received(static_cast<int32>(r.ToTimeT())), full_hash(h) { @@ -77,7 +77,7 @@ struct SBAddFullHash { // Provided for ReadAddHashes() implementations, which already have // an int32 for the time. - SBAddFullHash(int32 id, int32 r, SBFullHash h) + SBAddFullHash(int32 id, int32 r, const SBFullHash& h) : chunk_id(id), received(r), full_hash(h) {} SBAddFullHash() : chunk_id(), received(), full_hash() {} @@ -91,7 +91,7 @@ struct SBSubFullHash { int32 add_chunk_id; SBFullHash full_hash; - SBSubFullHash(int32 id, int32 add_id, SBFullHash h) + SBSubFullHash(int32 id, int32 add_id, const SBFullHash& h) : chunk_id(id), add_chunk_id(add_id), full_hash(h) {} SBSubFullHash() : chunk_id(), add_chunk_id(), full_hash() {} @@ -182,11 +182,12 @@ class SafeBrowsingStore { virtual bool WriteAddPrefix(int32 chunk_id, SBPrefix prefix) = 0; virtual bool WriteAddHash(int32 chunk_id, - base::Time receive_time, SBFullHash full_hash) = 0; + base::Time receive_time, + const SBFullHash& full_hash) = 0; virtual bool WriteSubPrefix(int32 chunk_id, int32 add_chunk_id, SBPrefix prefix) = 0; virtual bool WriteSubHash(int32 chunk_id, int32 add_chunk_id, - SBFullHash full_hash) = 0; + const SBFullHash& full_hash) = 0; // Collect the chunk data and preferrably store it on disk to // release memory. Shoul not modify the data in-place. diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.cc b/chrome/browser/safe_browsing/safe_browsing_store_file.cc index 196cf0d..71f415f 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_file.cc @@ -239,7 +239,7 @@ bool SafeBrowsingStoreFile::WriteAddPrefix(int32 chunk_id, SBPrefix prefix) { bool SafeBrowsingStoreFile::WriteAddHash(int32 chunk_id, base::Time receive_time, - SBFullHash full_hash) { + const SBFullHash& full_hash) { add_hashes_.push_back(SBAddFullHash(chunk_id, receive_time, full_hash)); return true; } @@ -252,7 +252,7 @@ bool SafeBrowsingStoreFile::WriteSubPrefix(int32 chunk_id, } bool SafeBrowsingStoreFile::WriteSubHash(int32 chunk_id, int32 add_chunk_id, - SBFullHash full_hash) { + const SBFullHash& full_hash) { sub_hashes_.push_back(SBSubFullHash(chunk_id, add_chunk_id, full_hash)); return true; } diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.h b/chrome/browser/safe_browsing/safe_browsing_store_file.h index cd0cee2..5ddc87a 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file.h +++ b/chrome/browser/safe_browsing/safe_browsing_store_file.h @@ -127,11 +127,12 @@ class SafeBrowsingStoreFile : public SafeBrowsingStore { virtual bool BeginChunk(); virtual bool WriteAddPrefix(int32 chunk_id, SBPrefix prefix); virtual bool WriteAddHash(int32 chunk_id, - base::Time receive_time, SBFullHash full_hash); + base::Time receive_time, + const SBFullHash& full_hash); virtual bool WriteSubPrefix(int32 chunk_id, int32 add_chunk_id, SBPrefix prefix); virtual bool WriteSubHash(int32 chunk_id, int32 add_chunk_id, - SBFullHash full_hash); + const SBFullHash& full_hash); virtual bool FinishChunk(); virtual bool BeginUpdate(); diff --git a/chrome/browser/safe_browsing/safe_browsing_store_sqlite.h b/chrome/browser/safe_browsing/safe_browsing_store_sqlite.h index 6f684c1d..60e7fda 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_sqlite.h +++ b/chrome/browser/safe_browsing/safe_browsing_store_sqlite.h @@ -37,7 +37,8 @@ class SafeBrowsingStoreSqlite : public SafeBrowsingStore { return WriteAddPrefixes(prefixes); } virtual bool WriteAddHash(int32 chunk_id, - base::Time receive_time, SBFullHash full_hash) { + base::Time receive_time, + const SBFullHash& full_hash) { const std::vector<SBAddFullHash> hashes(1, SBAddFullHash(chunk_id, receive_time, full_hash)); return WriteAddHashes(hashes); @@ -49,7 +50,7 @@ class SafeBrowsingStoreSqlite : public SafeBrowsingStore { return WriteSubPrefixes(prefixes); } virtual bool WriteSubHash(int32 chunk_id, int32 add_chunk_id, - SBFullHash full_hash) { + const SBFullHash& full_hash) { const std::vector<SBSubFullHash> hashes(1, SBSubFullHash(chunk_id, add_chunk_id, full_hash)); return WriteSubHashes(hashes); |