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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 178 |
179 // TODO(gavinp): Move this function to its correct location in this .cc file. | 179 // TODO(gavinp): Move this function to its correct location in this .cc file. |
180 // static | 180 // static |
181 bool SimpleSynchronousEntry::DeleteFilesForEntryHash( | 181 bool SimpleSynchronousEntry::DeleteFilesForEntryHash( |
182 const FilePath& path, | 182 const FilePath& path, |
183 const uint64 entry_hash) { | 183 const uint64 entry_hash) { |
184 bool result = true; | 184 bool result = true; |
185 for (int i = 0; i < kSimpleEntryFileCount; ++i) { | 185 for (int i = 0; i < kSimpleEntryFileCount; ++i) { |
186 FilePath to_delete = path.AppendASCII( | 186 FilePath to_delete = path.AppendASCII( |
187 GetFilenameFromEntryHashAndIndex(entry_hash, i)); | 187 GetFilenameFromEntryHashAndIndex(entry_hash, i)); |
188 if (!base::Delete(to_delete, false)) { | 188 if (!base::DeleteFile(to_delete, false)) { |
189 result = false; | 189 result = false; |
190 DLOG(ERROR) << "Could not delete " << to_delete.MaybeAsASCII(); | 190 DLOG(ERROR) << "Could not delete " << to_delete.MaybeAsASCII(); |
191 } | 191 } |
192 } | 192 } |
193 return result; | 193 return result; |
194 } | 194 } |
195 | 195 |
196 // static | 196 // static |
197 void SimpleSynchronousEntry::DoomEntry( | 197 void SimpleSynchronousEntry::DoomEntry( |
198 const FilePath& path, | 198 const FilePath& path, |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 initialized_ = true; | 548 initialized_ = true; |
549 return net::OK; | 549 return net::OK; |
550 } | 550 } |
551 | 551 |
552 void SimpleSynchronousEntry::Doom() { | 552 void SimpleSynchronousEntry::Doom() { |
553 // TODO(gavinp): Consider if we should guard against redundant Doom() calls. | 553 // TODO(gavinp): Consider if we should guard against redundant Doom() calls. |
554 DeleteFilesForEntryHash(path_, entry_hash_); | 554 DeleteFilesForEntryHash(path_, entry_hash_); |
555 } | 555 } |
556 | 556 |
557 } // namespace disk_cache | 557 } // namespace disk_cache |
OLD | NEW |