OSDN Git Service

Provide a URLRequestContext directly to AutoFill, rather than a factory function
authorSteve Block <steveblock@google.com>
Tue, 30 Nov 2010 11:32:14 +0000 (11:32 +0000)
committerSteve Block <steveblock@google.com>
Tue, 30 Nov 2010 11:34:07 +0000 (11:34 +0000)
In b/3044989, AutoFill was modified to take a factory function for the
URLRequestContext (which was then created when needed), rather than
taking the context directly. This was to avoid a race condition where
the context is created before the required storage paths have been
synced to the WebCore thread through the BrowserFrame.

Since https://android-git.corp.google.com/g/76579 and
https://android-git.corp.google.com/g/80056, we read the required
paths directly from JniUtils, so the race condition no longer exists. We
can therefore provide the context directly to AutoFill.

Note that while the context may be created before the Settings have been
synced to the WebCore thread, the necessary properties will be updated
as part of this sync before the context is used.

This change will also simplify things when we use one context per
WebView.

Also requires a change in external/chromium ...
https://android-git.corp.google.com/g/82146

Change-Id: Idfc34d435bae21654a02e5898aef0e84da98218a

WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp

index 8199aa0..98b250f 100644 (file)
 namespace android
 {
 
-static URLRequestContext* webAutoFillContextGetter()
-{
-    return WebRequestContext::get(false /* isPrivateBrowsing */);
-}
-
 WebAutoFill::WebAutoFill()
     : mWebViewCore(0)
 {
     mFormManager = new FormManager();
     mQueryId = 1;
 
-    AndroidURLRequestContextGetter::Get()->SetURLRequestContextGetterFunction(&webAutoFillContextGetter);
+    AndroidURLRequestContextGetter::Get()->SetURLRequestContext(WebRequestContext::get(false /* isPrivateBrowsing */));
     AndroidURLRequestContextGetter::Get()->SetIOThread(WebUrlLoaderClient::ioThread());
     mTabContents = new TabContents();
     mAutoFillManager = new AutoFillManager(mTabContents.get());