Commit 8d96473d authored by Torne (Richard Coles)'s avatar Torne (Richard Coles) Committed by Commit Bot

Fix incorrect return in finally block losing exceptions.

Returning in a finally block causes exceptions to be discarded. There's
no reason to log a UMA stat for the performance of a startup that threw
an exception (since we're going to crash the app anyway), so just take
it entirely outside the finally block and invert the condition to only
record the UMA stat if mFactory.hasStarted().

Also adjust another place that had the same pattern without the "return"
to match, as again there's no need to log the UMA stat when there's an
exception.

Bug: 862662
Change-Id: Ie6d24cee5bb9342016c364244256c8b73a8184f7
Reviewed-on: https://chromium-review.googlesource.com/1133332
Commit-Queue: Richard Coles <torne@chromium.org>
Reviewed-by: default avatarTobias Sargeant <tobiasjs@chromium.org>
Cr-Commit-Position: refs/heads/master@{#574941}
parent 1757cb4e
......@@ -232,10 +232,10 @@ class WebViewChromium implements WebViewProvider, WebViewProvider.ScrollDelegate
}
}
});
} finally {
// The real initialization may be deferred, in which case we don't record this.
if (!mFactory.hasStarted()) return;
}
// If initialization hasn't been deferred, record a startup time histogram entry.
if (mFactory.hasStarted()) {
TimesHistogramSample histogram = new TimesHistogramSample(
"Android.WebView.Startup.CreationTime.Stage2.ProviderInit."
+ (isFirstWebViewInit ? "Cold" : "Warm"),
......
......@@ -285,12 +285,11 @@ public class WebViewChromiumFactoryProvider implements WebViewFactoryProvider {
shouldDisableThreadChecking(ContextUtils.getApplicationContext());
setSingleton(this);
} finally {
TimesHistogramSample histogram = new TimesHistogramSample(
"Android.WebView.Startup.CreationTime.Stage1.FactoryInit",
TimeUnit.MILLISECONDS);
histogram.record(SystemClock.elapsedRealtime() - startTime);
}
TimesHistogramSample histogram = new TimesHistogramSample(
"Android.WebView.Startup.CreationTime.Stage1.FactoryInit", TimeUnit.MILLISECONDS);
histogram.record(SystemClock.elapsedRealtime() - startTime);
}
/* package */ static void checkStorageIsNotDeviceProtected(Context context) {
......
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