Commit 497cdcd6 authored by Wei-Yin Chen (陳威尹)'s avatar Wei-Yin Chen (陳威尹) Committed by Commit Bot

Make partner bookmark count not skewed at zero

Record partner bookmark count as zero when skipped, so that
the distribution is not skewed.

Bug: 787132
Change-Id: Ie5c0c49120ff47a0fce984de823928997a1652f8
Reviewed-on: https://chromium-review.googlesource.com/826465Reviewed-by: default avatarSteven Holte <holte@chromium.org>
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524445}
parent f50ec330
......@@ -155,6 +155,10 @@ public class PartnerBookmarksReader {
}
}
void recordPartnerBookmarkCount(int count) {
RecordHistogram.recordCount100Histogram("PartnerBookmark.Count2", count);
}
/** Handles fetching partner bookmarks in a background thread. */
private class ReadBookmarksTask extends AsyncTask<Void, Void, Void> {
private final Object mRootSync = new Object();
......@@ -163,6 +167,7 @@ public class PartnerBookmarksReader {
SharedPreferences.Editor editor = ContextUtils.getAppSharedPreferences().edit();
editor.putLong(LAST_EMPTY_READ_PREFS_NAME, System.currentTimeMillis());
editor.apply();
recordPartnerBookmarkCount(0);
Log.w(TAG,
"Obtained zero partner bookmarks. "
......@@ -216,7 +221,7 @@ public class PartnerBookmarksReader {
}
bookmarkIterator.close();
int count = urlSet.size();
RecordHistogram.recordCount100Histogram("PartnerBookmark.Count", count);
recordPartnerBookmarkCount(count);
if (count == 0) {
handleZeroBookmark();
......
......@@ -39,15 +39,19 @@ public class PartnerBookmarksShim {
PartnerBookmarksReader reader = new PartnerBookmarksReader(context);
boolean systemOrPreStable =
(context.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) == 1
|| !ChromeVersionInfo.isStableBuild();
if (!systemOrPreStable) {
reader.onBookmarksRead();
return;
}
boolean skip = shouldSkipReading();
RecordHistogram.recordBooleanHistogram("PartnerBookmark.Skipped", skip);
if (skip) {
Log.i(TAG, "Skip reading partner bookmarks since recent result was empty.");
}
boolean systemOrPreStable =
(context.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) == 1
|| !ChromeVersionInfo.isStableBuild();
if (skip || !systemOrPreStable) {
reader.recordPartnerBookmarkCount(0);
reader.onBookmarksRead();
return;
}
......
......@@ -58848,6 +58848,9 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</histogram>
<histogram name="PartnerBookmark.Count" units="bookmarks">
<obsolete>
Deprecated 2017-12 by PartnerBookmark.Count2.
</obsolete>
<owner>wychen@chromium.org</owner>
<summary>
The number of partner bookmark entries. Note that zero would be
......@@ -58858,6 +58861,15 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>
<histogram name="PartnerBookmark.Count2" units="bookmarks">
<owner>wychen@chromium.org</owner>
<summary>
The number of partner bookmark entries. Logged when using the bookmark, and
at most once per cold start. Note that the distribution is weighted by
bookmark usage.
</summary>
</histogram>
<histogram name="PartnerBookmark.FaviconThrottleFetchResult"
enum="PartnerBookmark.FaviconFetchResult">
<owner>thildebr@chromium.org</owner>
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