Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: chrome/browser/android/process_utils.cc

Issue 10816038: Upstreaming RegisterProcessUtils() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed TODO and added intent_helper Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/chrome_jni_registrar.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..886030471a8fe4315deb19f7e3b9ccb27856dc48 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(
Satish 2012/07/25 09:07:21 where is this method being used? downstream there
aurimas (slooooooooow) 2012/07/25 15:28:30 I wanted to include CloseIdleConnections(), but wh
+ 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
Satish 2012/07/25 09:07:21 looks like this if condition and the one below can
aurimas (slooooooooow) 2012/07/25 15:28:30 Do I keep the DCHECKs and just remove if statement
+ // 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 =
@@ -54,7 +86,6 @@ static void ToggleWebKitSharedTimers(JNIEnv* env,
}
}
-// TODO(pliard): http://crbug.com/137674
bool RegisterProcessUtils(JNIEnv* env) {
return RegisterNativesImpl(env);
}
« no previous file with comments | « chrome/browser/android/chrome_jni_registrar.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698