Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: components/doodle/doodle_service.h

Issue 2760253003: [Doodle] Record UMA for DoodleConfig download outcome and time (Closed)
Patch Set: review 1 Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/doodle/doodle_service_factory.cc ('k') | components/doodle/doodle_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/doodle/doodle_service.h
diff --git a/components/doodle/doodle_service.h b/components/doodle/doodle_service.h
index 3b519f8d06ede7eadd328a4e6fcdd6b6427ab955..9d6c7fcf4313969aa5b656655470e8625b8a25d2 100644
--- a/components/doodle/doodle_service.h
+++ b/components/doodle/doodle_service.h
@@ -11,6 +11,7 @@
#include "base/observer_list.h"
#include "base/optional.h"
#include "base/time/clock.h"
+#include "base/time/tick_clock.h"
#include "base/timer/timer.h"
#include "components/doodle/doodle_fetcher.h"
#include "components/doodle/doodle_types.h"
@@ -38,7 +39,8 @@ class DoodleService : public KeyedService {
DoodleService(PrefService* pref_service,
std::unique_ptr<DoodleFetcher> fetcher,
std::unique_ptr<base::OneShotTimer> expiry_timer,
- std::unique_ptr<base::Clock> clock);
+ std::unique_ptr<base::Clock> clock,
+ std::unique_ptr<base::TickClock> tick_clock);
~DoodleService() override;
// KeyedService implementation.
@@ -61,13 +63,34 @@ class DoodleService : public KeyedService {
void Refresh();
private:
+ // Note: Keep in sync with the corresponding enum in histograms.xml. Never
+ // remove values, and only insert new values at the end.
+ enum DownloadOutcome {
fhorschig 2017/03/21 16:41:34 Question: could we use enum class DownloadOutcome:
Marc Treib 2017/03/21 16:48:59 Yes.
+ OUTCOME_NEW_DOODLE,
+ OUTCOME_REVALIDATED_DOODLE,
+ OUTCOME_CHANGED_DOODLE,
+ OUTCOME_NO_DOODLE,
+ OUTCOME_EXPIRED,
+ OUTCOME_DOWNLOAD_ERROR,
+ OUTCOME_PARSING_ERROR,
+ // Insert new values here!
+ OUTCOME_COUNT
+ };
+
+ static bool DownloadOutcomeIsSuccess(DownloadOutcome outcome);
fhorschig 2017/03/21 16:41:34 It's static because it couldn't access DownloadOut
Marc Treib 2017/03/21 16:48:59 It's a *member* because otherwise it couldn't see
+ static void RecordDownloadMetrics(DownloadOutcome outcome,
+ base::TimeDelta download_time);
+
// Callback for the fetcher.
- void DoodleFetched(DoodleState state,
+ void DoodleFetched(base::TimeTicks start_time,
+ DoodleState state,
base::TimeDelta time_to_live,
const base::Optional<DoodleConfig>& doodle_config);
- void UpdateCachedConfig(base::TimeDelta time_to_live,
- const base::Optional<DoodleConfig>& doodle_config);
+ DownloadOutcome UpdateCachedConfig(
+ DoodleState state,
+ base::TimeDelta time_to_live,
+ const base::Optional<DoodleConfig>& doodle_config);
// Callback for the expiry timer.
void DoodleExpired();
@@ -79,6 +102,7 @@ class DoodleService : public KeyedService {
std::unique_ptr<base::OneShotTimer> expiry_timer_;
std::unique_ptr<base::Clock> clock_;
+ std::unique_ptr<base::TickClock> tick_clock_;
// The result of the last network fetch.
base::Optional<DoodleConfig> cached_config_;
« no previous file with comments | « chrome/browser/doodle/doodle_service_factory.cc ('k') | components/doodle/doodle_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698