summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortwifkak <twifkak@chromium.org>2015-09-14 11:08:17 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-14 18:08:57 +0000
commitd12a62df87f73b6ee73c0a0169c9f2716dd4ee17 (patch)
tree4183ae81eb173fafe12f053acd8f82fa01ddb60a
parent43057aca3cd78494a83b433b0aa9d636e5d5f3e0 (diff)
downloadchromium_src-d12a62df87f73b6ee73c0a0169c9f2716dd4ee17.zip
chromium_src-d12a62df87f73b6ee73c0a0169c9f2716dd4ee17.tar.gz
chromium_src-d12a62df87f73b6ee73c0a0169c9f2716dd4ee17.tar.bz2
Queue Precache.Fetch.FailureReasons values.
Queue the histogram values until native libs have been loaded, at which point all the values in the queue will be removed and posted to UMA. This is necessary to try to determine if the underreporting for this metric is a result of PrecacheServiceLauncher's onReceive() not being called that often, or of native libs not being available most of the time. BUG=499532 Review URL: https://codereview.chromium.org/1337253002 Cr-Commit-Position: refs/heads/master@{#348655}
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncher.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncher.java
index 8d10397..989d3e5 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncher.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncher.java
@@ -23,7 +23,9 @@ import org.chromium.base.library_loader.LibraryLoader;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.components.precache.DeviceState;
+import java.util.ArrayDeque;
import java.util.EnumSet;
+import java.util.Queue;
/**
* BroadcastReceiver that determines when conditions are right for precaching, and starts the
@@ -53,6 +55,8 @@ public class PrecacheServiceLauncher extends BroadcastReceiver {
private PrecacheLauncher mPrecacheLauncher = PrecacheLauncher.get();
+ private Queue<Integer> mFailureReasonsToRecord = new ArrayDeque<Integer>();
+
@VisibleForTesting
void setDeviceState(DeviceState deviceState) {
mDeviceState = deviceState;
@@ -153,11 +157,21 @@ public class PrecacheServiceLauncher extends BroadcastReceiver {
*
* @param context The context passed to onReceive().
*/
- private void recordFailureReasons(Context context) {
- if (!LibraryLoader.isInitialized()) return;
-
+ @VisibleForTesting
+ void recordFailureReasons(Context context) {
int reasons = FailureReason.bitValue(failureReasons(context));
- RecordHistogram.recordSparseSlowlyHistogram("Precache.Fetch.FailureReasons", reasons);
+
+ // Queue up this failure reason, for the next time we are able to record it in UMA.
+ mFailureReasonsToRecord.add(reasons);
+
+ // If native libraries are loaded, then we are able to flush our queue to UMA.
+ if (LibraryLoader.isInitialized()) {
+ Integer reasonsToRecord;
+ while ((reasonsToRecord = mFailureReasonsToRecord.poll()) != null) {
+ RecordHistogram.recordSparseSlowlyHistogram(
+ "Precache.Fetch.FailureReasons", reasonsToRecord);
+ }
+ }
}
@Override