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 { ...@@ -86,7 +86,7 @@ public class SameActivityWebappSplashDelegate implements WebappSplashDelegate {
mSplashScreen = new FrameLayout(context); mSplashScreen = new FrameLayout(context);
mSplashScreen.setBackgroundColor(backgroundColor); mSplashScreen.setBackgroundColor(backgroundColor);
mParentView.addView(mSplashScreen); mParentView.addView(mSplashScreen);
startSplashscreenTraceEvents(); recordTraceEventsShowedSplash();
if (webappInfo.isForWebApk()) { if (webappInfo.isForWebApk()) {
initializeLayout(webappInfo, backgroundColor, ((WebApkInfo) webappInfo).splashIcon()); initializeLayout(webappInfo, backgroundColor, ((WebApkInfo) webappInfo).splashIcon());
...@@ -125,6 +125,7 @@ public class SameActivityWebappSplashDelegate implements WebappSplashDelegate { ...@@ -125,6 +125,7 @@ public class SameActivityWebappSplashDelegate implements WebappSplashDelegate {
assert mIsSplashVisible; assert mIsSplashVisible;
mIsSplashVisible = false; mIsSplashVisible = false;
recordTraceEventsStartedHidingSplash();
mSplashScreen.animate().alpha(0f).withEndAction(new Runnable() { mSplashScreen.animate().alpha(0f).withEndAction(new Runnable() {
@Override @Override
public void run() { public void run() {
...@@ -134,7 +135,7 @@ public class SameActivityWebappSplashDelegate implements WebappSplashDelegate { ...@@ -134,7 +135,7 @@ public class SameActivityWebappSplashDelegate implements WebappSplashDelegate {
mWebApkNetworkErrorObserver = null; mWebApkNetworkErrorObserver = null;
} }
finishSplashscreenTraceEvents(); recordTraceEventsFinishedHidingSplash();
mTab = null; mTab = null;
mSplashScreen = null; mSplashScreen = null;
finishedHidingCallback.run(); finishedHidingCallback.run();
...@@ -225,14 +226,17 @@ public class SameActivityWebappSplashDelegate implements WebappSplashDelegate { ...@@ -225,14 +226,17 @@ public class SameActivityWebappSplashDelegate implements WebappSplashDelegate {
if (mNativeLoaded) mUmaCache.commitMetrics(); if (mNativeLoaded) mUmaCache.commitMetrics();
} }
private void startSplashscreenTraceEvents() { private void recordTraceEventsShowedSplash() {
TraceEvent.startAsync("WebappSplashScreen", hashCode());
SingleShotOnDrawListener.install(mParentView, SingleShotOnDrawListener.install(mParentView,
() -> { TraceEvent.startAsync("WebappSplashScreen.visible", hashCode()); }); () -> { TraceEvent.startAsync("WebappSplashScreen.visible", hashCode()); });
} }
private void finishSplashscreenTraceEvents() { private void recordTraceEventsStartedHidingSplash() {
TraceEvent.finishAsync("WebappSplashScreen", hashCode()); TraceEvent.startAsync("WebappSplashScreen.hidingAnimation", hashCode());
}
private void recordTraceEventsFinishedHidingSplash() {
TraceEvent.finishAsync("WebappSplashScreen.hidingAnimation", hashCode());
SingleShotOnDrawListener.install(mParentView, SingleShotOnDrawListener.install(mParentView,
() -> { TraceEvent.finishAsync("WebappSplashScreen.visible", hashCode()); }); () -> { 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