Turn WebViewChromiumFactoryProvider into a singleton |
||
Issue descriptionThe WebView Support Library glue will need to hook into the existing WebViewChromiumFactoryProvider created when the framework loads code from the WebView APK. At the moment that provider is owned by android.webkit framework code - so there's no straight-forward way to pass that object to the support library code without exposing an addition Android API (that wouldn't make sense to apps). We will turn WebViewChromiumFactoryProvider into a singleton to allow the support library to access it.
,
Feb 2 2018
> And in L we don't call WebViewChromiumFactoryProvider.create, we call its ctor In practice, there's still only one instance of WebViewChromiumFactoryProvider even though you can create more. So you could say have the constructor set a global variable, and have a getInstance method that returns that.
,
Feb 2 2018
although that only works if support lib can force android to create WebViewChromiumFactoryProvider first before trying to use it
,
Feb 2 2018
Android will always create WebViewChromiumFactoryProvider first - the way the support library hooks into the webview apk classloader will trigger the code in the framework (WebViewFactory) that reflects into WebViewChromiumFactoryProvider.
,
Feb 6 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/3854eccb09e28bb9316aa1305ad96aa6f8c8b199 commit 3854eccb09e28bb9316aa1305ad96aa6f8c8b199 Author: Gustav Sennton <gsennton@google.com> Date: Tue Feb 06 02:13:59 2018 Add a singleton from where to fetch the WebViewChromiumFactoryProvider. The WebView support library glue needs a way to fetch the WebViewChromiumFactoryProvider, this CL adds a mechanism for keeping track of our only instance of WebViewChromiumFactoryProvider. Bug: 808417 Change-Id: I37c76d82b01004753d962ade6874184b28eaa54b Reviewed-on: https://chromium-review.googlesource.com/901624 Commit-Queue: Gustav Sennton <gsennton@chromium.org> Reviewed-by: Richard Coles <torne@chromium.org> Reviewed-by: Bo <boliu@chromium.org> Cr-Commit-Position: refs/heads/master@{#534588} [modify] https://crrev.com/3854eccb09e28bb9316aa1305ad96aa6f8c8b199/android_webview/glue/java/src/com/android/webview/chromium/WebViewChromiumFactoryProvider.java
,
Feb 6 2018
,
Feb 6 2018
oh one more note for support lib, you probably want @UsedByReflection on things that will be used by reflection, so proguard doesn't obfuscate or optimize away the things you need
,
Feb 6 2018
Ah, thanks Bo! Filed crbug.com/809471 |
||
►
Sign in to add a comment |
||
Comment 1 by gsennton@chromium.org
, Feb 2 2018