WebViewStartUpConfig.Builder
@WebViewCompat.ExperimentalAsyncStartUp
class WebViewStartUpConfig.Builder
Summary
Public constructors |
|---|
|
Builder for |
Public functions |
|
|---|---|
WebViewStartUpConfig |
build()Build and return a |
WebViewStartUpConfig.Builder |
setProfilesToLoadDuringStartup(profiles: (Mutable)Set<String!>)Specifies a set of profiles to load before the startup callback is invoked. |
WebViewStartUpConfig.Builder |
setShouldRunUiThreadStartUpTasks(Setter to run only parts of startup that doesn't block the UI thread. |
Public constructors
Builder
Builder(executor: Executor)
Builder for WebViewStartUpConfig.
| Parameters | |
|---|---|
executor: Executor |
The portions of WebView startup that can run on a background thread are scheduled on this executor. Blocking tasks will be run on the executor. |
Public functions
build
fun build(): WebViewStartUpConfig
Build and return a WebViewStartUpConfig object.
| Returns | |
|---|---|
WebViewStartUpConfig |
immutable |
setProfilesToLoadDuringStartup
fun setProfilesToLoadDuringStartup(profiles: (Mutable)Set<String!>): WebViewStartUpConfig.Builder
Specifies a set of profiles to load before the startup callback is invoked.
This method allows you to specify a set of profiles that are guaranteed to have been loaded before the WebViewCompat.WebViewStartUpCallback is invoked. This can improve the performance of subsequent operations on those profiles at the cost of increasing the initial startup time.
Any profiles not specified in the set will not have resources allocated for them until they are used for the first time.
The behavior depends on the value provided:
- Empty Set: No profiles are loaded, not even the default profile.
- Non-empty Set: All profiles named in the set are loaded. These profiles will be created if they do not already exist.
Note: This method cannot be used if setShouldRunUiThreadStartUpTasks is set to false.
This method will be no-op if isStartupFeatureSupported returns false for STARTUP_FEATURE_SET_PROFILES_TO_LOAD.
| Parameters | |
|---|---|
profiles: (Mutable)Set<String!> |
A |
| Returns | |
|---|---|
WebViewStartUpConfig.Builder |
The |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if this method is called when |
setShouldRunUiThreadStartUpTasks
fun setShouldRunUiThreadStartUpTasks(
shouldRunUiThreadStartUpTasks: Boolean
): WebViewStartUpConfig.Builder
Setter to run only parts of startup that doesn't block the UI thread.
WebView startup tasks that are required to run on the UI thread are not attempted when startUpWebView is called if set to false.
Defaults to `true`. If not set to `false`, UI thread startup tasks will be run.
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if this is set to |