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

Issue 2233103002: Move full hash caching logic to v4_get_hash_protocol_manager (Closed)

Created:
4 years, 4 months ago by vakh (use Gerrit instead)
Modified:
4 years, 3 months ago
CC:
chromium-reviews, noƩ, woz, francois_mozilla.com
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Move the logic to cache the full hash responses from the server into v4_get_hash_protocol_manager. Design doc: https://goto.google.com/design-doc-v4-full-hash-manager Overall, this CL does the following: 1. Moves caching to V4GetHashProtocolManager. 2. Refactors V4GetHashProtocolManager to use the data structures used in rest of the V4 code. 3. Re-defines how cache is implemented. TODOs: 1. Done: Merge the response from the server and the response from the cache. 2. Figure out what UMA metrics to add (I have removed some that are no longer valid after the refactor). BUG=616647, 543161 Committed: https://crrev.com/1d2b239717bd198bd42f11e468e1eaca6b94cdc1 Cr-Commit-Position: refs/heads/master@{#418303}

Patch Set 1 #

Total comments: 7

Patch Set 2 : hash_map<HashPrefix, hash_map<FullHash, FullHashExtraInfo>> #

Patch Set 3 : prefix->{pttl, [full_hash, store, metadata, pttl]} #

Patch Set 4 : fetch and sync and rebase #

Patch Set 5 : Implement merging cache results and results from the server #

Patch Set 6 : Remove unused code and tests #

Patch Set 7 : kcarattini: Remove RecordV4GetHashCheckResult function since it is not being used anymore #

Patch Set 8 : unique_ptr for V4GetHasProtocolManager. Fix the lone failing unit test. #

Total comments: 2

Patch Set 9 : Add a comment. Remove an unused method and an unused typedef. #

Patch Set 10 : Move another test from database_manager to get_hash_manager #

Total comments: 8

Patch Set 11 : Remove more tests from db_manager. Simplify another test. #

Patch Set 12 : Remove more tests from db_manager. Simplify another test. #

Total comments: 71

Patch Set 13 : Remove TestV4GetHashProtocolManager from db_mgr_unittest. Add another unittest. #

Patch Set 14 : Incoorporate nparker@'s feedback #

Patch Set 15 : Bring back the histogram to check if there were any hits in the response from the server #

Total comments: 23

Patch Set 16 : shess@ feedback. Remove a comment about UMA. #

Patch Set 17 : shess@ feedback - part 2. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1597 lines, -1304 lines) Patch
M components/safe_browsing_db/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +52 lines, -0 lines 0 comments Download
M components/safe_browsing_db/database_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +9 lines, -58 lines 0 comments Download
M components/safe_browsing_db/database_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +20 lines, -278 lines 0 comments Download
M components/safe_browsing_db/database_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 6 chunks +50 lines, -440 lines 0 comments Download
M components/safe_browsing_db/testing_util.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -11 lines 0 comments Download
M components/safe_browsing_db/util.h View 1 1 chunk +3 lines, -0 lines 0 comments Download
M components/safe_browsing_db/util.cc View 1 1 chunk +10 lines, -0 lines 0 comments Download
M components/safe_browsing_db/v4_database.h View 1 2 2 chunks +10 lines, -5 lines 0 comments Download
M components/safe_browsing_db/v4_database.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +3 lines, -2 lines 0 comments Download
M components/safe_browsing_db/v4_database_unittest.cc View 1 2 3 4 4 chunks +22 lines, -17 lines 0 comments Download
M components/safe_browsing_db/v4_get_hash_protocol_manager.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 4 chunks +219 lines, -57 lines 0 comments Download
M components/safe_browsing_db/v4_get_hash_protocol_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 8 chunks +519 lines, -190 lines 0 comments Download
M components/safe_browsing_db/v4_get_hash_protocol_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 12 chunks +506 lines, -194 lines 0 comments Download
M components/safe_browsing_db/v4_local_database_manager.h View 1 2 2 chunks +3 lines, -0 lines 0 comments Download
M components/safe_browsing_db/v4_local_database_manager.cc View 1 2 3 chunks +23 lines, -11 lines 0 comments Download
M components/safe_browsing_db/v4_local_database_manager_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +16 lines, -13 lines 0 comments Download
M components/safe_browsing_db/v4_protocol_manager_util.h View 1 2 3 4 5 6 7 8 5 chunks +68 lines, -11 lines 0 comments Download
M components/safe_browsing_db/v4_protocol_manager_util.cc View 1 2 3 4 5 6 7 2 chunks +59 lines, -6 lines 0 comments Download
M components/safe_browsing_db/v4_store.h View 1 1 chunk +0 lines, -4 lines 0 comments Download
M components/safe_browsing_db/v4_store.cc View 1 1 chunk +0 lines, -7 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 2 chunks +4 lines, -0 lines 0 comments Download

