diff options
-rw-r--r-- | Android.mk | 3 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/WebRequestContext.cpp | 30 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/WebRequestContext.h | 3 |
3 files changed, 20 insertions, 16 deletions
@@ -242,7 +242,8 @@ WEBKIT_SRC_FILES += $(addprefix $d/,$(LOCAL_SRC_FILES)) ifeq ($(HTTP_STACK),chrome) LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \ $(LOCAL_PATH)/WebKit/chromium/public \ - external/chromium + external/chromium \ + external/chromium/android endif # HTTP_STACK == chrome # Redefine LOCAL_PATH here so the build system is not confused diff --git a/WebKit/android/WebCoreSupport/WebRequestContext.cpp b/WebKit/android/WebCoreSupport/WebRequestContext.cpp index ecd083b..2adbbf9 100644 --- a/WebKit/android/WebCoreSupport/WebRequestContext.cpp +++ b/WebKit/android/WebCoreSupport/WebRequestContext.cpp @@ -28,6 +28,7 @@ #include "WebRequestContext.h" #include "JNIUtility.h" +#include "app/sqlite_persistent_cookie_store.h" #include "jni.h" #include "net/base/cookie_monster.h" #include "net/base/ssl_config_service.h" @@ -41,8 +42,7 @@ namespace { namespace android { -std::string* WebRequestContext::s_dataDirectory = 0; -net::HttpCache* WebRequestContext::s_cache = 0; +std::string* WebRequestContext::s_dataDirectory(0); WebRequestContext::WebRequestContext() { @@ -75,18 +75,24 @@ const std::string* WebRequestContext::GetDataDirectory() return s_dataDirectory; } -// Some of the members of the RequestContext will be deleted when the URLRequest -// is deleted as they are scoped pointers. Documented in WebRequestContext.h WebRequestContext* WebRequestContext::GetAndroidContext() { - WebRequestContext* androidContext = new WebRequestContext(); - androidContext->host_resolver_ = net::CreateSystemHostResolver(0); - androidContext->cookie_store_ = new net::CookieMonster(0); - - // In memory cache - if (!s_cache) - s_cache = new net::HttpCache(0, androidContext->host_resolver(), 0, net::SSLConfigService::CreateSystemSSLConfigService(), 0); - androidContext->http_transaction_factory_ = s_cache; + static scoped_refptr<WebRequestContext> androidContext(0); + if (!androidContext) { + std::string cookieString(*GetDataDirectory()); + cookieString.append("/chromecookies.db"); + FilePath cookiePath(cookieString.c_str()); + std::string cacheString(*GetDataDirectory()); + cacheString.append("/chromecache"); + FilePath cachePath(cacheString.c_str()); + + androidContext = new WebRequestContext(); + androidContext->host_resolver_ = net::CreateSystemHostResolver(0); + androidContext->http_transaction_factory_ = new net::HttpCache(0, androidContext->host_resolver(), 0, net::SSLConfigService::CreateSystemSSLConfigService(), cachePath, 0); + + scoped_refptr<SQLitePersistentCookieStore> cookieDb = new SQLitePersistentCookieStore(cookiePath); + androidContext->cookie_store_ = new net::CookieMonster(cookieDb.get()); + } return androidContext; } diff --git a/WebKit/android/WebCoreSupport/WebRequestContext.h b/WebKit/android/WebCoreSupport/WebRequestContext.h index 65a0865..c2f0aaf 100644 --- a/WebKit/android/WebCoreSupport/WebRequestContext.h +++ b/WebKit/android/WebCoreSupport/WebRequestContext.h @@ -42,9 +42,6 @@ private: // Caching this query from java static std::string* s_dataDirectory; - - // Not deleted on deletion of URLRequest - static net::HttpCache* s_cache; }; } // namespace android |