Commit 8a0a9c6e authored by PKH's avatar PKH Committed by Commit Bot

[Android WebAPK] Add WebappSplashScreen.hidingAnimation trace event

This CL:
- Adds the "WebappSplashScreen.hidingAnimation" trace event which
  tracks the start and stop of the splash screen hide animation.
- Removes the "WebappSplashScreen" trace event because it is redudant
  with "WebappActivity.showSplash" and
  "WebappSplashScreen.hidingAnimation".

BUG=945784

Change-Id: If4e6513a288867b028c5a797d41ef32d754708e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1547068Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#646597}
parent c777e7ce
......@@ -86,7 +86,7 @@ public class SameActivityWebappSplashDelegate implements WebappSplashDelegate {
mSplashScreen = new FrameLayout(context);
mSplashScreen.setBackgroundColor(backgroundColor);
mParentView.addView(mSplashScreen);
startSplashscreenTraceEvents();
recordTraceEventsShowedSplash();
if (webappInfo.isForWebApk()) {
initializeLayout(webappInfo, backgroundColor, ((WebApkInfo) webappInfo).splashIcon());
......@@ -125,6 +125,7 @@ public class SameActivityWebappSplashDelegate implements WebappSplashDelegate {
assert mIsSplashVisible;
mIsSplashVisible = false;
recordTraceEventsStartedHidingSplash();
mSplashScreen.animate().alpha(0f).withEndAction(new Runnable() {
@Override
public void run() {
......@@ -134,7 +135,7 @@ public class SameActivityWebappSplashDelegate implements WebappSplashDelegate {
mWebApkNetworkErrorObserver = null;
}
finishSplashscreenTraceEvents();
recordTraceEventsFinishedHidingSplash();
mTab = null;
mSplashScreen = null;
finishedHidingCallback.run();
......@@ -225,14 +226,17 @@ public class SameActivityWebappSplashDelegate implements WebappSplashDelegate {
if (mNativeLoaded) mUmaCache.commitMetrics();
}
private void startSplashscreenTraceEvents() {
TraceEvent.startAsync("WebappSplashScreen", hashCode());
private void recordTraceEventsShowedSplash() {
SingleShotOnDrawListener.install(mParentView,
() -> { TraceEvent.startAsync("WebappSplashScreen.visible", hashCode()); });
}
private void finishSplashscreenTraceEvents() {
TraceEvent.finishAsync("WebappSplashScreen", hashCode());
private void recordTraceEventsStartedHidingSplash() {
TraceEvent.startAsync("WebappSplashScreen.hidingAnimation", hashCode());
}
private void recordTraceEventsFinishedHidingSplash() {
TraceEvent.finishAsync("WebappSplashScreen.hidingAnimation", hashCode());
SingleShotOnDrawListener.install(mParentView,
() -> { TraceEvent.finishAsync("WebappSplashScreen.visible", hashCode()); });
}
......
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