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

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

Issue 105293002: Move more file_util functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/entry_unittest.cc ('k') | net/disk_cache/simple/simple_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_index_file.h" 5 #include "net/disk_cache/simple/simple_index_file.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/memory_mapped_file.h" 10 #include "base/files/memory_mapped_file.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 const base::StringPiece hash_string( 89 const base::StringPiece hash_string(
90 file_name.begin(), file_name.begin() + kEntryFilesHashLength); 90 file_name.begin(), file_name.begin() + kEntryFilesHashLength);
91 uint64 hash_key = 0; 91 uint64 hash_key = 0;
92 if (!simple_util::GetEntryHashKeyFromHexString(hash_string, &hash_key)) { 92 if (!simple_util::GetEntryHashKeyFromHexString(hash_string, &hash_key)) {
93 LOG(WARNING) << "Invalid entry hash key filename while restoring index from" 93 LOG(WARNING) << "Invalid entry hash key filename while restoring index from"
94 << " disk: " << file_name; 94 << " disk: " << file_name;
95 return; 95 return;
96 } 96 }
97 97
98 base::PlatformFileInfo file_info; 98 base::PlatformFileInfo file_info;
99 if (!file_util::GetFileInfo(file_path, &file_info)) { 99 if (!base::GetFileInfo(file_path, &file_info)) {
100 LOG(ERROR) << "Could not get file info for " << file_path.value(); 100 LOG(ERROR) << "Could not get file info for " << file_path.value();
101 return; 101 return;
102 } 102 }
103 base::Time last_used_time; 103 base::Time last_used_time;
104 #if defined(OS_POSIX) 104 #if defined(OS_POSIX)
105 // For POSIX systems, a last access time is available. However, it's not 105 // For POSIX systems, a last access time is available. However, it's not
106 // guaranteed to be more accurate than mtime. It is no worse though. 106 // guaranteed to be more accurate than mtime. It is no worse though.
107 last_used_time = file_info.last_accessed; 107 last_used_time = file_info.last_accessed;
108 #endif 108 #endif
109 if (last_used_time.is_null()) 109 if (last_used_time.is_null())
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 bool SimpleIndexFile::LegacyIsIndexFileStale( 455 bool SimpleIndexFile::LegacyIsIndexFileStale(
456 base::Time cache_last_modified, 456 base::Time cache_last_modified,
457 const base::FilePath& index_file_path) { 457 const base::FilePath& index_file_path) {
458 base::Time index_mtime; 458 base::Time index_mtime;
459 if (!simple_util::GetMTime(index_file_path, &index_mtime)) 459 if (!simple_util::GetMTime(index_file_path, &index_mtime))
460 return true; 460 return true;
461 return index_mtime < cache_last_modified; 461 return index_mtime < cache_last_modified;
462 } 462 }
463 463
464 } // namespace disk_cache 464 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/entry_unittest.cc ('k') | net/disk_cache/simple/simple_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698