Messages

Total messages: 129 (82 generated)
vakh (use Gerrit instead)
4 years, 4 months ago (2016-08-10 19:57:24 UTC) #2
Nathan Parker
I'll let kcarattini review the caching logic parts. https://codereview.chromium.org/2233103002/diff/1/components/safe_browsing_db/database_manager.cc File components/safe_browsing_db/database_manager.cc (right): https://codereview.chromium.org/2233103002/diff/1/components/safe_browsing_db/database_manager.cc#newcode133 components/safe_browsing_db/database_manager.cc:133: v4_get_hash_protocol_manager_->GetFullHashCachedResults(SB_THREAT_TYPE_API_ABUSE, ...
4 years, 4 months ago (2016-08-15 19:54:47 UTC) #4
vakh (use Gerrit instead)
Sorry, this CL wasn't meant to be reviewed. I worked on this but ended up ...
4 years, 4 months ago (2016-08-16 00:52:42 UTC) #6
chromium-reviews
Ah ok. I tend to review anything with my name attached as reviewer. On Mon, ...
4 years, 4 months ago (2016-08-19 17:17:32 UTC) #7
vakh (use Gerrit instead)
Product code working :) -- Tests not so much :(
4 years, 3 months ago (2016-08-27 01:17:41 UTC) #8
vakh (use Gerrit instead)
Added comments. Ordered functions alphabetically.
4 years, 3 months ago (2016-08-27 01:48:27 UTC) #9
vakh (use Gerrit instead)
Got more tests running.
4 years, 3 months ago (2016-08-29 23:46:22 UTC) #10
vakh (use Gerrit instead)
I'm bringing this CL back from the dead. This is a major refactor that: 1. ...
4 years, 3 months ago (2016-08-29 23:55:47 UTC) #11
vakh (use Gerrit instead)
4 years, 3 months ago (2016-08-29 23:56:13 UTC) #13
vakh (use Gerrit instead)
hash_map<HashPrefix, hash_map<FullHash, FullHashExtraInfo>>
4 years, 3 months ago (2016-08-30 20:31:53 UTC) #16
Nathan Parker
Per discussion offline: Hold off on reviewing this till the doc and code are adjusted.
4 years, 3 months ago (2016-09-01 20:49:30 UTC) #17
vakh (use Gerrit instead)
prefix->{pttl, [full_hash, store, metadata, pttl]}
4 years, 3 months ago (2016-09-06 21:02:28 UTC) #18
vakh (use Gerrit instead)
fetch and sync and rebase
4 years, 3 months ago (2016-09-07 01:23:26 UTC) #23
vakh (use Gerrit instead)
Implement merging cache results and results from the server
4 years, 3 months ago (2016-09-07 01:34:09 UTC) #24
vakh (use Gerrit instead)
Minor BUILD.gn fixes
4 years, 3 months ago (2016-09-07 01:54:25 UTC) #29
vakh (use Gerrit instead)
Remove unused code and tests
4 years, 3 months ago (2016-09-07 02:01:36 UTC) #36
vakh (use Gerrit instead)
Minor BUILD.gn fixes
4 years, 3 months ago (2016-09-07 02:03:52 UTC) #39
vakh (use Gerrit instead)
Minor BUILD.gn fixes
4 years, 3 months ago (2016-09-07 19:04:55 UTC) #44
vakh (use Gerrit instead)
kcarattini: Remove RecordV4GetHashCheckResult function since it is not being used anymore
4 years, 3 months ago (2016-09-07 22:38:52 UTC) #54
vakh (use Gerrit instead)
I've re-written most of the code from patches 1 and 2 so please review with ...
4 years, 3 months ago (2016-09-07 23:00:42 UTC) #58
vakh (use Gerrit instead)
unique_ptr for V4GetHasProtocolManager. Fix the lone failing unit test.
4 years, 3 months ago (2016-09-08 17:22:31 UTC) #61
vakh (use Gerrit instead)
Add a comment. Remove an unused method and an unused typedef.
4 years, 3 months ago (2016-09-08 20:54:42 UTC) #66
vakh (use Gerrit instead)
Move another test from database_manager to get_hash_manager
4 years, 3 months ago (2016-09-09 00:24:41 UTC) #71
vakh (use Gerrit instead)
Remove more tests from db_manager. Simplify another test.
4 years, 3 months ago (2016-09-09 00:51:17 UTC) #76
vakh (use Gerrit instead)
Remove more tests from db_manager. Simplify another test.
4 years, 3 months ago (2016-09-09 00:53:07 UTC) #79
vakh (use Gerrit instead)
Remove TestV4GetHashProtocolManager from db_mgr_unittest. Add another unittest.
4 years, 3 months ago (2016-09-09 20:33:42 UTC) #84
Nathan Parker
Lots of code! Overall LGTM, with lots of mostly-little nits. My comments came in over ...
4 years, 3 months ago (2016-09-09 21:26:22 UTC) #87
vakh (use Gerrit instead)
Incoorporate nparker@'s feedback
4 years, 3 months ago (2016-09-09 23:24:53 UTC) #90
vakh (use Gerrit instead)
Thanks for the quick review. I've incorporated all feedback, except the histogram change. PTAL. https://codereview.chromium.org/2233103002/diff/260001/components/safe_browsing_db/BUILD.gn ...
4 years, 3 months ago (2016-09-09 23:25:18 UTC) #92
vakh (use Gerrit instead)
+francois@mozilla.com Scott, Kendra: Could you also please take a look? Thanks.
4 years, 3 months ago (2016-09-09 23:59:29 UTC) #95
Nathan Parker
https://codereview.chromium.org/2233103002/diff/340001/components/safe_browsing_db/v4_get_hash_protocol_manager.cc File components/safe_browsing_db/v4_get_hash_protocol_manager.cc (right): https://codereview.chromium.org/2233103002/diff/340001/components/safe_browsing_db/v4_get_hash_protocol_manager.cc#newcode338 components/safe_browsing_db/v4_get_hash_protocol_manager.cc:338: for (const auto& it : full_hash_to_store_and_hash_prefixes) { On 2016/09/09 ...
4 years, 3 months ago (2016-09-10 00:26:25 UTC) #96
vakh (use Gerrit instead)
https://codereview.chromium.org/2233103002/diff/340001/components/safe_browsing_db/v4_get_hash_protocol_manager.cc File components/safe_browsing_db/v4_get_hash_protocol_manager.cc (right): https://codereview.chromium.org/2233103002/diff/340001/components/safe_browsing_db/v4_get_hash_protocol_manager.cc#newcode338 components/safe_browsing_db/v4_get_hash_protocol_manager.cc:338: for (const auto& it : full_hash_to_store_and_hash_prefixes) { On 2016/09/10 ...
4 years, 3 months ago (2016-09-10 00:29:29 UTC) #97
vakh (use Gerrit instead)
Bring back the histogram to check if there were any hits in the response from ...
4 years, 3 months ago (2016-09-10 01:02:01 UTC) #100
vakh (use Gerrit instead)
+holte@ for histograms.xml
4 years, 3 months ago (2016-09-10 01:03:23 UTC) #104
vakh (use Gerrit instead)
https://codereview.chromium.org/2233103002/diff/340001/tools/metrics/histograms/histograms.xml File tools/metrics/histograms/histograms.xml (left): https://codereview.chromium.org/2233103002/diff/340001/tools/metrics/histograms/histograms.xml#oldcode49627 tools/metrics/histograms/histograms.xml:49627: -<histogram name="SafeBrowsing.V4GetHashCheckResult" On 2016/09/09 21:26:22, Nathan Parker wrote: > ...
4 years, 3 months ago (2016-09-10 01:04:11 UTC) #105
Nathan Parker
lgtm https://codereview.chromium.org/2233103002/diff/340001/components/safe_browsing_db/v4_get_hash_protocol_manager.cc File components/safe_browsing_db/v4_get_hash_protocol_manager.cc (right): https://codereview.chromium.org/2233103002/diff/340001/components/safe_browsing_db/v4_get_hash_protocol_manager.cc#newcode344 components/safe_browsing_db/v4_get_hash_protocol_manager.cc:344: const auto& prefix_entry = full_hash_cache_.find(prefix); On 2016/09/10 00:29:29, ...
4 years, 3 months ago (2016-09-12 17:02:07 UTC) #108
Scott Hess - ex-Googler
lgtm. Your call on the minor nits. I'm feeling like this is getting far enough ...
4 years, 3 months ago (2016-09-12 23:31:35 UTC) #109
vakh (use Gerrit instead)
shess@ feedback. Remove a comment about UMA.
4 years, 3 months ago (2016-09-13 00:09:49 UTC) #110
vakh (use Gerrit instead)
Thanks for the review, shess@ holte@ -- could you please review the histograms? Thanks. https://codereview.chromium.org/2233103002/diff/340001/components/safe_browsing_db/v4_get_hash_protocol_manager.cc ...
4 years, 3 months ago (2016-09-13 00:12:07 UTC) #113
Scott Hess - ex-Googler
still lgtm... https://codereview.chromium.org/2233103002/diff/340001/components/safe_browsing_db/v4_get_hash_protocol_manager.cc File components/safe_browsing_db/v4_get_hash_protocol_manager.cc (right): https://codereview.chromium.org/2233103002/diff/340001/components/safe_browsing_db/v4_get_hash_protocol_manager.cc#newcode344 components/safe_browsing_db/v4_get_hash_protocol_manager.cc:344: const auto& prefix_entry = full_hash_cache_.find(prefix); On 2016/09/13 ...
4 years, 3 months ago (2016-09-13 00:31:35 UTC) #114
vakh (use Gerrit instead)
shess@ feedback - part 2.
4 years, 3 months ago (2016-09-13 01:10:21 UTC) #115
vakh (use Gerrit instead)
https://codereview.chromium.org/2233103002/diff/340001/components/safe_browsing_db/v4_get_hash_protocol_manager.cc File components/safe_browsing_db/v4_get_hash_protocol_manager.cc (right): https://codereview.chromium.org/2233103002/diff/340001/components/safe_browsing_db/v4_get_hash_protocol_manager.cc#newcode344 components/safe_browsing_db/v4_get_hash_protocol_manager.cc:344: const auto& prefix_entry = full_hash_cache_.find(prefix); On 2016/09/13 00:31:34, Scott ...
4 years, 3 months ago (2016-09-13 01:18:56 UTC) #118
Steven Holte
histograms lgtm
4 years, 3 months ago (2016-09-13 17:40:40 UTC) #121
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2233103002/440001
4 years, 3 months ago (2016-09-13 18:16:51 UTC) #124
commit-bot: I haz the power
Committed patchset #17 (id:440001)
4 years, 3 months ago (2016-09-13 18:24:17 UTC) #126
commit-bot: I haz the power
Patchset 17 (id:??) landed as https://crrev.com/1d2b239717bd198bd42f11e468e1eaca6b94cdc1 Cr-Commit-Position: refs/heads/master@{#418303}
4 years, 3 months ago (2016-09-13 18:26:10 UTC) #128
kcarattini
4 years, 3 months ago (2016-09-14 05:35:45 UTC) #129
Message was sent while issue was closed.
lgtm

Sorry for the delay. Thanks for doing this!

Kendra

Powered by Google App Engine
This is Rietveld 408576698