OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/entry_impl.h" | 5 #include "net/disk_cache/entry_impl.h" |
6 | 6 |
7 #include "base/histogram.h" | 7 #include "base/histogram.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 return true; | 609 return true; |
610 } | 610 } |
611 | 611 |
612 void EntryImpl::DeleteData(Addr address, int index) { | 612 void EntryImpl::DeleteData(Addr address, int index) { |
613 if (!address.is_initialized()) | 613 if (!address.is_initialized()) |
614 return; | 614 return; |
615 if (address.is_separate_file()) { | 615 if (address.is_separate_file()) { |
616 if (files_[index]) | 616 if (files_[index]) |
617 files_[index] = NULL; // Releases the object. | 617 files_[index] = NULL; // Releases the object. |
618 | 618 |
619 if (!DeleteCacheFile(backend_->GetFileName(address))) { | 619 int failure = DeleteCacheFile(backend_->GetFileName(address)) ? 0 : 1; |
620 CACHE_UMA(COUNTS, "DeleteFailed", 0, 1); | 620 CACHE_UMA(COUNTS, "DeleteFailed", 0, failure); |
| 621 if (failure) |
621 LOG(ERROR) << "Failed to delete " << backend_->GetFileName(address) << | 622 LOG(ERROR) << "Failed to delete " << backend_->GetFileName(address) << |
622 " from the cache."; | 623 " from the cache."; |
623 } | |
624 } else { | 624 } else { |
625 backend_->DeleteBlock(address, true); | 625 backend_->DeleteBlock(address, true); |
626 } | 626 } |
627 } | 627 } |
628 | 628 |
629 void EntryImpl::UpdateRank(bool modified) { | 629 void EntryImpl::UpdateRank(bool modified) { |
630 if (!doomed_) { | 630 if (!doomed_) { |
631 // Everything is handled by the backend. | 631 // Everything is handled by the backend. |
632 backend_->UpdateRank(this, true); | 632 backend_->UpdateRank(this, true); |
633 return; | 633 return; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), | 902 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), |
903 entry_.address().value(), node_.address().value()); | 903 entry_.address().value(), node_.address().value()); |
904 | 904 |
905 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], | 905 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], |
906 entry_.Data()->data_addr[1], entry_.Data()->long_key); | 906 entry_.Data()->data_addr[1], entry_.Data()->long_key); |
907 | 907 |
908 Trace(" doomed: %d 0x%p 0x%x", doomed_, pointer, dirty); | 908 Trace(" doomed: %d 0x%p 0x%x", doomed_, pointer, dirty); |
909 } | 909 } |
910 | 910 |
911 } // namespace disk_cache | 911 } // namespace disk_cache |
OLD | NEW |