Skip to content

Commit

Permalink
A partially working implementation of a faster safe browsing implemen…
Browse files Browse the repository at this point in the history
…tation.

Review URL: http://codereview.chromium.org/5643

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2814 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
erikkay@google.com committed Oct 2, 2008
1 parent aa87dd3 commit aad0875
Show file tree
Hide file tree
Showing 10 changed files with 1,343 additions and 2 deletions.
1 change: 1 addition & 0 deletions chrome/browser/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ if env['PLATFORM'] == 'win32':
'safe_browsing/protocol_manager.cc',
'safe_browsing/safe_browsing_blocking_page.cc',
'safe_browsing/safe_browsing_database.cc',
'safe_browsing/safe_browsing_database_bloom.cc',
'safe_browsing/safe_browsing_database_impl.cc',
'safe_browsing/safe_browsing_service.cc',
'sandbox_policy.cc',
Expand Down
8 changes: 8 additions & 0 deletions chrome/browser/browser.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -1933,6 +1933,14 @@
RelativePath=".\safe_browsing\safe_browsing_database.h"
>
</File>
<File
RelativePath=".\safe_browsing\safe_browsing_database_bloom.cc"
>
</File>
<File
RelativePath=".\safe_browsing\safe_browsing_database_bloom.h"
>
</File>
<File
RelativePath=".\safe_browsing\safe_browsing_database_impl.cc"
>
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/safe_browsing/protocol_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ void SafeBrowsingProtocolManager::OnChunkInserted() {

if (chunk_request_urls_.empty()) {
UMA_HISTOGRAM_LONG_TIMES(L"SB.Update", Time::Now() - last_update_);
sb_service_->UpdateFinished();
} else {
IssueChunkRequest();
}
Expand Down
2 changes: 2 additions & 0 deletions chrome/browser/safe_browsing/safe_browsing_database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "base/logging.h"
#include "base/sha2.h"
#include "chrome/browser/safe_browsing/safe_browsing_database_impl.h"
#include "chrome/browser/safe_browsing/safe_browsing_database_bloom.h"
#include "googleurl/src/gurl.h"

// Filename suffix for the bloom filter.
Expand Down Expand Up @@ -90,3 +91,4 @@ void SafeBrowsingDatabase::WriteBloomFilter() {
SB_DLOG(INFO) << "SafeBrowsingDatabase wrote bloom filter in " <<
(Time::Now() - before).InMilliseconds() << " ms";
}

5 changes: 3 additions & 2 deletions chrome/browser/safe_browsing/safe_browsing_database.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ class SafeBrowsingDatabase {
// Called when the user's machine has resumed from a lower power state.
virtual void HandleResume() = 0;

virtual void UpdateFinished() { }

protected:
static std::wstring BloomFilterFilename(const std::wstring& db_filename);

Expand All @@ -93,10 +95,9 @@ class SafeBrowsingDatabase {

// Implementation specific bloom filter building.
virtual void BuildBloomFilter() = 0;
virtual void AddHostToBloomFilter(int host_key) = 0;

// Measuring false positive rate. Call this each time we look in the filter.
virtual void IncrementBloomFilterReadCount() = 0;
virtual void IncrementBloomFilterReadCount() {};

std::wstring bloom_filter_filename_;
scoped_ptr<BloomFilter> bloom_filter_;
Expand Down
Loading

0 comments on commit aad0875

Please sign in to comment.