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

Issue 2452123003: Make the site engagement service more robust to clock changes and time inconsistencies. (Closed)

Created:
4 years, 1 month ago by dominickn
Modified:
4 years, 1 month ago
Reviewers:
CC:
chromium-reviews
Target Ref:
refs/pending/branch-heads/2883
Project:
chromium
Visibility:
Public.

Description

Make the site engagement service more robust to clock changes and time inconsistencies. This CL adjusts the site engagement service's logic for rebasing last engagement times when no engagement has been earned for some time. This code was prone to errors when users changed their clocks, where last engagement times could be moved into the future or into the past based on a clock change. This has only recently become an issue because the rebasing codepath now triggers if no engagement is earned for ~9 hours, as opposed to three weeks. The code was also brittle if the overall last engagement time (a lossy pref) became out of sync with any single engagement score's last engagement time (a lossy content setting). It is theoretically possible that the content setting would be written to prefs, but the overall last engagement time would not due to the prefs system buffering the lossy write and then failing to complete it before browser shutdown. This CL changes the rebase logic to also sanely handle unexpected times caused by changing clocks or pref writing race conditions. Time rebasing now occurs when the last engagement time is detected to be in the future as well as in the past. Regression tests are added to ensure the correct behaviour. BUG=654560 Review-Url: https://chromiumcodereview.appspot.com/2427343002 Cr-Commit-Position: refs/heads/master@{#426696} (cherry picked from commit ed64b2a6aaeb060283ca5583abc1583a879b1ce1) Committed: https://chromium.googlesource.com/chromium/src/+/932ce7acd24d0b4b2f1fd2eb17be6fe5594962cb

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+161 lines, -20 lines) Patch
M chrome/browser/engagement/site_engagement_service.h View 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/engagement/site_engagement_service.cc View 3 chunks +44 lines, -20 lines 0 comments Download
M chrome/browser/engagement/site_engagement_service_unittest.cc View 1 chunk +113 lines, -0 lines 0 comments Download

Messages

Total messages: 2 (1 generated)
dominickn
4 years, 1 month ago (2016-10-27 00:08:54 UTC) #2
Message was sent while issue was closed.
Committed patchset #1 (id:1) manually as
932ce7acd24d0b4b2f1fd2eb17be6fe5594962cb.

Powered by Google App Engine
This is Rietveld 408576698