Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a07ccc0 authored by Tim Volodine's avatar Tim Volodine
Browse files

WebView Tracing API: remove LARGE_BUFFER, make RECORD_CONTINUOUSLY the default mode

This patch:
- remove the RECORD_UNTIL_FULL_LARGE_BUFFER tracing option, because
  this does not appear really useful in the production setting as
  the buffer size limit exceeds the device memory and can grow
  uncontrollably large.
- make RECORD_CONTINUOUSLY the default mode for tracing, to make
  sure the least memory is used by default (typically 4x less than the
  previous default RECORD_UNTIL_FULL).
- add some missing IntDef values (to make them match with the constants)

BUG: 63750258
Test: CTS

Change-Id: Ib3698273dee776ebc7a8388fc1bd8c80255e3b63
parent c16de056
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -51577,7 +51577,6 @@ package android.webkit {
    field public static final int CATEGORIES_WEB_DEVELOPER = 4; // 0x4
    field public static final int RECORD_CONTINUOUSLY = 1; // 0x1
    field public static final int RECORD_UNTIL_FULL = 0; // 0x0
    field public static final int RECORD_UNTIL_FULL_LARGE_BUFFER = 2; // 0x2
  }
  public static class TracingConfig.Builder {
+19 −24
Original line number Diff line number Diff line
@@ -35,9 +35,9 @@ public class TracingConfig {
    private @TracingMode int mTracingMode;

    /** @hide */
    @IntDef(flag = true, value = {CATEGORIES_NONE, CATEGORIES_WEB_DEVELOPER,
            CATEGORIES_INPUT_LATENCY, CATEGORIES_RENDERING, CATEGORIES_JAVASCRIPT_AND_RENDERING,
            CATEGORIES_FRAME_VIEWER})
    @IntDef(flag = true, value = {CATEGORIES_NONE, CATEGORIES_ALL, CATEGORIES_ANDROID_WEBVIEW,
            CATEGORIES_WEB_DEVELOPER, CATEGORIES_INPUT_LATENCY, CATEGORIES_RENDERING,
            CATEGORIES_JAVASCRIPT_AND_RENDERING, CATEGORIES_FRAME_VIEWER})
    @Retention(RetentionPolicy.SOURCE)
    public @interface PredefinedCategories {}

@@ -90,33 +90,27 @@ public class TracingConfig {
    public static final int CATEGORIES_FRAME_VIEWER = 1 << 6;

    /** @hide */
    @IntDef({RECORD_UNTIL_FULL, RECORD_CONTINUOUSLY, RECORD_UNTIL_FULL_LARGE_BUFFER})
    @IntDef({RECORD_UNTIL_FULL, RECORD_CONTINUOUSLY})
    @Retention(RetentionPolicy.SOURCE)
    public @interface TracingMode {}

    /**
     * Record trace events until the internal tracing buffer is full. Default tracing mode.
     * Typically the buffer memory usage is between {@link #RECORD_CONTINUOUSLY} and the
     * {@link #RECORD_UNTIL_FULL_LARGE_BUFFER}. Depending on the implementation typically allows
     * up to 256k events to be stored.
     * Record trace events until the internal tracing buffer is full.
     *
     * Typically the buffer memory usage is larger than {@link #RECORD_CONTINUOUSLY}.
     * Depending on the implementation typically allows up to 256k events to be stored.
     */
    public static final int RECORD_UNTIL_FULL = 0;

    /**
     * Record trace events continuously using an internal ring buffer. Overwrites
     * old events if they exceed buffer capacity. Uses less memory than both
     * {@link #RECORD_UNTIL_FULL} and {@link #RECORD_UNTIL_FULL_LARGE_BUFFER} modes.
     * Depending on the implementation typically allows up to 64k events to be stored.
     * Record trace events continuously using an internal ring buffer. Default tracing mode.
     *
     * Overwrites old events if they exceed buffer capacity. Uses less memory than the
     * {@link #RECORD_UNTIL_FULL} mode. Depending on the implementation typically allows
     * up to 64k events to be stored.
     */
    public static final int RECORD_CONTINUOUSLY = 1;

    /**
     * Record trace events using a larger internal tracing buffer until it is full.
     * Uses significantly more memory than {@link #RECORD_UNTIL_FULL} and may not be
     * suitable on devices with smaller RAM.
     */
    public static final int RECORD_UNTIL_FULL_LARGE_BUFFER = 2;

    /**
     * @hide
     */
@@ -182,7 +176,7 @@ public class TracingConfig {
    public static class Builder {
        private @PredefinedCategories int mPredefinedCategories = CATEGORIES_NONE;
        private final List<String> mCustomIncludedCategories = new ArrayList<String>();
        private @TracingMode int mTracingMode = RECORD_UNTIL_FULL;
        private @TracingMode int mTracingMode = RECORD_CONTINUOUSLY;

        /**
         * Default constructor for Builder.
@@ -202,7 +196,9 @@ public class TracingConfig {
         *
         * @param predefinedCategories list or bitmask of predefined category sets to use:
         *                    {@link #CATEGORIES_NONE}, {@link #CATEGORIES_ALL},
         *                    {@link #CATEGORIES_WEB_DEVELOPER}, {@link #CATEGORIES_INPUT_LATENCY},
         *                    {@link #CATEGORIES_ANDROID_WEBVIEW},
         *                    {@link #CATEGORIES_WEB_DEVELOPER},
         *                    {@link #CATEGORIES_INPUT_LATENCY},
         *                    {@link #CATEGORIES_RENDERING},
         *                    {@link #CATEGORIES_JAVASCRIPT_AND_RENDERING} or
         *                    {@link #CATEGORIES_FRAME_VIEWER}.
@@ -250,9 +246,8 @@ public class TracingConfig {
        /**
         * Sets the tracing mode for this configuration.
         *
         * @param tracingMode tracing mode to use, one of {@link #RECORD_UNTIL_FULL},
         *                    {@link #RECORD_CONTINUOUSLY} or
         *                    {@link #RECORD_UNTIL_FULL_LARGE_BUFFER}.
         * @param tracingMode tracing mode to use, one of {@link #RECORD_UNTIL_FULL} or
         *                    {@link #RECORD_CONTINUOUSLY}.
         * @return The builder to facilitate chaining.
         */
        public Builder setTracingMode(@TracingMode int tracingMode) {
+2 −3
Original line number Diff line number Diff line
@@ -60,9 +60,8 @@ public abstract class TracingController {
     * Starts tracing all webviews. Depending on the trace mode in traceConfig
     * specifies how the trace events are recorded.
     *
     * For tracing modes {@link TracingConfig#RECORD_UNTIL_FULL},
     * {@link TracingConfig#RECORD_CONTINUOUSLY} and
     * {@link TracingConfig#RECORD_UNTIL_FULL_LARGE_BUFFER} the events are recorded
     * For tracing modes {@link TracingConfig#RECORD_UNTIL_FULL} and
     * {@link TracingConfig#RECORD_CONTINUOUSLY} the events are recorded
     * using an internal buffer and flushed to the outputStream when
     * {@link #stop(OutputStream, Executor)} is called.
     *