| 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_v3.h" | 5 #include "net/disk_cache/blockfile/entry_impl_v3.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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 // backend is disabled. | 482 // backend is disabled. |
| 483 if (!key_.empty()) | 483 if (!key_.empty()) |
| 484 return key_; | 484 return key_; |
| 485 | 485 |
| 486 Addr address(entry->Data()->long_key); | 486 Addr address(entry->Data()->long_key); |
| 487 DCHECK(address.is_initialized()); | 487 DCHECK(address.is_initialized()); |
| 488 size_t offset = 0; | 488 size_t offset = 0; |
| 489 if (address.is_block_file()) | 489 if (address.is_block_file()) |
| 490 offset = address.start_block() * address.BlockSize() + kBlockHeaderSize; | 490 offset = address.start_block() * address.BlockSize() + kBlockHeaderSize; |
| 491 | 491 |
| 492 COMPILE_ASSERT(kNumStreams == kKeyFileIndex, invalid_key_index); | 492 static_assert(kNumStreams == kKeyFileIndex, "invalid key index"); |
| 493 File* key_file = const_cast<EntryImpl*>(this)->GetBackingFile(address, | 493 File* key_file = const_cast<EntryImpl*>(this)->GetBackingFile(address, |
| 494 kKeyFileIndex); | 494 kKeyFileIndex); |
| 495 if (!key_file) | 495 if (!key_file) |
| 496 return std::string(); | 496 return std::string(); |
| 497 | 497 |
| 498 ++key_len; // We store a trailing \0 on disk that we read back below. | 498 ++key_len; // We store a trailing \0 on disk that we read back below. |
| 499 if (!offset && key_file->GetLength() != static_cast<size_t>(key_len)) | 499 if (!offset && key_file->GetLength() != static_cast<size_t>(key_len)) |
| 500 return std::string(); | 500 return std::string(); |
| 501 | 501 |
| 502 if (!key_file->Read(WriteInto(&key_, key_len), key_len, offset)) | 502 if (!key_file->Read(WriteInto(&key_, key_len), key_len, offset)) |
| (...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 | 1455 |
| 1456 int EntryImplV3::ReadyForSparseIO(const CompletionCallback& callback) { | 1456 int EntryImplV3::ReadyForSparseIO(const CompletionCallback& callback) { |
| 1457 return net::ERR_FAILED; | 1457 return net::ERR_FAILED; |
| 1458 } | 1458 } |
| 1459 | 1459 |
| 1460 EntryImplV3::~EntryImplV3() { | 1460 EntryImplV3::~EntryImplV3() { |
| 1461 NOTIMPLEMENTED(); | 1461 NOTIMPLEMENTED(); |
| 1462 } | 1462 } |
| 1463 | 1463 |
| 1464 } // namespace disk_cache | 1464 } // namespace disk_cache |
| OLD | NEW |