1 /* 2 * Copyright 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package androidx.webkit; 18 19 import android.annotation.SuppressLint; 20 21 import androidx.annotation.Nullable; 22 23 import java.util.List; 24 25 /** 26 * Result object associated with 27 * {@link androidx.webkit.WebViewCompat.WebViewStartUpCallback#onSuccess(WebViewStartUpResult)}. 28 * 29 */ 30 @WebViewCompat.ExperimentalAsyncStartUp 31 public interface WebViewStartUpResult { 32 /** 33 * The total time WebView startup took on the UI thread. 34 * <p> 35 * The return value will be {@code null} if the underlying WebView version doesn't support this 36 * method. 37 */ 38 @Nullable 39 @SuppressLint("AutoBoxing") getTotalTimeInUiThreadMillis()40 Long getTotalTimeInUiThreadMillis(); 41 42 /** 43 * The maximum time taken by a task among all the tasks associated with WebView startup in the 44 * UI thread. 45 * <p> 46 * The return value will be {@code null} if the underlying WebView version doesn't support this 47 * method. 48 */ 49 @SuppressLint("AutoBoxing") getMaxTimePerTaskInUiThreadMillis()50 @Nullable Long getMaxTimePerTaskInUiThreadMillis(); 51 52 /** 53 * Code locations where WebView is started up suboptimally. 54 * <p> 55 * This is as a debug tool to enable apps to catch code locations where WebView is suboptimally 56 * started up even when 57 * {@link WebViewCompat#startUpWebView(WebViewStartUpConfig, WebViewCompat.WebViewStartUpCallback)} 58 * is used. 59 * <p> 60 * The list will be chronologically ordered based on the time of creation of the stacktrace. 61 * <p> 62 * The return value will be {@code null} if the underlying WebView version doesn't support this 63 * method. 64 */ 65 @SuppressLint("NullableCollection") getBlockingStartUpLocations()66 @Nullable List<BlockingStartUpLocation> getBlockingStartUpLocations(); 67 } 68 69