summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-04 04:12:55 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-04 04:12:55 +0000
commit866c047e884c0d6f782ddbe8cee84c52efd1dc94 (patch)
tree494039f51fd001bbdf0eb4954a208634e8430adf /chrome/browser/safe_browsing
parent1d06a9d4459fbe76d5ea6e6a11e1f533768be4fb (diff)
downloadchromium_src-866c047e884c0d6f782ddbe8cee84c52efd1dc94.zip
chromium_src-866c047e884c0d6f782ddbe8cee84c52efd1dc94.tar.gz
chromium_src-866c047e884c0d6f782ddbe8cee84c52efd1dc94.tar.bz2
Enable SafeBrowsingDatabaseNew.
Convert from SafeBrowsingDatabaseBloom to SafeBrowsingDatabaseNew for default database. Shift histograms for SB2.AddPrefixes and SB2.SubPrefixes to the store, because the database can't see the sub count. Enable SB2.FailedUpdate for SafeBrowsingStoreSqlite to match bloom code. BUG=28647 TEST=none Review URL: http://codereview.chromium.org/3320009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58578 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_database.cc11
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_store_file.cc5
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc7
3 files changed, 16 insertions, 7 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc
index 76b40db..d649dcb 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database.cc
@@ -171,10 +171,12 @@ SafeBrowsingDatabase* SafeBrowsingDatabase::Create() {
return new SafeBrowsingDatabaseNew(new SafeBrowsingStoreFile);
} else if (!value.compare("newsqlite")) {
return new SafeBrowsingDatabaseNew(new SafeBrowsingStoreSqlite);
- } else {
- DCHECK(value.empty() || !value.compare("old"));
- // Default to the old implementation.
+ } else if (!value.compare("old")) {
return new SafeBrowsingDatabaseBloom;
+ } else {
+ // Default.
+ DCHECK(value.empty());
+ return new SafeBrowsingDatabaseNew(new SafeBrowsingStoreSqlite);
}
}
@@ -620,9 +622,6 @@ void SafeBrowsingDatabaseNew::UpdateFinished(bool update_succeeded) {
<< bloom_gen.InMilliseconds()
<< " ms total. prefix count: "<< add_prefixes.size();
UMA_HISTOGRAM_LONG_TIMES("SB2.BuildFilter", bloom_gen);
- UMA_HISTOGRAM_COUNTS("SB2.AddPrefixes", add_prefixes.size());
- // TODO(shess): Push this line into |store_|? Or ignore?
- // UMA_HISTOGRAM_COUNTS("SB2.SubPrefixes", subs);
UMA_HISTOGRAM_COUNTS("SB2.FilterSize", bloom_filter_->size());
int64 size_64;
if (file_util::GetFileSize(filename_, &size_64))
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.cc b/chrome/browser/safe_browsing/safe_browsing_store_file.cc
index 31a4337..de3d7ee 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_file.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_store_file.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/safe_browsing/safe_browsing_store_file.h"
#include "base/callback.h"
+#include "base/histogram.h"
#include "base/md5.h"
// TODO(shess): Remove after migration.
@@ -522,6 +523,10 @@ bool SafeBrowsingStoreFile::DoUpdate(
if (!file_util::Move(new_filename, filename_))
return false;
+ // Record counts before swapping to caller.
+ UMA_HISTOGRAM_COUNTS("SB2.AddPrefixes", add_prefixes.size());
+ UMA_HISTOGRAM_COUNTS("SB2.SubPrefixes", sub_prefixes.size());
+
// Pass the resulting data off to the caller.
add_prefixes_result->swap(add_prefixes);
add_full_hashes_result->swap(add_full_hashes);
diff --git a/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc b/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc
index b312f15..12b281b 100644
--- a/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_store_sqlite.cc
@@ -8,6 +8,7 @@
#include "base/callback.h"
#include "base/file_util.h"
+#include "base/histogram.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/sqlite_compiled_statement.h"
@@ -629,10 +630,14 @@ bool SafeBrowsingStoreSqlite::DoUpdate(
int rv = insert_transaction_->Commit();
if (rv != SQLITE_OK) {
NOTREACHED() << "SafeBrowsing update transaction failed to commit.";
- // UMA_HISTOGRAM_COUNTS("SB2.FailedUpdate", 1);
+ UMA_HISTOGRAM_COUNTS("SB2.FailedUpdate", 1);
return false;
}
+ // Record counts before swapping to caller.
+ UMA_HISTOGRAM_COUNTS("SB2.AddPrefixes", add_prefixes.size());
+ UMA_HISTOGRAM_COUNTS("SB2.SubPrefixes", sub_prefixes.size());
+
add_prefixes_result->swap(add_prefixes);
add_full_hashes_result->swap(add_full_hashes);