summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-16 19:38:27 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-16 19:38:27 +0000
commitfb123bc8253f4886799101007d47a3a209b65b59 (patch)
tree918a9fc7d9a47f22594cdc69e97a4e245f022c14 /chrome_frame
parent16ce91fc01733f1056c514155b2110e1618ceb5c (diff)
downloadchromium_src-fb123bc8253f4886799101007d47a3a209b65b59.zip
chromium_src-fb123bc8253f4886799101007d47a3a209b65b59.tar.gz
chromium_src-fb123bc8253f4886799101007d47a3a209b65b59.tar.bz2
Bump up the number of simultaneous connections in IE to 6. This is done via a WinInet API
InternetSetOption. Fixes bug http://code.google.com/p/chromium/issues/detail?id=50328 BUG=50328 TEST=none Review URL: http://codereview.chromium.org/6480092 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75162 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-rw-r--r--chrome_frame/bho.cc6
-rw-r--r--chrome_frame/utils.cc33
-rw-r--r--chrome_frame/utils.h7
3 files changed, 46 insertions, 0 deletions
diff --git a/chrome_frame/bho.cc b/chrome_frame/bho.cc
index 0cd3a4a..62f9079 100644
--- a/chrome_frame/bho.cc
+++ b/chrome_frame/bho.cc
@@ -25,6 +25,7 @@
#include "chrome_frame/vtable_patch_manager.h"
static const int kIBrowserServiceOnHttpEquivIndex = 30;
+static const DWORD kMaxHttpConnections = 6;
PatchHelper g_patch_helper;
@@ -136,6 +137,11 @@ STDMETHODIMP Bho::SetSite(IUnknown* site) {
AddRef();
RegisterThreadInstance();
MetricsService::Start();
+
+ if (!IncreaseWinInetConnections(kMaxHttpConnections)) {
+ DLOG(WARNING) << "Failed to bump up HTTP connections. Error:"
+ << ::GetLastError();
+ }
} else {
UnregisterThreadInstance();
buggy_bho::BuggyBhoTls::DestroyInstance();
diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc
index 049294c..7182428 100644
--- a/chrome_frame/utils.cc
+++ b/chrome_frame/utils.cc
@@ -1603,3 +1603,36 @@ bool IsChromeFrameDocument(IWebBrowser2* web_browser) {
return false;
}
+bool IncreaseWinInetConnections(DWORD connections) {
+ static bool wininet_connection_count_updated = false;
+ if (wininet_connection_count_updated) {
+ return true;
+ }
+
+ static int connection_options[] = {
+ INTERNET_OPTION_MAX_CONNS_PER_SERVER,
+ INTERNET_OPTION_MAX_CONNS_PER_1_0_SERVER,
+ };
+
+ BOOL ret = FALSE;
+
+ for (int option_index = 0; option_index < arraysize(connection_options);
+ ++option_index) {
+ DWORD connection_value_size = sizeof(DWORD);
+ DWORD current_connection_limit = 0;
+ InternetQueryOption(NULL, connection_options[option_index],
+ &current_connection_limit, &connection_value_size);
+ if (current_connection_limit > connections) {
+ continue;
+ }
+
+ ret = InternetSetOption(NULL, connection_options[option_index],
+ &connections, connection_value_size);
+ if (!ret) {
+ return false;
+ }
+ }
+ wininet_connection_count_updated = true;
+ return true;
+}
+
diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h
index 5847917..47f0929 100644
--- a/chrome_frame/utils.h
+++ b/chrome_frame/utils.h
@@ -618,4 +618,11 @@ std::wstring GetCurrentModuleVersion();
// Returns true if ChromeFrame is the currently loaded document.
bool IsChromeFrameDocument(IWebBrowser2* web_browser);
+// Increases the wininet connection limit for HTTP 1.0/1.1 connections to the
+// value passed in. This is only done if the existing connection limit is
+// lesser than the connection limit passed in. This function attempts to
+// increase the connection count once per process.
+// Returns true on success.
+bool IncreaseWinInetConnections(DWORD connections);
+
#endif // CHROME_FRAME_UTILS_H_