OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/android/process_utils.h" | 5 #include "chrome/browser/android/process_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 base::Bind(&CloseIdleConnectionsForProfile, | 30 base::Bind(&CloseIdleConnectionsForProfile, |
31 context_getter)); | 31 context_getter)); |
32 return; | 32 return; |
33 } | 33 } |
34 | 34 |
35 net::URLRequestContext* context = context_getter->GetURLRequestContext(); | 35 net::URLRequestContext* context = context_getter->GetURLRequestContext(); |
36 DCHECK(context->http_transaction_factory()); | 36 DCHECK(context->http_transaction_factory()); |
37 net::HttpNetworkSession* session = | 37 net::HttpNetworkSession* session = |
38 context->http_transaction_factory()->GetSession(); | 38 context->http_transaction_factory()->GetSession(); |
39 DCHECK(session); | 39 DCHECK(session); |
| 40 session->CloseIdleConnections(); |
40 } | 41 } |
41 | 42 |
42 // Only accessed from the JNI thread by ToggleWebKitSharedTimers() which is | 43 // Only accessed from the JNI thread by ToggleWebKitSharedTimers() which is |
43 // implemented below. | 44 // implemented below. |
44 base::LazyInstance<std::vector<int /* process id */> > g_suspended_processes = | 45 base::LazyInstance<std::vector<int /* process id */> > g_suspended_processes = |
45 LAZY_INSTANCE_INITIALIZER; | 46 LAZY_INSTANCE_INITIALIZER; |
46 | 47 |
47 // Suspends timers in all current render processes. | 48 // Suspends timers in all current render processes. |
48 void SuspendWebKitSharedTimers(std::vector<int>* suspended_processes) { | 49 void SuspendWebKitSharedTimers(std::vector<int>* suspended_processes) { |
49 for (content::RenderProcessHost::iterator i( | 50 for (content::RenderProcessHost::iterator i( |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 if (profile->HasOffTheRecordProfile()) { | 93 if (profile->HasOffTheRecordProfile()) { |
93 CloseIdleConnectionsForProfile( | 94 CloseIdleConnectionsForProfile( |
94 profile->GetOffTheRecordProfile()->GetRequestContext()); | 95 profile->GetOffTheRecordProfile()->GetRequestContext()); |
95 } | 96 } |
96 } | 97 } |
97 } | 98 } |
98 | 99 |
99 bool RegisterProcessUtils(JNIEnv* env) { | 100 bool RegisterProcessUtils(JNIEnv* env) { |
100 return RegisterNativesImpl(env); | 101 return RegisterNativesImpl(env); |
101 } | 102 } |
OLD | NEW |