Commit a78d2074 authored by Becca Hughes's avatar Becca Hughes Committed by Commit Bot

[Media Engagement] Remove histogram

Remove the ScoreAtStartup histogram as it was causing
jank and we were not using it.

BUG=900679

Change-Id: I004743c48425c9bb3fbbed67004c7616ef290cf9
Reviewed-on: https://chromium-review.googlesource.com/c/1330211
Commit-Queue: Becca Hughes <beccahughes@chromium.org>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Reviewed-by: default avatarBrian White <bcwhite@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607751}
parent a86fa542
...@@ -23,9 +23,6 @@ ...@@ -23,9 +23,6 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "media/base/media_switches.h" #include "media/base/media_switches.h"
const char MediaEngagementService::kHistogramScoreAtStartupName[] =
"Media.Engagement.ScoreAtStartup";
const char MediaEngagementService::kHistogramURLsDeletedScoreReductionName[] = const char MediaEngagementService::kHistogramURLsDeletedScoreReductionName[] =
"Media.Engagement.URLsDeletedScoreReduction"; "Media.Engagement.URLsDeletedScoreReduction";
...@@ -142,18 +139,9 @@ MediaEngagementService::MediaEngagementService(Profile* profile, ...@@ -142,18 +139,9 @@ MediaEngagementService::MediaEngagementService(Profile* profile,
->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_MEDIA_ENGAGEMENT); ->ClearSettingsForOneType(CONTENT_SETTINGS_TYPE_MEDIA_ENGAGEMENT);
SetSchemaVersion(kSchemaVersion); SetSchemaVersion(kSchemaVersion);
} }
// Record the stored scores to a histogram.
task_tracker_.PostTask(
base::ThreadTaskRunnerHandle::Get().get(), FROM_HERE,
base::BindOnce(&MediaEngagementService::RecordStoredScoresToHistogram,
base::Unretained(this)));
} }
MediaEngagementService::~MediaEngagementService() { MediaEngagementService::~MediaEngagementService() = default;
// Cancel any tasks that depend on |this|.
task_tracker_.TryCancelAll();
}
int MediaEngagementService::GetSchemaVersion() const { int MediaEngagementService::GetSchemaVersion() const {
return profile_->GetPrefs()->GetInteger(prefs::kMediaEngagementSchemaVersion); return profile_->GetPrefs()->GetInteger(prefs::kMediaEngagementSchemaVersion);
...@@ -187,14 +175,6 @@ void MediaEngagementService::Shutdown() { ...@@ -187,14 +175,6 @@ void MediaEngagementService::Shutdown() {
history->RemoveObserver(this); history->RemoveObserver(this);
} }
void MediaEngagementService::RecordStoredScoresToHistogram() {
for (const MediaEngagementScore& score : GetAllStoredScores()) {
int percentage = round(score.actual_score() * 100);
UMA_HISTOGRAM_PERCENTAGE(
MediaEngagementService::kHistogramScoreAtStartupName, percentage);
}
}
void MediaEngagementService::OnURLsDeleted( void MediaEngagementService::OnURLsDeleted(
history::HistoryService* history_service, history::HistoryService* history_service,
const history::DeletionInfo& deletion_info) { const history::DeletionInfo& deletion_info) {
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <set> #include <set>
#include "base/macros.h" #include "base/macros.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/media/media_engagement_score.h" #include "chrome/browser/media/media_engagement_score.h"
#include "chrome/browser/media/media_engagement_score_details.mojom.h" #include "chrome/browser/media/media_engagement_score_details.mojom.h"
...@@ -89,9 +88,6 @@ class MediaEngagementService : public KeyedService, ...@@ -89,9 +88,6 @@ class MediaEngagementService : public KeyedService,
Profile* profile() const; Profile* profile() const;
// The name of the histogram that scores are logged to on startup.
static const char kHistogramScoreAtStartupName[];
// The name of the histogram that records the reduction in score when history // The name of the histogram that records the reduction in score when history
// is cleared. // is cleared.
static const char kHistogramURLsDeletedScoreReductionName[]; static const char kHistogramURLsDeletedScoreReductionName[];
...@@ -126,9 +122,6 @@ class MediaEngagementService : public KeyedService, ...@@ -126,9 +122,6 @@ class MediaEngagementService : public KeyedService,
// An internal clock for testing. // An internal clock for testing.
base::Clock* clock_; base::Clock* clock_;
// Records all the stored scores to a histogram.
void RecordStoredScoresToHistogram();
std::vector<MediaEngagementScore> GetAllStoredScores() const; std::vector<MediaEngagementScore> GetAllStoredScores() const;
int GetSchemaVersion() const; int GetSchemaVersion() const;
...@@ -141,9 +134,6 @@ class MediaEngagementService : public KeyedService, ...@@ -141,9 +134,6 @@ class MediaEngagementService : public KeyedService,
const std::set<GURL>& deleted_origins, const std::set<GURL>& deleted_origins,
const history::OriginCountAndLastVisitMap& origin_data); const history::OriginCountAndLastVisitMap& origin_data);
// Allows us to cancel the RecordScoresToHistogram task if we are destroyed.
base::CancelableTaskTracker task_tracker_;
DISALLOW_COPY_AND_ASSIGN(MediaEngagementService); DISALLOW_COPY_AND_ASSIGN(MediaEngagementService);
}; };
......
...@@ -817,35 +817,6 @@ TEST_F(MediaEngagementServiceTest, CleanupDataOnSiteDataCleanup_NoTimeSet) { ...@@ -817,35 +817,6 @@ TEST_F(MediaEngagementServiceTest, CleanupDataOnSiteDataCleanup_NoTimeSet) {
MediaEngagementService::kHistogramClearName, 1, 1); MediaEngagementService::kHistogramClearName, 1, 1);
} }
TEST_F(MediaEngagementServiceTest, LogScoresOnStartupToHistogram) {
GURL url1("https://www.google.com");
GURL url2("https://www.google.co.uk");
GURL url3("https://www.example.com");
SetScores(url1, 24, 20);
SetScores(url2, 24, 12);
RecordVisitAndPlaybackAndAdvanceClock(url3);
ExpectScores(url1, 5.0 / 6.0, 24, 20, TimeNotSet());
ExpectScores(url2, 0.5, 24, 12, TimeNotSet());
ExpectScores(url3, 0.05, 1, 1, Now());
base::HistogramTester histogram_tester;
std::unique_ptr<MediaEngagementService> new_service =
base::WrapUnique<MediaEngagementService>(
StartNewMediaEngagementService());
new_service->Shutdown();
histogram_tester.ExpectTotalCount(
MediaEngagementService::kHistogramScoreAtStartupName, 3);
histogram_tester.ExpectBucketCount(
MediaEngagementService::kHistogramScoreAtStartupName, 5, 1);
histogram_tester.ExpectBucketCount(
MediaEngagementService::kHistogramScoreAtStartupName, 50, 1);
histogram_tester.ExpectBucketCount(
MediaEngagementService::kHistogramScoreAtStartupName, 83, 1);
}
TEST_F(MediaEngagementServiceTest, CleanupDataOnSiteDataCleanup_All) { TEST_F(MediaEngagementServiceTest, CleanupDataOnSiteDataCleanup_All) {
GURL origin1("https://www.google.com"); GURL origin1("https://www.google.com");
GURL origin2("https://www.google.co.uk"); GURL origin2("https://www.google.co.uk");
......
...@@ -45371,6 +45371,9 @@ uploading your change for review. ...@@ -45371,6 +45371,9 @@ uploading your change for review.
</histogram> </histogram>
<histogram name="Media.Engagement.ScoreAtStartup" units="%"> <histogram name="Media.Engagement.ScoreAtStartup" units="%">
<obsolete>
Deprecated 11/2018 in Issue 900679 as we are no longer using this.
</obsolete>
<owner>beccahughes@chromium.org</owner> <owner>beccahughes@chromium.org</owner>
<owner>media-dev@chromium.org</owner> <owner>media-dev@chromium.org</owner>
<summary> <summary>
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