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

Unified Diff: android_webview/browser/net/aw_url_request_context_getter.cc

Issue 12387028: Fix for CookieManager init race condition (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: added a comment Created 7 years, 10 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 | « no previous file | android_webview/browser/net/init_native_callback.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6ec1aad7db56be9a00b7ec48b95294e4e9187db7..1b7177b641a846cb6198c2bd460a835ab24a48ec 100644
--- a/android_webview/browser/net/aw_url_request_context_getter.cc
+++ b/android_webview/browser/net/aw_url_request_context_getter.cc
@@ -13,6 +13,7 @@
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/content_client.h"
#include "content/public/common/url_constants.h"
+#include "net/cookies/cookie_store.h"
#include "net/http/http_cache.h"
#include "net/proxy/proxy_service.h"
#include "net/url_request/data_protocol_handler.h"
@@ -72,6 +73,12 @@ void AwURLRequestContextGetter::Init() {
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)));
main_http_factory_.reset(main_cache);
url_request_context_->set_http_transaction_factory(main_cache);
+
+ // 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());
}
void AwURLRequestContextGetter::PopulateNetworkSessionParams(
@@ -118,8 +125,7 @@ net::URLRequestContext* AwURLRequestContextGetter::GetURLRequestContext() {
DCHECK(set_protocol);
// Create a chain of URLRequestJobFactories. Keep |job_factory_| pointed
// at the beginning of the chain.
- job_factory_ = CreateAndroidJobFactoryAndCookieMonster(
- url_request_context_.get(), job_factory.Pass());
+ job_factory_ = CreateAndroidJobFactory(job_factory.Pass());
job_factory_.reset(new net::ProtocolInterceptJobFactory(
job_factory_.Pass(),
scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>(
« no previous file with comments | « no previous file | android_webview/browser/net/init_native_callback.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698