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_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/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 | 70 |
71 bool WritePickleFile(base::Pickle* pickle, const base::FilePath& file_name) { | 71 bool WritePickleFile(base::Pickle* pickle, const base::FilePath& file_name) { |
72 File file( | 72 File file( |
73 file_name, | 73 file_name, |
74 File::FLAG_CREATE | File::FLAG_WRITE | File::FLAG_SHARE_DELETE); | 74 File::FLAG_CREATE | File::FLAG_WRITE | File::FLAG_SHARE_DELETE); |
75 if (!file.IsValid()) | 75 if (!file.IsValid()) |
76 return false; | 76 return false; |
77 | 77 |
78 int bytes_written = | 78 int bytes_written = |
79 file.Write(0, static_cast<const char*>(pickle->data()), pickle->size()); | 79 file.Write(0, static_cast<const char*>(pickle->data()), pickle->size()); |
80 if (bytes_written != implicit_cast<int>(pickle->size())) { | 80 if (bytes_written != static_cast<int>(pickle->size())) { |
vmpstr
2015/09/11 21:31:16
checked_cast?
danakj
2015/09/11 21:33:30
Yep
| |
81 simple_util::SimpleCacheDeleteFile(file_name); | 81 simple_util::SimpleCacheDeleteFile(file_name); |
82 return false; | 82 return false; |
83 } | 83 } |
84 return true; | 84 return true; |
85 } | 85 } |
86 | 86 |
87 // Called for each cache directory traversal iteration. | 87 // Called for each cache directory traversal iteration. |
88 void ProcessEntryFile(SimpleIndex::EntrySet* entries, | 88 void ProcessEntryFile(SimpleIndex::EntrySet* entries, |
89 const base::FilePath& file_path) { | 89 const base::FilePath& file_path) { |
90 static const size_t kEntryFilesLength = | 90 static const size_t kEntryFilesLength = |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
474 bool SimpleIndexFile::LegacyIsIndexFileStale( | 474 bool SimpleIndexFile::LegacyIsIndexFileStale( |
475 base::Time cache_last_modified, | 475 base::Time cache_last_modified, |
476 const base::FilePath& index_file_path) { | 476 const base::FilePath& index_file_path) { |
477 base::Time index_mtime; | 477 base::Time index_mtime; |
478 if (!simple_util::GetMTime(index_file_path, &index_mtime)) | 478 if (!simple_util::GetMTime(index_file_path, &index_mtime)) |
479 return true; | 479 return true; |
480 return index_mtime < cache_last_modified; | 480 return index_mtime < cache_last_modified; |
481 } | 481 } |
482 | 482 |
483 } // namespace disk_cache | 483 } // namespace disk_cache |
OLD | NEW |