| OLD | NEW |
| 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 Loading... |
| 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 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 range.offset = offset; | 1600 range.offset = offset; |
| 1604 range.length = len; | 1601 range.length = len; |
| 1605 range.data_crc32 = data_crc32; | 1602 range.data_crc32 = data_crc32; |
| 1606 range.file_offset = data_file_offset; | 1603 range.file_offset = data_file_offset; |
| 1607 sparse_ranges_.insert(std::make_pair(offset, range)); | 1604 sparse_ranges_.insert(std::make_pair(offset, range)); |
| 1608 | 1605 |
| 1609 return true; | 1606 return true; |
| 1610 } | 1607 } |
| 1611 | 1608 |
| 1612 } // namespace disk_cache | 1609 } // namespace disk_cache |
| OLD | NEW |