Chromium Code Reviews| Index: android_webview/browser/net/aw_url_request_context_getter.cc |
| diff --git a/android_webview/browser/net/aw_url_request_context_getter.cc b/android_webview/browser/net/aw_url_request_context_getter.cc |
| index 4028ec7ac6831defee786d10b5c09ff966ebfa2e..55bc244a3201aa66fe3e799691b4c0b791c714af 100644 |
| --- a/android_webview/browser/net/aw_url_request_context_getter.cc |
| +++ b/android_webview/browser/net/aw_url_request_context_getter.cc |
| @@ -51,6 +51,22 @@ AwURLRequestContextGetter::~AwURLRequestContextGetter() { |
| BrowserThread::SetDelegate(BrowserThread::IO, NULL); |
| } |
| +void AwURLRequestContextGetter::InitializeOnUiThread() { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + |
| + cookie_store_ = content::CreatePersistentCookieStore( |
| + browser_context_->GetPath().Append(FILE_PATH_LITERAL("Cookies")), |
| + false, |
| + NULL, |
| + NULL); |
| + cookie_store_->GetCookieMonster()->SetPersistSessionCookies(true); |
| + |
| + // The CookieMonster must be passed here so it happens synchronously to |
| + // the main thread initialization (to avoid race condition in another |
| + // thread trying to access the CookieManager API). |
|
awong
2013/07/11 20:43:48
This comment is slightly out of date. We're alread
|
| + DidCreateCookieMonster(cookie_store_->GetCookieMonster()); |
| +} |
| + |
| void AwURLRequestContextGetter::Init() { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| @@ -84,21 +100,9 @@ void AwURLRequestContextGetter::Init() { |
| BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE))); |
| main_http_factory_.reset(main_cache); |
| url_request_context_->set_http_transaction_factory(main_cache); |
| - |
| - scoped_refptr<net::CookieStore> cookie_store = |
| - content::CreatePersistentCookieStore( |
| - browser_context_->GetPath().Append(FILE_PATH_LITERAL("Cookies")), |
| - false, |
| - NULL, |
| - NULL); |
| - cookie_store->GetCookieMonster()->SetPersistSessionCookies(true); |
| - url_request_context_->set_cookie_store(cookie_store.get()); |
| - |
| - // The CookieMonster must be passed here so it happens synchronously to |
| - // the main thread initialization (to avoid race condition in another |
| - // thread trying to access the CookieManager API). |
| - DidCreateCookieMonster( |
| - url_request_context_->cookie_store()->GetCookieMonster()); |
| + url_request_context_->set_cookie_store(cookie_store_.get()); |
|
joth
2013/07/16 20:19:52
url_request_context_->set_cookie_store(cookie_stor
|
| + // release our copy of cookie_store_, now url_request_context owns it |
| + cookie_store_ = NULL; |
| } |
| void AwURLRequestContextGetter::PopulateNetworkSessionParams( |