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

Unified Diff: chrome/browser/safe_browsing/database_manager.cc

Issue 924543002: Add "light speed" experiment code for SafeBrowsing service. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update. Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/database_manager.cc
diff --git a/chrome/browser/safe_browsing/database_manager.cc b/chrome/browser/safe_browsing/database_manager.cc
index 2f89931e50aebce92e15a1c38d6b39a257741cfc..f138a3305d12e8cf3f55d2019702bc417738a343 100644
--- a/chrome/browser/safe_browsing/database_manager.cc
+++ b/chrome/browser/safe_browsing/database_manager.cc
@@ -30,6 +30,7 @@
#include "chrome/common/chrome_switches.h"
#include "components/metrics/metrics_service.h"
#include "components/startup_metric_utils/startup_metric_utils.h"
+#include "components/variations/variations_associated_data.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_service.h"
#include "url/url_constants.h"
@@ -167,6 +168,14 @@ SBThreatType GetThreatTypeFromListType(safe_browsing_util::ListType list_type) {
}
}
+// TODO(asvitkine): Experimental code for measuring start up impact of SB.
+// Remove when experimentation is complete. http://crbug.com/450037
+bool ShouldDisableSafeBrowsing() {
+ static bool disable_sb =
gab 2015/02/13 18:09:35 DCHECK_CURRENTLY_ON(BrowserThread::IO); since a s
Alexei Svitkine (slow) 2015/02/13 19:00:08 Done.
+ !variations::GetVariationParamValue("LightSpeed", "DisableSB").empty();
+ return disable_sb;
+}
+
} // namespace
// static
@@ -593,6 +602,10 @@ void SafeBrowsingDatabaseManager::HandleGetHashResults(
void SafeBrowsingDatabaseManager::GetChunks(GetChunksCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ if (ShouldDisableSafeBrowsing())
+ return;
+
DCHECK(enabled_);
DCHECK(!callback.is_null());
safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, base::Bind(
@@ -604,6 +617,10 @@ void SafeBrowsingDatabaseManager::AddChunks(
scoped_ptr<ScopedVector<SBChunkData> > chunks,
AddChunksCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ if (ShouldDisableSafeBrowsing())
+ return;
+
DCHECK(enabled_);
DCHECK(!callback.is_null());
safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, base::Bind(
@@ -614,6 +631,10 @@ void SafeBrowsingDatabaseManager::AddChunks(
void SafeBrowsingDatabaseManager::DeleteChunks(
scoped_ptr<std::vector<SBChunkDelete> > chunk_deletes) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ if (ShouldDisableSafeBrowsing())
+ return;
+
DCHECK(enabled_);
safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, base::Bind(
&SafeBrowsingDatabaseManager::DeleteDatabaseChunks, this,
@@ -622,6 +643,10 @@ void SafeBrowsingDatabaseManager::DeleteChunks(
void SafeBrowsingDatabaseManager::UpdateStarted() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+ if (ShouldDisableSafeBrowsing())
+ return;
+
DCHECK(enabled_);
DCHECK(!update_in_progress_);
update_in_progress_ = true;
@@ -650,6 +675,9 @@ void SafeBrowsingDatabaseManager::StartOnIOThread() {
if (enabled_)
return;
+ if (ShouldDisableSafeBrowsing())
+ return;
+
DCHECK(!safe_browsing_thread_.get());
safe_browsing_thread_.reset(new base::Thread("Chrome_SafeBrowsingThread"));
if (!safe_browsing_thread_->Start())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698