OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/blockfile/entry_impl.h" | 5 #include "net/disk_cache/blockfile/entry_impl.h" |
6 | 6 |
7 #include "base/hash.h" | 7 #include "base/hash.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 static_assert(kNumStreams == kKeyFileIndex, "invalid key index"); | 778 static_assert(kNumStreams == kKeyFileIndex, "invalid key index"); |
779 File* key_file = const_cast<EntryImpl*>(this)->GetBackingFile(address, | 779 File* key_file = const_cast<EntryImpl*>(this)->GetBackingFile(address, |
780 kKeyFileIndex); | 780 kKeyFileIndex); |
781 if (!key_file) | 781 if (!key_file) |
782 return std::string(); | 782 return std::string(); |
783 | 783 |
784 ++key_len; // We store a trailing \0 on disk that we read back below. | 784 ++key_len; // We store a trailing \0 on disk that we read back below. |
785 if (!offset && key_file->GetLength() != static_cast<size_t>(key_len)) | 785 if (!offset && key_file->GetLength() != static_cast<size_t>(key_len)) |
786 return std::string(); | 786 return std::string(); |
787 | 787 |
788 if (!key_file->Read(WriteInto(&key_, key_len), key_len, offset)) | 788 if (!key_file->Read(base::WriteInto(&key_, key_len), key_len, offset)) |
789 key_.clear(); | 789 key_.clear(); |
790 return key_; | 790 return key_; |
791 } | 791 } |
792 | 792 |
793 Time EntryImpl::GetLastUsed() const { | 793 Time EntryImpl::GetLastUsed() const { |
794 CacheRankingsBlock* node = const_cast<CacheRankingsBlock*>(&node_); | 794 CacheRankingsBlock* node = const_cast<CacheRankingsBlock*>(&node_); |
795 return Time::FromInternalValue(node->Data()->last_used); | 795 return Time::FromInternalValue(node->Data()->last_used); |
796 } | 796 } |
797 | 797 |
798 Time EntryImpl::GetLastModified() const { | 798 Time EntryImpl::GetLastModified() const { |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), | 1544 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), |
1545 entry_.address().value(), node_.address().value()); | 1545 entry_.address().value(), node_.address().value()); |
1546 | 1546 |
1547 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], | 1547 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], |
1548 entry_.Data()->data_addr[1], entry_.Data()->long_key); | 1548 entry_.Data()->data_addr[1], entry_.Data()->long_key); |
1549 | 1549 |
1550 Trace(" doomed: %d 0x%x", doomed_, dirty); | 1550 Trace(" doomed: %d 0x%x", doomed_, dirty); |
1551 } | 1551 } |
1552 | 1552 |
1553 } // namespace disk_cache | 1553 } // namespace disk_cache |
OLD | NEW |