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

Side by Side Diff: net/disk_cache/simple/simple_synchronous_entry.cc

Issue 2791493003: Fix incorrect computation of LastModified in SimpleCache, (Closed)
Patch Set: Deflake on Windows, by: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/disk_cache/simple/simple_synchronous_entry.h" 5 #include "net/disk_cache/simple/simple_synchronous_entry.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstring> 8 #include <cstring>
9 #include <functional> 9 #include <functional>
10 #include <limits> 10 #include <limits>
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 } 879 }
880 880
881 File::Info file_info; 881 File::Info file_info;
882 bool success = files_[i].GetInfo(&file_info); 882 bool success = files_[i].GetInfo(&file_info);
883 base::Time file_last_modified; 883 base::Time file_last_modified;
884 if (!success) { 884 if (!success) {
885 DLOG(WARNING) << "Could not get platform file info."; 885 DLOG(WARNING) << "Could not get platform file info.";
886 continue; 886 continue;
887 } 887 }
888 out_entry_stat->set_last_used(file_info.last_accessed); 888 out_entry_stat->set_last_used(file_info.last_accessed);
889 if (simple_util::GetMTime(path_, &file_last_modified)) 889 out_entry_stat->set_last_modified(file_info.last_modified);
890 out_entry_stat->set_last_modified(file_last_modified);
891 else
892 out_entry_stat->set_last_modified(file_info.last_modified);
893 890
894 base::TimeDelta stream_age = 891 base::TimeDelta stream_age =
895 base::Time::Now() - out_entry_stat->last_modified(); 892 base::Time::Now() - out_entry_stat->last_modified();
896 if (stream_age < entry_age) 893 if (stream_age < entry_age)
897 entry_age = stream_age; 894 entry_age = stream_age;
898 895
899 // Two things prevent from knowing the right values for |data_size|: 896 // Two things prevent from knowing the right values for |data_size|:
900 // 1) The key is not known, hence its length is unknown. 897 // 1) The key is not known, hence its length is unknown.
901 // 2) Stream 0 and stream 1 are in the same file, and the exact size for 898 // 2) Stream 0 and stream 1 are in the same file, and the exact size for
902 // each will only be known when reading the EOF record for stream 0. 899 // each will only be known when reading the EOF record for stream 0.
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
1592 range.offset = offset; 1589 range.offset = offset;
1593 range.length = len; 1590 range.length = len;
1594 range.data_crc32 = data_crc32; 1591 range.data_crc32 = data_crc32;
1595 range.file_offset = data_file_offset; 1592 range.file_offset = data_file_offset;
1596 sparse_ranges_.insert(std::make_pair(offset, range)); 1593 sparse_ranges_.insert(std::make_pair(offset, range));
1597 1594
1598 return true; 1595 return true;
1599 } 1596 }
1600 1597
1601 } // namespace disk_cache 1598 } // namespace disk_cache
OLDNEW
« net/disk_cache/backend_unittest.cc ('K') | « net/disk_cache/backend_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698