diff options
author | Steve Block <steveblock@google.com> | 2010-10-27 09:58:13 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-10-27 14:07:30 +0100 |
commit | 9a90c4fd9e9ad727fac52b12013ad2b88644d826 (patch) | |
tree | c3cfb89596caf61a7375295d5aa6a4a712f28301 /WebKit/android/jni/CookieManager.cpp | |
parent | f8d8851981c0c0605a653850bddde79841119470 (diff) | |
download | external_webkit-9a90c4fd9e9ad727fac52b12013ad2b88644d826.zip external_webkit-9a90c4fd9e9ad727fac52b12013ad2b88644d826.tar.gz external_webkit-9a90c4fd9e9ad727fac52b12013ad2b88644d826.tar.bz2 |
Fix WebRequestContext::get() to be threadsafe
This allows the method to be called from both the WebCore thread and
the UI thread, as required to hook up CookieManager.
Change-Id: I895d14909b14f0baba77fb2cb75926d9103ee01f
Diffstat (limited to 'WebKit/android/jni/CookieManager.cpp')
-rw-r--r-- | WebKit/android/jni/CookieManager.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/WebKit/android/jni/CookieManager.cpp b/WebKit/android/jni/CookieManager.cpp index f16ffd7..34e2cb6 100644 --- a/WebKit/android/jni/CookieManager.cpp +++ b/WebKit/android/jni/CookieManager.cpp @@ -46,6 +46,16 @@ static bool useChromiumHttpStack(JNIEnv*, jobject) { static void removeAllCookie(JNIEnv*, jobject) { #if USE(CHROME_NETWORK_STACK) + // Though WebRequestContext::get() is threadsafe, the context itself, in + // general, is not. The context is generally used on the HTTP stack IO + // thread, but this call is on the UI thread. However, the cookie_store() + // getter just returns a pointer which is only set when the context is first + // constructed. The CookieMonster is threadsafe, so the call below is safe + // overall. + // + // TODO: It's possible that this call is made before the WebKit thread has + // started up and the settings have been synced to the BrowserFrame. This + // will cause creation of the context to fail. WebRequestContext::get(false)->cookie_store()->GetCookieMonster()->DeleteAllCreatedAfter(Time(), true); // This will lazily create a new private browsing context. However, if the // context doesn't already exist, there's no need to create it, as cookies |