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

Side by Side 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: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/safe_browsing/database_manager.h" 5 #include "chrome/browser/safe_browsing/database_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/safe_browsing/malware_details.h" 23 #include "chrome/browser/safe_browsing/malware_details.h"
24 #include "chrome/browser/safe_browsing/protocol_manager.h" 24 #include "chrome/browser/safe_browsing/protocol_manager.h"
25 #include "chrome/browser/safe_browsing/safe_browsing_database.h" 25 #include "chrome/browser/safe_browsing/safe_browsing_database.h"
26 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 26 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
27 #include "chrome/browser/safe_browsing/ui_manager.h" 27 #include "chrome/browser/safe_browsing/ui_manager.h"
28 #include "chrome/common/chrome_constants.h" 28 #include "chrome/common/chrome_constants.h"
29 #include "chrome/common/chrome_paths.h" 29 #include "chrome/common/chrome_paths.h"
30 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
31 #include "components/metrics/metrics_service.h" 31 #include "components/metrics/metrics_service.h"
32 #include "components/startup_metric_utils/startup_metric_utils.h" 32 #include "components/startup_metric_utils/startup_metric_utils.h"
33 #include "components/variations/variations_associated_data.h"
33 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
34 #include "content/public/browser/notification_service.h" 35 #include "content/public/browser/notification_service.h"
35 #include "url/url_constants.h" 36 #include "url/url_constants.h"
36 37
37 using content::BrowserThread; 38 using content::BrowserThread;
38 39
39 namespace { 40 namespace {
40 41
41 // Timeout for match checks, e.g. download URLs, hashes. 42 // Timeout for match checks, e.g. download URLs, hashes.
42 const int kCheckTimeoutMs = 10000; 43 const int kCheckTimeoutMs = 10000;
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 DCHECK(enabled_); 644 DCHECK(enabled_);
644 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, base::Bind( 645 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, base::Bind(
645 &SafeBrowsingDatabaseManager::OnResetDatabase, this)); 646 &SafeBrowsingDatabaseManager::OnResetDatabase, this));
646 } 647 }
647 648
648 void SafeBrowsingDatabaseManager::StartOnIOThread() { 649 void SafeBrowsingDatabaseManager::StartOnIOThread() {
649 DCHECK_CURRENTLY_ON(BrowserThread::IO); 650 DCHECK_CURRENTLY_ON(BrowserThread::IO);
650 if (enabled_) 651 if (enabled_)
651 return; 652 return;
652 653
654 // TODO(asvitkine): Experimental code for measuring start up impact of SB.
655 // Remove when experimentation is complete. http://crbug.com/416219
gab 2015/02/12 16:57:00 Wrong bug #, should be 450037, right?
Alexei Svitkine (slow) 2015/02/12 17:27:12 Done.
656 if (!variations::GetVariationParamValue("LightSpeed", "DisableSB").empty())
gab 2015/02/12 16:57:00 So the experiment name is "LightSpeed" and it has
Alexei Svitkine (slow) 2015/02/12 17:27:12 This is using the parameters support in the variat
gab 2015/02/12 17:35:42 Oh very cool! SGTM The one thing I'm worried abou
Alexei Svitkine (slow) 2015/02/12 17:47:56 Right, it depends how many we want to run in paral
gab 2015/02/12 18:26:58 Okay SGTM.
657 return;
658
653 DCHECK(!safe_browsing_thread_.get()); 659 DCHECK(!safe_browsing_thread_.get());
654 safe_browsing_thread_.reset(new base::Thread("Chrome_SafeBrowsingThread")); 660 safe_browsing_thread_.reset(new base::Thread("Chrome_SafeBrowsingThread"));
655 if (!safe_browsing_thread_->Start()) 661 if (!safe_browsing_thread_->Start())
656 return; 662 return;
657 enabled_ = true; 663 enabled_ = true;
658 664
659 MakeDatabaseAvailable(); 665 MakeDatabaseAvailable();
660 } 666 }
661 667
662 void SafeBrowsingDatabaseManager::StopOnIOThread(bool shutdown) { 668 void SafeBrowsingDatabaseManager::StopOnIOThread(bool shutdown) {
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this)); 1175 new base::WeakPtrFactory<SafeBrowsingDatabaseManager>(this));
1170 checks_.insert(check); 1176 checks_.insert(check);
1171 1177
1172 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task); 1178 safe_browsing_thread_->message_loop()->PostTask(FROM_HERE, task);
1173 1179
1174 base::MessageLoop::current()->PostDelayedTask(FROM_HERE, 1180 base::MessageLoop::current()->PostDelayedTask(FROM_HERE,
1175 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback, 1181 base::Bind(&SafeBrowsingDatabaseManager::TimeoutCallback,
1176 check->timeout_factory_->GetWeakPtr(), check), 1182 check->timeout_factory_->GetWeakPtr(), check),
1177 check_timeout_); 1183 check_timeout_);
1178 } 1184 }
OLDNEW
« 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