WebViewStartUpConfig.Builder
@WebViewCompat.ExperimentalAsyncStartUp
public final class WebViewStartUpConfig.Builder
Summary
Public constructors |
|---|
|
Builder for |
Public methods |
|
|---|---|
@NonNull WebViewStartUpConfig |
build()Build and return a |
@NonNull WebViewStartUpConfig.Builder |
setProfilesToLoadDuringStartup(@NonNull Set<String> profiles)Specifies a set of profiles to load before the startup callback is invoked. |
@NonNull WebViewStartUpConfig.Builder |
setShouldRunUiThreadStartUpTasks(Setter to run only parts of startup that doesn't block the UI thread. |
Public constructors
Public methods
build
public @NonNull WebViewStartUpConfig build()
Build and return a WebViewStartUpConfig object.
| Returns | |
|---|---|
@NonNull WebViewStartUpConfig |
immutable |
setProfilesToLoadDuringStartup
public @NonNull WebViewStartUpConfig.Builder setProfilesToLoadDuringStartup(@NonNull Set<String> profiles)
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 | |
|---|---|
@NonNull Set<String> profiles |
A |
| Returns | |
|---|---|
@NonNull WebViewStartUpConfig.Builder |
The |
| Throws | |
|---|---|
java.lang.IllegalArgumentException |
if this method is called when |
setShouldRunUiThreadStartUpTasks
public @NonNull WebViewStartUpConfig.Builder setShouldRunUiThreadStartUpTasks(
boolean shouldRunUiThreadStartUpTasks
)
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 |