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/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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 514 } |
515 | 515 |
516 int32 EntryImplV3::GetDataSize(int index) const { | 516 int32 EntryImplV3::GetDataSize(int index) const { |
517 if (index < 0 || index >= kNumStreams) | 517 if (index < 0 || index >= kNumStreams) |
518 return 0; | 518 return 0; |
519 | 519 |
520 CacheEntryBlock* entry = const_cast<CacheEntryBlock*>(&entry_); | 520 CacheEntryBlock* entry = const_cast<CacheEntryBlock*>(&entry_); |
521 return entry->Data()->data_size[index]; | 521 return entry->Data()->data_size[index]; |
522 } | 522 } |
523 | 523 |
| 524 int EntryImplV3::GetEntrySize() const { |
| 525 int result = 0; |
| 526 for (int i = 0; i < kNumStreams; ++i) |
| 527 result += GetDataSize(i); |
| 528 return result; |
| 529 } |
| 530 |
524 int EntryImplV3::ReadData(int index, int offset, IOBuffer* buf, int buf_len, | 531 int EntryImplV3::ReadData(int index, int offset, IOBuffer* buf, int buf_len, |
525 const CompletionCallback& callback) { | 532 const CompletionCallback& callback) { |
526 if (callback.is_null()) | 533 if (callback.is_null()) |
527 return ReadDataImpl(index, offset, buf, buf_len, callback); | 534 return ReadDataImpl(index, offset, buf, buf_len, callback); |
528 | 535 |
529 DCHECK(node_.Data()->dirty || read_only_); | 536 DCHECK(node_.Data()->dirty || read_only_); |
530 if (index < 0 || index >= kNumStreams) | 537 if (index < 0 || index >= kNumStreams) |
531 return net::ERR_INVALID_ARGUMENT; | 538 return net::ERR_INVALID_ARGUMENT; |
532 | 539 |
533 int entry_size = entry_.Data()->data_size[index]; | 540 int entry_size = entry_.Data()->data_size[index]; |
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 | 1461 |
1455 int EntryImplV3::ReadyForSparseIO(const CompletionCallback& callback) { | 1462 int EntryImplV3::ReadyForSparseIO(const CompletionCallback& callback) { |
1456 return net::ERR_FAILED; | 1463 return net::ERR_FAILED; |
1457 } | 1464 } |
1458 | 1465 |
1459 EntryImplV3::~EntryImplV3() { | 1466 EntryImplV3::~EntryImplV3() { |
1460 NOTIMPLEMENTED(); | 1467 NOTIMPLEMENTED(); |
1461 } | 1468 } |
1462 | 1469 |
1463 } // namespace disk_cache | 1470 } // namespace disk_cache |
OLD | NEW |