summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-08 23:21:18 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-08 23:21:18 +0000
commit6142debab3eab9d0007ef32ed13a24a585a86b45 (patch)
tree0fed4d6d40a6114e055397b0cbc883dd52c14fe4
parent89b07797e8690a642eabbb15238417ed72dc928a (diff)
downloadchromium_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
-rw-r--r--chrome/browser/extensions/extension_updater.cc4
-rw-r--r--chrome/browser/google/google_url_tracker.cc6
-rw-r--r--chrome/browser/intranet_redirect_detector.cc6
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.cc4
-rw-r--r--chrome/common/chrome_switches.cc5
-rw-r--r--chrome/common/chrome_switches.h1
6 files changed, 25 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) :
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 331a0bd..b992ed7 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -144,6 +144,11 @@ const char kDisableAudio[] = "disable-audio";
const char kDisableAuthNegotiateCnameLookup[] =
"disable-auth-negotiate-cname-lookup";
+// Disable several subsystems which run network requests in the background.
+// This is for use when doing network performance testing to avoid noise
+// in the measurements.
+const char kDisableBackgroundNetworking[] = "disable-background-networking";
+
// Disable limits on the number of backing stores. Can prevent blinking for
// users with many windows/tabs and lots of memory.
const char kDisableBackingStoreLimit[] = "disable-backing-store-limit";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 842adff..7ffbe88 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -53,6 +53,7 @@ extern const char kDisableApplicationCache[];
extern const char kDisableApps[];
extern const char kDisableAudio[];
extern const char kDisableAuthNegotiateCnameLookup[];
+extern const char kDisableBackgroundNetworking[];
extern const char kDisableBackingStoreLimit[];
extern const char kDisableByteRangeSupport[];
extern const char kDisableClickToPlay[];