diff options
author | henrika <henrika@chromium.org> | 2016-02-18 01:49:37 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-18 09:50:53 +0000 |
commit | 8a7a2d7a721542025da871c789fe858f3bde1211 (patch) | |
tree | 3e7cdd6ccb97648fc682c20c69755cb2cbaf86e6 | |
parent | 10284b9e09824f6e8ae5437808dbdbdc9cdabea4 (diff) | |
download | chromium_src-8a7a2d7a721542025da871c789fe858f3bde1211.zip chromium_src-8a7a2d7a721542025da871c789fe858f3bde1211.tar.gz chromium_src-8a7a2d7a721542025da871c789fe858f3bde1211.tar.bz2 |
Revert of SafeBrowsing: DatabaseManager owns the V4GetHashProtocolManager (patchset #6 id:100001 of https://codereview.chromium.org/1700943003/ )
Reason for revert:
Speculative revert as Chrome sheriff. I suspect that this CL causes tons of tests on Mac to fail. See e.g. https://uberchromegw.corp.google.com/i/chromium.mac/builders/Mac10.9%20Tests%20%28dbg%29/builds/19690
Callstacks in all failing tests contains references to SafeBrowsing.
1 libbase.dylib 0x00000001195efbc3 _ZN4base5debug10StackTraceC1Ev + 35
2 sync_integration_tests 0x000000010a77225a _ZN4base5debug11LeakTrackerI29SystemURLRequestContextGetterEC2Ev + 58
3 sync_integration_tests 0x000000010a757783 _ZN4base5debug11LeakTrackerI29SystemURLRequestContextGetterEC1Ev + 35
4 sync_integration_tests 0x000000010a757739 _ZN29SystemURLRequestContextGetterC2EP8IOThread + 105
5 sync_integration_tests 0x000000010a7577db _ZN29SystemURLRequestContextGetterC1EP8IOThread + 43
6 sync_integration_tests 0x000000010a75c9a6 _ZN8IOThread24InitSystemRequestContextEv + 246
7 sync_integration_tests 0x000000010a75c866 _ZN8IOThread33system_url_request_context_getterEv + 358
8 sync_integration_tests 0x000000010a9b7cae _ZN18BrowserProcessImpl22system_request_contextEv + 270
9 sync_integration_tests 0x000000010b1c0e55 _ZN13safe_browsing19SafeBrowsingService10InitializeEv + 101
10 sync_integration_tests 0x000000010a9bc17b _ZN18BrowserProcessImpl25CreateSafeBrowsingServiceEv + 331
11 sync_integration_tests 0x000000010a9bbfe3 _ZN18BrowserProcessImpl21safe_browsing_serviceEv + 275
12 sync_integration_tests 0x000000010a8acf61 _ZN36ChromeResourceDispatcherHostDelegateC2Ev + 177
13 sync_integration_tests 0x000000010a8ad1d3 _ZN36ChromeResourceDispatcherHostDelegateC1Ev + 35
14 sync_integration_tests 0x000000010a9bcda5 _ZN18BrowserProcessImpl29ResourceDispatcherHostCreatedEv + 117
15 sync_integration_tests 0x000000010a6141c0 _ZN26ChromeContentBrowserClient29ResourceDispatcherHostCreatedEv + 320
16 libcontent.dylib 0x00000001212ba928 _ZN7content26ResourceDispatcherHostImplC2Ev + 1320
17 libcontent.dylib 0x00000001212baf63 _ZN7content26ResourceDispatcherHostImplC1Ev + 35
Original issue's description:
> SafeBrowsing: DatabaseManager owns the V4GetHashProtocolManager
>
> BUG=543161,561867
>
> Committed: https://crrev.com/95bba9fad50442a9ce7ae4fbcc50d1d845d5d399
> Cr-Commit-Position: refs/heads/master@{#376088}
TBR=nparker@chromium.org,vakh@chromium.org,kcarattini@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=543161,561867
Review URL: https://codereview.chromium.org/1709943002
Cr-Commit-Position: refs/heads/master@{#376131}
-rw-r--r-- | chrome/browser/safe_browsing/local_database_manager.cc | 13 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/local_database_manager.h | 9 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_service.cc | 56 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_service.h | 7 | ||||
-rw-r--r-- | components/safe_browsing_db/BUILD.gn | 5 | ||||
-rw-r--r-- | components/safe_browsing_db/database_manager.cc | 19 | ||||
-rw-r--r-- | components/safe_browsing_db/database_manager.h | 19 | ||||
-rw-r--r-- | components/safe_browsing_db/remote_database_manager.cc | 10 | ||||
-rw-r--r-- | components/safe_browsing_db/remote_database_manager.h | 13 |
9 files changed, 22 insertions, 129 deletions
diff --git a/chrome/browser/safe_browsing/local_database_manager.cc b/chrome/browser/safe_browsing/local_database_manager.cc index 221d5d7..9763d6e 100644 --- a/chrome/browser/safe_browsing/local_database_manager.cc +++ b/chrome/browser/safe_browsing/local_database_manager.cc @@ -33,7 +33,6 @@ #include "chrome/common/pref_names.h" #include "components/prefs/pref_service.h" #include "components/safe_browsing_db/util.h" -#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "url/url_constants.h" @@ -261,16 +260,8 @@ void LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck:: } LocalSafeBrowsingDatabaseManager::LocalSafeBrowsingDatabaseManager( - const scoped_refptr<SafeBrowsingService>& service) : - LocalSafeBrowsingDatabaseManager(service, NULL, V4GetHashProtocolConfig()) { -} - -LocalSafeBrowsingDatabaseManager::LocalSafeBrowsingDatabaseManager( - const scoped_refptr<SafeBrowsingService>& service, - net::URLRequestContextGetter* request_context_getter, - const V4GetHashProtocolConfig& config) - : SafeBrowsingDatabaseManager(request_context_getter, config), - sb_service_(service), + const scoped_refptr<SafeBrowsingService>& service) + : sb_service_(service), database_(NULL), enabled_(false), enable_download_protection_(false), diff --git a/chrome/browser/safe_browsing/local_database_manager.h b/chrome/browser/safe_browsing/local_database_manager.h index 3798256..ef543e9 100644 --- a/chrome/browser/safe_browsing/local_database_manager.h +++ b/chrome/browser/safe_browsing/local_database_manager.h @@ -41,7 +41,6 @@ class SafeBrowsingService; class SafeBrowsingDatabase; class ClientSideDetectionService; class DownloadProtectionService; -struct V4GetHashProtocolConfig; // Implemetation that manages a local database on disk. // @@ -97,16 +96,10 @@ class LocalSafeBrowsingDatabaseManager DISALLOW_COPY_AND_ASSIGN(SafeBrowsingCheck); }; - // Use this constructor for testing only. + // Creates the safe browsing service. Need to initialize before using. explicit LocalSafeBrowsingDatabaseManager( const scoped_refptr<SafeBrowsingService>& service); - // Creates the safe browsing service. Need to initialize before using. - LocalSafeBrowsingDatabaseManager( - const scoped_refptr<SafeBrowsingService>& service, - net::URLRequestContextGetter* request_context_getter, - const V4GetHashProtocolConfig& config); - // // SafeBrowsingDatabaseManager overrides // diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 6299f09..67f3f2f 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -31,7 +31,6 @@ #include "chrome/browser/safe_browsing/download_protection_service.h" #include "chrome/browser/safe_browsing/ping_manager.h" #include "chrome/browser/safe_browsing/protocol_manager.h" -#include "chrome/browser/safe_browsing/protocol_manager_helper.h" #include "chrome/browser/safe_browsing/ui_manager.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" @@ -41,12 +40,10 @@ #include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_service.h" #include "components/safe_browsing_db/database_manager.h" -#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" #include "components/user_prefs/tracked/tracked_preference_validation_delegate.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/cookie_store_factory.h" #include "content/public/browser/notification_service.h" -#include "google_apis/google_api_keys.h" #include "net/cookies/cookie_store.h" #include "net/extras/sqlite/cookie_crypto_delegate.h" #include "net/url_request/url_request_context.h" @@ -402,13 +399,10 @@ SafeBrowsingUIManager* SafeBrowsingService::CreateUIManager() { } SafeBrowsingDatabaseManager* SafeBrowsingService::CreateDatabaseManager() { - V4GetHashProtocolConfig config = GetV4GetHashProtocolConfig(); #if defined(SAFE_BROWSING_DB_LOCAL) - return new LocalSafeBrowsingDatabaseManager(this, - url_request_context_getter_.get(), config); + return new LocalSafeBrowsingDatabaseManager(this); #elif defined(SAFE_BROWSING_DB_REMOTE) - return new RemoteSafeBrowsingDatabaseManager( - url_request_context_getter_.get(), config); + return new RemoteSafeBrowsingDatabaseManager(); #else return NULL; #endif @@ -434,55 +428,37 @@ void SafeBrowsingService::RegisterAllDelayedAnalysis() { SafeBrowsingProtocolConfig SafeBrowsingService::GetProtocolConfig() const { SafeBrowsingProtocolConfig config; - config.client_name = GetProtocolConfigClientName(); - - base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); - config.disable_auto_update = - cmdline->HasSwitch(switches::kSbDisableAutoUpdate) || - cmdline->HasSwitch(switches::kDisableBackgroundNetworking); - config.url_prefix = kSbDefaultURLPrefix; - config.backup_connect_error_url_prefix = kSbBackupConnectErrorURLPrefix; - config.backup_http_error_url_prefix = kSbBackupHttpErrorURLPrefix; - config.backup_network_error_url_prefix = kSbBackupNetworkErrorURLPrefix; - - return config; -} - -V4GetHashProtocolConfig -SafeBrowsingService::GetV4GetHashProtocolConfig() const { - V4GetHashProtocolConfig config; - config.client_name = GetProtocolConfigClientName(); - config.version = SafeBrowsingProtocolManagerHelper::Version(); - config.key_param = google_apis::GetAPIKey();; - - return config; -} - -std::string SafeBrowsingService::GetProtocolConfigClientName() const { - std::string client_name; // On Windows, get the safe browsing client name from the browser // distribution classes in installer util. These classes don't yet have // an analog on non-Windows builds so just keep the name specified here. #if defined(OS_WIN) BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - client_name = dist->GetSafeBrowsingName(); + config.client_name = dist->GetSafeBrowsingName(); #else #if defined(GOOGLE_CHROME_BUILD) - client_name = "googlechrome"; + config.client_name = "googlechrome"; #else - client_name = "chromium"; + config.client_name = "chromium"; #endif // Mark client string to allow server to differentiate mobile. #if defined(OS_ANDROID) - client_name.append("-a"); + config.client_name.append("-a"); #elif defined(OS_IOS) - client_name.append("-i"); + config.client_name.append("-i"); #endif #endif // defined(OS_WIN) + base::CommandLine* cmdline = base::CommandLine::ForCurrentProcess(); + config.disable_auto_update = + cmdline->HasSwitch(switches::kSbDisableAutoUpdate) || + cmdline->HasSwitch(switches::kDisableBackgroundNetworking); + config.url_prefix = kSbDefaultURLPrefix; + config.backup_connect_error_url_prefix = kSbBackupConnectErrorURLPrefix; + config.backup_http_error_url_prefix = kSbBackupHttpErrorURLPrefix; + config.backup_network_error_url_prefix = kSbBackupNetworkErrorURLPrefix; - return client_name; + return config; } // Any tests that create a DatabaseManager that isn't derived from diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h index 3c3435d..ec8d59c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.h +++ b/chrome/browser/safe_browsing/safe_browsing_service.h @@ -58,7 +58,6 @@ class SafeBrowsingProtocolManagerDelegate; class SafeBrowsingServiceFactory; class SafeBrowsingUIManager; class SafeBrowsingURLRequestContextGetter; -struct V4GetHashProtocolConfig; #if defined(FULL_SAFE_BROWSING) class IncidentReportingService; @@ -104,12 +103,6 @@ class SafeBrowsingService // Create a protocol config struct. virtual SafeBrowsingProtocolConfig GetProtocolConfig() const; - // Create a v4 protocol config struct. - virtual V4GetHashProtocolConfig GetV4GetHashProtocolConfig() const; - - // Returns the client_name field for both V3 and V4 protocol manager configs. - std::string GetProtocolConfigClientName() const; - // Get current enabled status. Must be called on IO thread. bool enabled() const { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); diff --git a/components/safe_browsing_db/BUILD.gn b/components/safe_browsing_db/BUILD.gn index 5a58fe2..ad32884 100644 --- a/components/safe_browsing_db/BUILD.gn +++ b/components/safe_browsing_db/BUILD.gn @@ -49,12 +49,9 @@ source_set("database_manager") { ] deps = [ ":hit_report", - ":proto", ":util", - ":v4_get_hash_protocol_manager", "//base:base", "//content/public/common", - "//net", "//url:url", ] } @@ -103,9 +100,7 @@ source_set("remote_database_manager") { ] deps = [ ":database_manager", - ":proto", ":safe_browsing_api_handler", - ":v4_get_hash_protocol_manager", "//base:base", "//components/variations", "//content/public/browser", diff --git a/components/safe_browsing_db/database_manager.cc b/components/safe_browsing_db/database_manager.cc index 6412cf0..b818722 100644 --- a/components/safe_browsing_db/database_manager.cc +++ b/components/safe_browsing_db/database_manager.cc @@ -4,29 +4,10 @@ #include "components/safe_browsing_db/database_manager.h" -#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" -#include "net/url_request/url_request_context_getter.h" #include "url/gurl.h" namespace safe_browsing { -SafeBrowsingDatabaseManager::SafeBrowsingDatabaseManager() - : SafeBrowsingDatabaseManager(NULL, V4GetHashProtocolConfig()) { -} - -SafeBrowsingDatabaseManager::SafeBrowsingDatabaseManager( - net::URLRequestContextGetter* request_context_getter, - const V4GetHashProtocolConfig& config) { - // Instantiate a V4GetHashProtocolManager. - if (request_context_getter) { - v4_get_hash_protocol_manager_.reset(V4GetHashProtocolManager::Create( - request_context_getter, config)); - } -} - -SafeBrowsingDatabaseManager::~SafeBrowsingDatabaseManager() { -} - void SafeBrowsingDatabaseManager::CheckApiBlacklistUrl(const GURL& url, Client* client) { // TODO(kcarattini): Implement this. diff --git a/components/safe_browsing_db/database_manager.h b/components/safe_browsing_db/database_manager.h index a4c229f..8167b3a 100644 --- a/components/safe_browsing_db/database_manager.h +++ b/components/safe_browsing_db/database_manager.h @@ -20,15 +20,8 @@ #include "content/public/common/resource_type.h" #include "url/gurl.h" -namespace net { -class URLRequestContextGetter; -} // namespace net - namespace safe_browsing { -struct V4GetHashProtocolConfig; -class V4GetHashProtocolManager; - // Base class to either the locally-managed or a remotely-managed database. class SafeBrowsingDatabaseManager : public base::RefCountedThreadSafe<SafeBrowsingDatabaseManager> { @@ -159,19 +152,9 @@ class SafeBrowsingDatabaseManager virtual void StopOnIOThread(bool shutdown) = 0; protected: - // Use this constructor for testing only. - SafeBrowsingDatabaseManager(); - - // Constructs the database manager. - SafeBrowsingDatabaseManager( - net::URLRequestContextGetter* request_context_getter, - const V4GetHashProtocolConfig& config); - - virtual ~SafeBrowsingDatabaseManager(); + virtual ~SafeBrowsingDatabaseManager() {} friend class base::RefCountedThreadSafe<SafeBrowsingDatabaseManager>; - - std::unique_ptr<V4GetHashProtocolManager> v4_get_hash_protocol_manager_; }; // class SafeBrowsingDatabaseManager } // namespace safe_browsing diff --git a/components/safe_browsing_db/remote_database_manager.cc b/components/safe_browsing_db/remote_database_manager.cc index d812200..8b1c480 100644 --- a/components/safe_browsing_db/remote_database_manager.cc +++ b/components/safe_browsing_db/remote_database_manager.cc @@ -11,7 +11,6 @@ #include "base/strings/string_split.h" #include "base/timer/elapsed_timer.h" #include "components/safe_browsing_db/safe_browsing_api_handler.h" -#include "components/safe_browsing_db/v4_get_hash_protocol_manager.h" #include "components/variations/variations_associated_data.h" #include "content/public/browser/browser_thread.h" @@ -94,14 +93,7 @@ void RemoteSafeBrowsingDatabaseManager::ClientRequest::OnRequestDone( // TODO(nparker): Add more tests for this class RemoteSafeBrowsingDatabaseManager::RemoteSafeBrowsingDatabaseManager() - : RemoteSafeBrowsingDatabaseManager(NULL, V4GetHashProtocolConfig()) { -} - -RemoteSafeBrowsingDatabaseManager::RemoteSafeBrowsingDatabaseManager( - net::URLRequestContextGetter* request_context_getter, - const V4GetHashProtocolConfig& config) - : SafeBrowsingDatabaseManager(request_context_getter, config), - enabled_(false) { + : enabled_(false) { // Decide which resource types to check. These two are the minimum. resource_types_to_check_.insert(content::RESOURCE_TYPE_MAIN_FRAME); resource_types_to_check_.insert(content::RESOURCE_TYPE_SUB_FRAME); diff --git a/components/safe_browsing_db/remote_database_manager.h b/components/safe_browsing_db/remote_database_manager.h index 766a7a9..89c71f5 100644 --- a/components/safe_browsing_db/remote_database_manager.h +++ b/components/safe_browsing_db/remote_database_manager.h @@ -18,26 +18,15 @@ #include "components/safe_browsing_db/database_manager.h" #include "url/gurl.h" -namespace net { -class URLRequestContextGetter; -} - namespace safe_browsing { -struct V4GetHashProtocolConfig; - // An implementation that proxies requests to a service outside of Chromium. // Does not manage a local database. class RemoteSafeBrowsingDatabaseManager : public SafeBrowsingDatabaseManager { public: - // Use this constructor for testing only. - RemoteSafeBrowsingDatabaseManager(); - // Construct RemoteSafeBrowsingDatabaseManager. // Must be initialized by calling StartOnIOThread() before using. - RemoteSafeBrowsingDatabaseManager( - net::URLRequestContextGetter* request_context_getter, - const V4GetHashProtocolConfig& config); + RemoteSafeBrowsingDatabaseManager(); // // SafeBrowsingDatabaseManager implementation |