diff options
author | Steve Block <steveblock@google.com> | 2010-11-30 11:21:26 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-11-30 12:09:36 +0000 |
commit | d78db59eb6c4cf1d61ebfc8227347b66950561ff (patch) | |
tree | 47d0911be63f53f1dfbc56f350ea6834de6f3533 /android/autofill | |
parent | c2e0a14b0b25e83e3bb0e19c3f06d9513949cc88 (diff) | |
download | external_chromium-d78db59eb6c4cf1d61ebfc8227347b66950561ff.zip external_chromium-d78db59eb6c4cf1d61ebfc8227347b66950561ff.tar.gz external_chromium-d78db59eb6c4cf1d61ebfc8227347b66950561ff.tar.bz2 |
Provide a URLRequestContext directly to AutoFill, rather than a factory function
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/webkit ...
https://android-git.corp.google.com/g/82145
Bug: 3044989
Change-Id: Ie5bf6722783f80e8204f7bedf2cd3334ebb6109f
Diffstat (limited to 'android/autofill')
-rw-r--r-- | android/autofill/android_url_request_context_getter.cc | 7 | ||||
-rw-r--r-- | android/autofill/android_url_request_context_getter.h | 8 |
2 files changed, 6 insertions, 9 deletions
diff --git a/android/autofill/android_url_request_context_getter.cc b/android/autofill/android_url_request_context_getter.cc index 9e602cb..5038cd6 100644 --- a/android/autofill/android_url_request_context_getter.cc +++ b/android/autofill/android_url_request_context_getter.cc @@ -30,7 +30,7 @@ scoped_refptr<AndroidURLRequestContextGetter> AndroidURLRequestContextGetter::in URLRequestContext* AndroidURLRequestContextGetter::GetURLRequestContext() { - return (*context_getter_function_)(); + return context_; } scoped_refptr<base::MessageLoopProxy> AndroidURLRequestContextGetter::GetIOMessageLoopProxy() const @@ -56,8 +56,7 @@ AndroidURLRequestContextGetter* AndroidURLRequestContextGetter::Get() return instance_; } -void AndroidURLRequestContextGetter::SetURLRequestContextGetterFunction( - URLRequestContextGetterFunction* function) +void AndroidURLRequestContextGetter::SetURLRequestContext(URLRequestContext* context) { - context_getter_function_ = function; + context_ = context; } diff --git a/android/autofill/android_url_request_context_getter.h b/android/autofill/android_url_request_context_getter.h index 116323d..81b2f56 100644 --- a/android/autofill/android_url_request_context_getter.h +++ b/android/autofill/android_url_request_context_getter.h @@ -34,7 +34,7 @@ class AndroidURLRequestContextGetter : public URLRequestContextGetter { public: AndroidURLRequestContextGetter() - : context_getter_function_(0), io_thread_(0) { }; + : context_(0), io_thread_(0) { }; virtual ~AndroidURLRequestContextGetter() { } @@ -44,14 +44,12 @@ public: static AndroidURLRequestContextGetter* Get(); - typedef URLRequestContext* (URLRequestContextGetterFunction)(); - void SetURLRequestContextGetterFunction( - URLRequestContextGetterFunction* function); + void SetURLRequestContext(URLRequestContext*); void SetIOThread(base::Thread* io_thread) { io_thread_ = io_thread; } private: static scoped_refptr<AndroidURLRequestContextGetter> instance_; - URLRequestContextGetterFunction* context_getter_function_; + URLRequestContext* context_; mutable base::Thread* io_thread_; }; |