Commit c006764d authored by bttk's avatar bttk Committed by Commit Bot

metrics: Refactor CachedMetrics in AccountManagerFacade

Bug: 1046181
Change-Id: I371ad290e454e55c0f8133b4397b26a9b902e3f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024176
Auto-Submit: bttk <bttk@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarBoris Sazonov <bsazonov@chromium.org>
Reviewed-by: default avatarEnder <ender@google.com>
Cr-Commit-Position: refs/heads/master@{#742548}
parent 0599216c
...@@ -30,7 +30,7 @@ import org.chromium.base.Log; ...@@ -30,7 +30,7 @@ import org.chromium.base.Log;
import org.chromium.base.ObserverList; import org.chromium.base.ObserverList;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.metrics.CachedMetrics; import org.chromium.base.metrics.RecordHistogram;
import org.chromium.base.task.AsyncTask; import org.chromium.base.task.AsyncTask;
import org.chromium.components.signin.util.PatternMatcher; import org.chromium.components.signin.util.PatternMatcher;
...@@ -89,8 +89,6 @@ public class AccountManagerFacade { ...@@ -89,8 +89,6 @@ public class AccountManagerFacade {
private final AtomicReference<AccountManagerResult<List<Account>>> mFilteredAccounts = private final AtomicReference<AccountManagerResult<List<Account>>> mFilteredAccounts =
new AtomicReference<>(); new AtomicReference<>();
private final CountDownLatch mPopulateAccountCacheLatch = new CountDownLatch(1); private final CountDownLatch mPopulateAccountCacheLatch = new CountDownLatch(1);
private final CachedMetrics.TimesHistogramSample mPopulateAccountCacheWaitingTimeHistogram =
new CachedMetrics.TimesHistogramSample("Signin.AndroidPopulateAccountCacheWaitingTime");
private final ArrayList<Runnable> mCallbacksWaitingForCachePopulation = new ArrayList<>(); private final ArrayList<Runnable> mCallbacksWaitingForCachePopulation = new ArrayList<>();
...@@ -306,7 +304,8 @@ public class AccountManagerFacade { ...@@ -306,7 +304,8 @@ public class AccountManagerFacade {
mPopulateAccountCacheLatch.await(); mPopulateAccountCacheLatch.await();
maybeAccounts = mFilteredAccounts.get(); maybeAccounts = mFilteredAccounts.get();
if (ThreadUtils.runningOnUiThread()) { if (ThreadUtils.runningOnUiThread()) {
mPopulateAccountCacheWaitingTimeHistogram.record( RecordHistogram.recordTimesHistogram(
"Signin.AndroidPopulateAccountCacheWaitingTime",
SystemClock.elapsedRealtime() - now); SystemClock.elapsedRealtime() - now);
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
......
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