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