Commit edec205d authored by Ben Kelly's avatar Ben Kelly Committed by Commit Bot

CacheStorage: Relax index file timestamp DCHECK.

On some platforms the base path timestamp can be a few microseconds
different from the file contained in the directory.  Relax the DCHECK
to permit +/- 10 microseconds difference.

Bug: 1002892
Change-Id: Iebdc1685c5b3e48e674f938bd530a5247caef1e9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1847732Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Commit-Queue: Ben Kelly <wanderview@chromium.org>
Cr-Commit-Position: refs/heads/master@{#703830}
parent bda85822
...@@ -70,7 +70,11 @@ int64_t GetCacheStorageSize(const base::FilePath& base_path, ...@@ -70,7 +70,11 @@ int64_t GetCacheStorageSize(const base::FilePath& base_path,
// have a modified time older than the index's modified time. Modifying // have a modified time older than the index's modified time. Modifying
// the index should update the directories time as well. Therefore we // the index should update the directories time as well. Therefore we
// should be guaranteed that the time is equal here. // should be guaranteed that the time is equal here.
DCHECK_EQ(base_path_time, index_time); //
// In practice, though, there can be a few microseconds difference on
// some operating systems so we can't do an exact DCHECK here. Instead
// we do a fuzzy DCHECK allowing some microseconds difference.
DCHECK_LE((index_time - base_path_time).magnitude().InMicroseconds(), 10);
int64_t storage_size = 0; int64_t storage_size = 0;
for (int i = 0, max = index.cache_size(); i < max; ++i) { for (int i = 0, max = index.cache_size(); i < max; ++i) {
......
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