| 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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 } | 1419 } |
| 1413 | 1420 |
| 1414 Time EntryImplV3::GetLastModified() const { | 1421 Time EntryImplV3::GetLastModified() const { |
| 1415 return Time(); | 1422 return Time(); |
| 1416 } | 1423 } |
| 1417 | 1424 |
| 1418 int32 EntryImplV3::GetDataSize(int index) const { | 1425 int32 EntryImplV3::GetDataSize(int index) const { |
| 1419 return 0; | 1426 return 0; |
| 1420 } | 1427 } |
| 1421 | 1428 |
| 1429 int EntryImplV3::GetEntrySize() const { |
| 1430 return 0; |
| 1431 } |
| 1432 |
| 1422 int EntryImplV3::ReadData(int index, int offset, IOBuffer* buf, int buf_len, | 1433 int EntryImplV3::ReadData(int index, int offset, IOBuffer* buf, int buf_len, |
| 1423 const CompletionCallback& callback) { | 1434 const CompletionCallback& callback) { |
| 1424 return net::ERR_FAILED; | 1435 return net::ERR_FAILED; |
| 1425 } | 1436 } |
| 1426 | 1437 |
| 1427 int EntryImplV3::WriteData(int index, int offset, IOBuffer* buf, int buf_len, | 1438 int EntryImplV3::WriteData(int index, int offset, IOBuffer* buf, int buf_len, |
| 1428 const CompletionCallback& callback, bool truncate) { | 1439 const CompletionCallback& callback, bool truncate) { |
| 1429 return net::ERR_FAILED; | 1440 return net::ERR_FAILED; |
| 1430 } | 1441 } |
| 1431 | 1442 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1454 | 1465 |
| 1455 int EntryImplV3::ReadyForSparseIO(const CompletionCallback& callback) { | 1466 int EntryImplV3::ReadyForSparseIO(const CompletionCallback& callback) { |
| 1456 return net::ERR_FAILED; | 1467 return net::ERR_FAILED; |
| 1457 } | 1468 } |
| 1458 | 1469 |
| 1459 EntryImplV3::~EntryImplV3() { | 1470 EntryImplV3::~EntryImplV3() { |
| 1460 NOTIMPLEMENTED(); | 1471 NOTIMPLEMENTED(); |
| 1461 } | 1472 } |
| 1462 | 1473 |
| 1463 } // namespace disk_cache | 1474 } // namespace disk_cache |
| OLD | NEW |