diff options
author | Kristian Monsen <kristianm@google.com> | 2011-09-01 20:30:10 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-09-01 20:30:10 -0700 |
commit | 903ede82b6a07ee55e85df1fd67d104ca4260a0c (patch) | |
tree | 0dfd6a7d3d5c9d8669595d90df574a1dbe939b85 | |
parent | b53cff5eb9dbb10169c8adae7692c91d0a807ed9 (diff) | |
parent | 76859bf6d78119b2bf4fe2aa2c2a4761fa90503c (diff) | |
download | external_webkit-903ede82b6a07ee55e85df1fd67d104ca4260a0c.zip external_webkit-903ede82b6a07ee55e85df1fd67d104ca4260a0c.tar.gz external_webkit-903ede82b6a07ee55e85df1fd67d104ca4260a0c.tar.bz2 |
Merge "Closing idle connections, including jni interface"
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/WebCache.cpp | 12 | ||||
-rw-r--r-- | Source/WebKit/android/WebCoreSupport/WebCache.h | 5 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 11 |
3 files changed, 28 insertions, 0 deletions
diff --git a/Source/WebKit/android/WebCoreSupport/WebCache.cpp b/Source/WebKit/android/WebCoreSupport/WebCache.cpp index a15bf7f..3c49430 100644 --- a/Source/WebKit/android/WebCoreSupport/WebCache.cpp +++ b/Source/WebKit/android/WebCoreSupport/WebCache.cpp @@ -134,6 +134,18 @@ void WebCache::clear() thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, &WebCache::clearImpl)); } +void WebCache::closeIdleConnections() +{ + base::Thread* thread = WebUrlLoaderClient::ioThread(); + if (thread) + thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, &WebCache::closeIdleImpl)); +} + +void WebCache::closeIdleImpl() +{ + m_cache->CloseIdleConnections(); +} + void WebCache::clearImpl() { if (m_isClearInProgress) diff --git a/Source/WebKit/android/WebCoreSupport/WebCache.h b/Source/WebKit/android/WebCoreSupport/WebCache.h index 7149fcc..c3b623d 100644 --- a/Source/WebKit/android/WebCoreSupport/WebCache.h +++ b/Source/WebKit/android/WebCoreSupport/WebCache.h @@ -47,6 +47,8 @@ public: net::HostResolver* hostResolver() { return m_hostResolver.get(); } net::HttpCache* cache() { return m_cache.get(); } net::ProxyConfigServiceAndroid* proxy() { return m_proxyConfigService; } + void closeIdleConnections(); + private: WebCache(bool isPrivateBrowsing); @@ -56,6 +58,9 @@ private: void doomAllEntries(int); void onClearDone(int); + // For closeIdleConnections + void closeIdleImpl(); + // For getEntry() void getEntryImpl(); void openEntry(int); diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 3ad8ab2..9b5a6fa 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -113,6 +113,7 @@ #include "SkUtils.h" #include "Text.h" #include "TypingCommand.h" +#include "WebCache.h" #include "WebCoreFrameBridge.h" #include "WebFrameView.h" #include "WindowsKeyboardCodes.h" @@ -4616,6 +4617,14 @@ static void AutoFillForm(JNIEnv* env, jobject obj, jint queryId) #endif } +static void CloseIdleConnections(JNIEnv* env, jobject obj) +{ +#if USE(CHROME_NETWORK_STACK) + WebCache::get(true)->closeIdleConnections(); + WebCache::get(false)->closeIdleConnections(); +#endif +} + static void ScrollRenderLayer(JNIEnv* env, jobject obj, jint layer, jobject jRect) { SkRect rect; @@ -4735,6 +4744,8 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) AutoFillForm }, { "nativeScrollLayer", "(ILandroid/graphics/Rect;)V", (void*) ScrollRenderLayer }, + { "nativeCloseIdleConnections", "()V", + (void*) CloseIdleConnections }, }; int registerWebViewCore(JNIEnv* env) |