diff options
author | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 23:21:18 +0000 |
---|---|---|
committer | mbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-08 23:21:18 +0000 |
commit | 6142debab3eab9d0007ef32ed13a24a585a86b45 (patch) | |
tree | 0fed4d6d40a6114e055397b0cbc883dd52c14fe4 /chrome/browser | |
parent | 89b07797e8690a642eabbb15238417ed72dc928a (diff) | |
download | chromium_src-6142debab3eab9d0007ef32ed13a24a585a86b45.zip chromium_src-6142debab3eab9d0007ef32ed13a24a585a86b45.tar.gz chromium_src-6142debab3eab9d0007ef32ed13a24a585a86b45.tar.bz2 |
Add a command line switch "--disable-background-networking", to be used in
benchmarking when unexpected background networking can cause undesired vairance.
The following systems are disabled via this flag:
- IntranetRedirectDetector (requests randomURLs 2-5s after startup)
- GoogleUrlTracker (searchdomaincheck)
- SafeBrowsing updater
- Extension updater
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3312014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58892 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/extensions/extension_updater.cc | 4 | ||||
-rw-r--r-- | chrome/browser/google/google_url_tracker.cc | 6 | ||||
-rw-r--r-- | chrome/browser/intranet_redirect_detector.cc | 6 | ||||
-rw-r--r-- | chrome/browser/safe_browsing/safe_browsing_service.cc | 4 |
4 files changed, 19 insertions, 1 deletions
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index 2e1b867..89bdecb 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -792,6 +792,10 @@ std::vector<int> ExtensionUpdater::DetermineUpdates( } void ExtensionUpdater::StartUpdateCheck(ManifestFetchData* fetch_data) { + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableBackgroundNetworking)) + return; + std::deque<ManifestFetchData*>::const_iterator i; for (i = manifests_pending_.begin(); i != manifests_pending_.end(); i++) { if (fetch_data->full_url() == (*i)->full_url()) { diff --git a/chrome/browser/google/google_url_tracker.cc b/chrome/browser/google/google_url_tracker.cc index 606cc27..30956b6 100644 --- a/chrome/browser/google/google_url_tracker.cc +++ b/chrome/browser/google/google_url_tracker.cc @@ -7,6 +7,7 @@ #include <vector> #include "app/l10n_util.h" +#include "base/command_line.h" #include "base/compiler_specific.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -17,6 +18,7 @@ #include "chrome/browser/tab_contents/infobar_delegate.h" #include "chrome/browser/tab_contents/navigation_controller.h" #include "chrome/browser/tab_contents/tab_contents.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/net/url_fetcher_protect.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" @@ -188,6 +190,10 @@ void GoogleURLTracker::StartFetchIfDesirable() { !request_context_available_) return; + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableBackgroundNetworking)) + return; + already_fetched_ = true; fetcher_.reset(URLFetcher::Create(fetcher_id_, GURL(kSearchDomainCheckURL), URLFetcher::GET, this)); diff --git a/chrome/browser/intranet_redirect_detector.cc b/chrome/browser/intranet_redirect_detector.cc index b0e2995..481e8cf 100644 --- a/chrome/browser/intranet_redirect_detector.cc +++ b/chrome/browser/intranet_redirect_detector.cc @@ -4,12 +4,14 @@ #include "chrome/browser/intranet_redirect_detector.h" +#include "base/command_line.h" #include "base/rand_util.h" #include "base/stl_util-inl.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profile.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "net/base/load_flags.h" @@ -78,6 +80,10 @@ void IntranetRedirectDetector::StartFetchesIfPossible() { if (in_sleep_ || !request_context_available_) return; + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kDisableBackgroundNetworking)) + return; + DCHECK(fetchers_.empty() && resulting_origins_.empty()); // Start three fetchers on random hostnames. diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index d51f194..5f2d663 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -364,7 +364,9 @@ void SafeBrowsingService::OnIOInitialize( #endif #endif CommandLine* cmdline = CommandLine::ForCurrentProcess(); - bool disable_auto_update = cmdline->HasSwitch(switches::kSbDisableAutoUpdate); + bool disable_auto_update = + cmdline->HasSwitch(switches::kSbDisableAutoUpdate) || + cmdline->HasSwitch(switches::kDisableBackgroundNetworking); std::string info_url_prefix = cmdline->HasSwitch(switches::kSbInfoURLPrefix) ? cmdline->GetSwitchValueASCII(switches::kSbInfoURLPrefix) : |