Register now for Android Dev Summit 2019!

Builder

open class Builder
kotlin.Any
   ↳ androidx.webkit.TracingConfig.Builder

Builder used to create TracingConfig objects.

Examples:

// Create a configuration with default options: <code><a docref="androidx.webkit.TracingConfig$CATEGORIES_NONE">#CATEGORIES_NONE</a></code>,
        // <code><a docref="androidx.webkit.TracingConfig$RECORD_CONTINUOUSLY">#RECORD_CONTINUOUSLY</a></code>.
        <code>new TracingConfig.Builder().build()</code>// Record trace events from the "web developer" predefined category sets.
        // Uses a ring buffer (the default <code><a docref="androidx.webkit.TracingConfig$RECORD_CONTINUOUSLY">#RECORD_CONTINUOUSLY</a></code>mode) for
        // internal storage during tracing.
        <code>new TracingConfig.Builder().addCategories(CATEGORIES_WEB_DEVELOPER).build()</code>// Record trace events from the "rendering" and "input latency" predefined
        // category sets.
        <code>new TracingConfig.Builder().addCategories(CATEGORIES_RENDERING,
                                          CATEGORIES_INPUT_LATENCY).build()</code>// Record only the trace events from the "browser" category.
        <code>new TracingConfig.Builder().addCategories("browser").build()</code>// Record only the trace events matching the "blink*" and "renderer*" patterns
        // (e.g. "blink.animations", "renderer_host" and "renderer.scheduler" categories).
        <code>new TracingConfig.Builder().addCategories("blink*","renderer*").build()</code>// Record events from the "web developer" predefined category set and events from
        // the "disabled-by-default-v8.gc" category to understand where garbage collection
        // is being triggered. Uses a limited size buffer for internal storage during tracing.
        <code>new TracingConfig.Builder().addCategories(CATEGORIES_WEB_DEVELOPER)
                                   .addCategories("disabled-by-default-v8.gc")
                                   .setTracingMode(RECORD_UNTIL_FULL).build()</code>

Summary

Public constructors

Default constructor for Builder.

Public methods

open TracingConfig.Builder
addCategories(@NonNull vararg predefinedCategories: Int)

Adds predefined sets of categories to be included in the trace output.

open TracingConfig.Builder
addCategories(@NonNull vararg categories: String!)

Adds custom categories to be included in trace output.

open TracingConfig.Builder
addCategories(@NonNull categories: MutableCollection<String!>)

Adds custom categories to be included in trace output.

open TracingConfig

Build TracingConfig using the current settings.

open TracingConfig.Builder
setTracingMode(tracingMode: Int)

Sets the tracing mode for this configuration.

Public constructors

<init>

Builder()

Default constructor for Builder.

Public methods

addCategories

@NonNull open fun addCategories(@NonNull vararg predefinedCategories: Int): TracingConfig.Builder

Adds predefined sets of categories to be included in the trace output. A predefined category set can be one of TracingConfig#CATEGORIES_NONE, TracingConfig#CATEGORIES_ALL, TracingConfig#CATEGORIES_ANDROID_WEBVIEW, TracingConfig#CATEGORIES_WEB_DEVELOPER, TracingConfig#CATEGORIES_INPUT_LATENCY, TracingConfig#CATEGORIES_RENDERING, TracingConfig#CATEGORIES_JAVASCRIPT_AND_RENDERING or TracingConfig#CATEGORIES_FRAME_VIEWER.

Parameters
predefinedCategories Int: A list or bitmask of predefined category sets.
Return
TracingConfig.Builder: The builder to facilitate chaining.

addCategories

@NonNull open fun addCategories(@NonNull vararg categories: String!): TracingConfig.Builder

Adds custom categories to be included in trace output. Note that the categories are defined by the currently-in-use version of WebView. They live in chromium code and are not part of the Android API. See chromium documentation on tracing for more details.

Parameters
categories String!: A list of category patterns. A category pattern can contain wildcards, e.g. "blink*" or full category name e.g. "renderer.scheduler".
Return
TracingConfig.Builder: The builder to facilitate chaining.

addCategories

@NonNull open fun addCategories(@NonNull categories: MutableCollection<String!>): TracingConfig.Builder

Adds custom categories to be included in trace output. Same as addCategories(String...) but allows to pass a Collection as a parameter.

Parameters
categories MutableCollection<String!>: A list of category patterns.
Return
TracingConfig.Builder: The builder to facilitate chaining.

build

@NonNull open fun build(): TracingConfig

Build TracingConfig using the current settings.

Return
TracingConfig: The TracingConfig with the current settings.

setTracingMode

@NonNull open fun setTracingMode(tracingMode: Int): TracingConfig.Builder

Sets the tracing mode for this configuration. When tracingMode is not set explicitly, the default is android.webkit.TracingConfig#RECORD_CONTINUOUSLY.

Parameters
tracingMode Int: The tracing mode to use, one of TracingConfig#RECORD_UNTIL_FULL or TracingConfig#RECORD_CONTINUOUSLY.
Return
TracingConfig.Builder: The builder to facilitate chaining.