Commit 3b37dadf authored by Jiewei Qian's avatar Jiewei Qian Committed by Commit Bot

system-web-apps: handle install_duration edge case of 0

A low resolution clock could result in an install_duration of 0. This
trips the DCHECK that |install_duration| is positive.

This CL changes to this DCHECK to test for non-negative, so it won't be
triggered when chrome is running with a low resolution clock.

Fixed: 1085403
Change-Id: I63bf90ee6d287e09e0cbb955568f2ae3c2ffa0f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2212237
Commit-Queue: Jiewei Qian  <qjw@chromium.org>
Reviewed-by: default avatarGiovanni Ortuño Urquidi <ortuno@chromium.org>
Cr-Commit-Position: refs/heads/master@{#771683}
parent b552e1a2
......@@ -543,8 +543,9 @@ const std::string& SystemWebAppManager::CurrentLocale() const {
void SystemWebAppManager::RecordSystemWebAppInstallMetrics(
const std::map<GURL, InstallResultCode>& install_results,
const base::TimeDelta& install_duration) const {
// Install duration should be positive.
DCHECK_GT(install_duration.InMicroseconds(), 0);
// Install duration should be non-negative. A low resolution clock could
// result in a |install_duration| of 0.
DCHECK_GE(install_duration.InMilliseconds(), 0);
// Record the time spent to install system web apps.
if (!shutting_down_) {
......
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