Commit 1ed711c6 authored by Eric Seckler's avatar Eric Seckler Committed by Commit Bot

TtsPlatformImpl: Use async trace event for async computation

The "TtsPlatformImpl:initialize" event is used around an async task
that executes in the background, thus should be an async trace event
outside the current thread's track.

Change-Id: Icc89048a1c7e2a9659e12fbe74d5b0600b6becf1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2252166
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Auto-Submit: Eric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#780336}
parent 5667720b
...@@ -279,7 +279,7 @@ class TtsPlatformImpl implements ActivityStateListener { ...@@ -279,7 +279,7 @@ class TtsPlatformImpl implements ActivityStateListener {
* we can call TtsPlatformImplJni.get().voicesChanged directly. * we can call TtsPlatformImplJni.get().voicesChanged directly.
*/ */
private void initialize() { private void initialize() {
TraceEvent.begin("TtsPlatformImpl:initialize"); TraceEvent.startAsync("TtsPlatformImpl:initialize", hashCode());
new AsyncTask<List<TtsVoice>>() { new AsyncTask<List<TtsVoice>>() {
@Override @Override
...@@ -323,7 +323,8 @@ class TtsPlatformImpl implements ActivityStateListener { ...@@ -323,7 +323,8 @@ class TtsPlatformImpl implements ActivityStateListener {
if (mPendingUtterance != null) mPendingUtterance.speak(); if (mPendingUtterance != null) mPendingUtterance.speak();
TraceEvent.end("TtsPlatformImpl:initialize"); TraceEvent.finishAsync(
"TtsPlatformImpl:initialize", TtsPlatformImpl.this.hashCode());
} }
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
......
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