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_util.h" | 5 #include "net/disk_cache/simple/simple_util.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return data_size + key.size() + sizeof(SimpleFileHeader) + | 78 return data_size + key.size() + sizeof(SimpleFileHeader) + |
79 sizeof(SimpleFileEOF); | 79 sizeof(SimpleFileEOF); |
80 } | 80 } |
81 | 81 |
82 int64 GetFileOffsetFromKeyAndDataOffset(const std::string& key, | 82 int64 GetFileOffsetFromKeyAndDataOffset(const std::string& key, |
83 int data_offset) { | 83 int data_offset) { |
84 const int64 headers_size = sizeof(disk_cache::SimpleFileHeader) + key.size(); | 84 const int64 headers_size = sizeof(disk_cache::SimpleFileHeader) + key.size(); |
85 return headers_size + data_offset; | 85 return headers_size + data_offset; |
86 } | 86 } |
87 | 87 |
88 // TODO(clamy, gavinp): this should go in base | 88 } // namespace simple_util |
89 bool GetMTime(const base::FilePath& path, base::Time* out_mtime) { | |
90 DCHECK(out_mtime); | |
91 base::PlatformFileInfo file_info; | |
92 if (!file_util::GetFileInfo(path, &file_info)) | |
93 return false; | |
94 *out_mtime = file_info.last_modified; | |
95 return true; | |
96 } | |
97 | |
98 } // namespace simple_backend | |
99 | 89 |
100 } // namespace disk_cache | 90 } // namespace disk_cache |
OLD | NEW |