Commit c73f1c26 authored by tobiasjs's avatar tobiasjs Committed by Commit bot

aw: Change telemetry traces to collect better startup time stats.

1) Time new WebView + setContentView - this tests how an app that
   has a WebView in its layout will be affected.
2) Time the full time from new WebView to onPageFinished. This
   allows us to know if we regress something that happens
   asynchronously on startup that blocks URL loading.

BUG=

Review-Url: https://codereview.chromium.org/2380053002
Cr-Commit-Position: refs/heads/master@{#422798}
parent d563574b
...@@ -18,6 +18,8 @@ import android.webkit.WebViewClient; ...@@ -18,6 +18,8 @@ import android.webkit.WebViewClient;
public class TelemetryActivity extends Activity { public class TelemetryActivity extends Activity {
static final String DEFAULT_START_UP_TRACE_TAG = "WebViewStartupInterval"; static final String DEFAULT_START_UP_TRACE_TAG = "WebViewStartupInterval";
static final String DEFAULT_LOAD_URL_TRACE_TAG = "WebViewBlankUrlLoadInterval"; static final String DEFAULT_LOAD_URL_TRACE_TAG = "WebViewBlankUrlLoadInterval";
static final String DEFAULT_START_UP_AND_LOAD_URL_TRACE_TAG =
"WebViewStartupAndLoadBlankUrlInterval";
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
...@@ -28,11 +30,15 @@ public class TelemetryActivity extends Activity { ...@@ -28,11 +30,15 @@ public class TelemetryActivity extends Activity {
Intent intent = getIntent(); Intent intent = getIntent();
final String startUpTraceTag = intent.getStringExtra("WebViewStartUpTraceTag"); final String startUpTraceTag = intent.getStringExtra("WebViewStartUpTraceTag");
final String loadUrlTraceTag = intent.getStringExtra("WebViewLoadUrlTraceTag"); final String loadUrlTraceTag = intent.getStringExtra("WebViewLoadUrlTraceTag");
final String startUpAndLoadUrlTraceTag =
intent.getStringExtra("WebViewStartUpAndLoadUrlTraceTag");
Trace.beginSection(startUpTraceTag == null ? DEFAULT_START_UP_AND_LOAD_URL_TRACE_TAG
: startUpAndLoadUrlTraceTag);
Trace.beginSection(startUpTraceTag == null ? DEFAULT_START_UP_TRACE_TAG : startUpTraceTag); Trace.beginSection(startUpTraceTag == null ? DEFAULT_START_UP_TRACE_TAG : startUpTraceTag);
WebView webView = new WebView(this); WebView webView = new WebView(this);
Trace.endSection();
setContentView(webView); setContentView(webView);
Trace.endSection();
CookieManager.setAcceptFileSchemeCookies(true); CookieManager.setAcceptFileSchemeCookies(true);
WebSettings settings = webView.getSettings(); WebSettings settings = webView.getSettings();
...@@ -56,6 +62,7 @@ public class TelemetryActivity extends Activity { ...@@ -56,6 +62,7 @@ public class TelemetryActivity extends Activity {
public void onPageFinished(WebView view, String url) { public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url); super.onPageFinished(view, url);
Trace.endSection(); Trace.endSection();
Trace.endSection();
} }
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment