Index: chrome/browser/android/process_utils.cc |
diff --git a/chrome/browser/android/process_utils.cc b/chrome/browser/android/process_utils.cc |
index c0f52802273241fca6752799da785159567790df..42c47ae10e49d33ed962a25f9bf35f86f7c85a01 100644 |
--- a/chrome/browser/android/process_utils.cc |
+++ b/chrome/browser/android/process_utils.cc |
@@ -8,12 +8,44 @@ |
#include "base/lazy_instance.h" |
#include "base/logging.h" |
+#include "chrome/browser/browser_process.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/profiles/profile_manager.h" |
#include "chrome/common/render_messages.h" |
+#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/render_process_host.h" |
#include "jni/ProcessUtils_jni.h" |
+#include "net/http/http_network_session.h" |
+#include "net/http/http_transaction_factory.h" |
+#include "net/url_request/url_request_context.h" |
+#include "net/url_request/url_request_context_getter.h" |
namespace { |
+void CloseIdleConnectionsForProfile( |
Yaron
2012/07/24 17:15:47
Not familiar with this. Adding Satish
|
+ scoped_refptr<net::URLRequestContextGetter> context_getter) { |
+ DCHECK(context_getter.get()); |
+ if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)) { |
+ content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, |
+ base::Bind(&CloseIdleConnectionsForProfile, |
+ context_getter)); |
+ return; |
+ } |
+ |
+ net::URLRequestContext* context = context_getter->GetURLRequestContext(); |
+ DCHECK(context->http_transaction_factory()); |
+ // TODO(satish): Remove this early return after verifying the above doesn't |
+ // fail. |
+ if (!context->http_transaction_factory()) |
+ return; |
+ net::HttpNetworkSession* session = |
+ context->http_transaction_factory()->GetSession(); |
+ DCHECK(session); |
+ // TODO(satish): Remove this check after verifying the above doesn't fail. |
+ if (session) |
+ session->CloseIdleConnections(); |
+} |
+ |
// Only accessed from the JNI thread by ToggleWebKitSharedTimers() which is |
// implemented below. |
base::LazyInstance<std::vector<int /* process id */> > g_suspended_processes = |