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

Unified Diff: android_webview/native/cookie_manager.cc

Issue 284313005: Fixes a deadlock between shouldInterceptRequest() and getCookie() (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: fix startupTest Created 6 years, 7 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 | « android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/cookie_manager.cc
diff --git a/android_webview/native/cookie_manager.cc b/android_webview/native/cookie_manager.cc
index 90fa23ff72336cabe6d0d5b4f4cf254edecb6aa1..6362d60dd3c6348d87a1127523b234aec249a026 100644
--- a/android_webview/native/cookie_manager.cc
+++ b/android_webview/native/cookie_manager.cc
@@ -145,8 +145,7 @@ class CookieManager {
public:
static CookieManager* GetInstance();
- scoped_refptr<net::CookieStore> CreateBrowserThreadCookieStore(
- AwBrowserContext* browser_context);
+ scoped_refptr<net::CookieStore> GetCookieStore();
void SetAcceptCookie(bool accept);
bool AcceptCookie();
@@ -214,8 +213,6 @@ class CookieManager {
scoped_refptr<base::MessageLoopProxy> cookie_monster_proxy_;
base::Lock cookie_monster_lock_;
- // Both these threads are normally NULL. They only exist if CookieManager was
- // accessed before Chromium was started.
scoped_ptr<base::Thread> cookie_monster_client_thread_;
scoped_ptr<base::Thread> cookie_monster_backend_thread_;
@@ -327,33 +324,9 @@ void CookieManager::ExecCookieTask(const base::Closure& task) {
cookie_monster_proxy_->PostTask(FROM_HERE, task);
}
-scoped_refptr<net::CookieStore> CookieManager::CreateBrowserThreadCookieStore(
- AwBrowserContext* browser_context) {
+scoped_refptr<net::CookieStore> CookieManager::GetCookieStore() {
base::AutoLock lock(cookie_monster_lock_);
-
- if (cookie_monster_client_thread_) {
- // We created a cookie monster already on its own threads; we'll just keep
- // using it rather than creating one on the normal Chromium threads.
- // CookieMonster is threadsafe, so this is fine.
- return cookie_monster_;
- }
-
- // Go ahead and create the cookie monster using the normal Chromium threads.
- DCHECK(!cookie_monster_.get());
- DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::IO));
-
- FilePath user_data_dir;
- GetUserDataDir(&user_data_dir);
- DCHECK(browser_context->GetPath() == user_data_dir);
-
- cookie_monster_proxy_ =
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
- scoped_refptr<base::SequencedTaskRunner> background_task_runner =
- BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
- BrowserThread::GetBlockingPool()->GetSequenceToken());
- CreateCookieMonster(user_data_dir,
- cookie_monster_proxy_,
- background_task_runner);
+ EnsureCookieMonsterExistsLocked();
return cookie_monster_;
}
@@ -649,8 +622,7 @@ static void SetAcceptFileSchemeCookies(JNIEnv* env, jobject obj,
scoped_refptr<net::CookieStore> CreateCookieStore(
AwBrowserContext* browser_context) {
- return CookieManager::GetInstance()->CreateBrowserThreadCookieStore(
- browser_context);
+ return CookieManager::GetInstance()->GetCookieStore();
}
bool RegisterCookieManager(JNIEnv* env) {
« no previous file with comments | « android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerStartupTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698