| 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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 GetFilenameFromEntryHashAndIndex(entry_hash, i)); | 239 GetFilenameFromEntryHashAndIndex(entry_hash, i)); |
| 240 if (!base::DeleteFile(to_delete, false)) { | 240 if (!base::DeleteFile(to_delete, false)) { |
| 241 result = false; | 241 result = false; |
| 242 DLOG(ERROR) << "Could not delete " << to_delete.MaybeAsASCII(); | 242 DLOG(ERROR) << "Could not delete " << to_delete.MaybeAsASCII(); |
| 243 } | 243 } |
| 244 } | 244 } |
| 245 return result; | 245 return result; |
| 246 } | 246 } |
| 247 | 247 |
| 248 // static | 248 // static |
| 249 void SimpleSynchronousEntry::DoomEntry( | 249 int SimpleSynchronousEntry::DoomEntry( |
| 250 const FilePath& path, | 250 const FilePath& path, |
| 251 const std::string& key, | 251 const std::string& key, |
| 252 uint64 entry_hash, | 252 uint64 entry_hash) { |
| 253 int* out_result) { | |
| 254 DCHECK_EQ(entry_hash, GetEntryHashKey(key)); | 253 DCHECK_EQ(entry_hash, GetEntryHashKey(key)); |
| 255 bool deleted_well = DeleteFilesForEntryHash(path, entry_hash); | 254 const bool deleted_well = DeleteFilesForEntryHash(path, entry_hash); |
| 256 *out_result = deleted_well ? net::OK : net::ERR_FAILED; | 255 return deleted_well ? net::OK : net::ERR_FAILED; |
| 257 } | 256 } |
| 258 | 257 |
| 259 // static | 258 // static |
| 260 int SimpleSynchronousEntry::DoomEntrySet( | 259 int SimpleSynchronousEntry::DoomEntrySet( |
| 261 scoped_ptr<std::vector<uint64> > key_hashes, | 260 scoped_ptr<std::vector<uint64> > key_hashes, |
| 262 const FilePath& path) { | 261 const FilePath& path) { |
| 263 const size_t did_delete_count = std::count_if( | 262 const size_t did_delete_count = std::count_if( |
| 264 key_hashes->begin(), key_hashes->end(), std::bind1st( | 263 key_hashes->begin(), key_hashes->end(), std::bind1st( |
| 265 std::ptr_fun(SimpleSynchronousEntry::DeleteFilesForEntryHash), path)); | 264 std::ptr_fun(SimpleSynchronousEntry::DeleteFilesForEntryHash), path)); |
| 266 return (did_delete_count == key_hashes->size()) ? net::OK : net::ERR_FAILED; | 265 return (did_delete_count == key_hashes->size()) ? net::OK : net::ERR_FAILED; |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 initialized_ = true; | 630 initialized_ = true; |
| 632 return net::OK; | 631 return net::OK; |
| 633 } | 632 } |
| 634 | 633 |
| 635 void SimpleSynchronousEntry::Doom() const { | 634 void SimpleSynchronousEntry::Doom() const { |
| 636 // TODO(gavinp): Consider if we should guard against redundant Doom() calls. | 635 // TODO(gavinp): Consider if we should guard against redundant Doom() calls. |
| 637 DeleteFilesForEntryHash(path_, entry_hash_); | 636 DeleteFilesForEntryHash(path_, entry_hash_); |
| 638 } | 637 } |
| 639 | 638 |
| 640 } // namespace disk_cache | 639 } // namespace disk_cache |
| OLD | NEW |