OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/simple/simple_entry_impl.h" | 5 #include "net/disk_cache/simple/simple_entry_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstring> | 8 #include <cstring> |
9 #include <limits> | 9 #include <limits> |
10 #include <utility> | 10 #include <utility> |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 DCHECK(io_thread_checker_.CalledOnValidThread()); | 337 DCHECK(io_thread_checker_.CalledOnValidThread()); |
338 return last_modified_; | 338 return last_modified_; |
339 } | 339 } |
340 | 340 |
341 int32_t SimpleEntryImpl::GetDataSize(int stream_index) const { | 341 int32_t SimpleEntryImpl::GetDataSize(int stream_index) const { |
342 DCHECK(io_thread_checker_.CalledOnValidThread()); | 342 DCHECK(io_thread_checker_.CalledOnValidThread()); |
343 DCHECK_LE(0, data_size_[stream_index]); | 343 DCHECK_LE(0, data_size_[stream_index]); |
344 return data_size_[stream_index]; | 344 return data_size_[stream_index]; |
345 } | 345 } |
346 | 346 |
| 347 int64_t SimpleEntryImpl::GetEntrySize() const { |
| 348 return GetDiskUsage(); |
| 349 } |
| 350 |
347 int SimpleEntryImpl::ReadData(int stream_index, | 351 int SimpleEntryImpl::ReadData(int stream_index, |
348 int offset, | 352 int offset, |
349 net::IOBuffer* buf, | 353 net::IOBuffer* buf, |
350 int buf_len, | 354 int buf_len, |
351 const CompletionCallback& callback) { | 355 const CompletionCallback& callback) { |
352 DCHECK(io_thread_checker_.CalledOnValidThread()); | 356 DCHECK(io_thread_checker_.CalledOnValidThread()); |
353 | 357 |
354 if (net_log_.IsCapturing()) { | 358 if (net_log_.IsCapturing()) { |
355 net_log_.AddEvent(net::NetLogEventType::SIMPLE_CACHE_ENTRY_READ_CALL, | 359 net_log_.AddEvent(net::NetLogEventType::SIMPLE_CACHE_ENTRY_READ_CALL, |
356 CreateNetLogReadWriteDataCallback(stream_index, offset, | 360 CreateNetLogReadWriteDataCallback(stream_index, offset, |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1545 } | 1549 } |
1546 crc32s_end_offset_[stream_index] = offset + length; | 1550 crc32s_end_offset_[stream_index] = offset + length; |
1547 } else if (offset < crc32s_end_offset_[stream_index]) { | 1551 } else if (offset < crc32s_end_offset_[stream_index]) { |
1548 // If a range for which the crc32 was already computed is rewritten, the | 1552 // If a range for which the crc32 was already computed is rewritten, the |
1549 // computation of the crc32 need to start from 0 again. | 1553 // computation of the crc32 need to start from 0 again. |
1550 crc32s_end_offset_[stream_index] = 0; | 1554 crc32s_end_offset_[stream_index] = 0; |
1551 } | 1555 } |
1552 } | 1556 } |
1553 | 1557 |
1554 } // namespace disk_cache | 1558 } // namespace disk_cache |
OLD | NEW |