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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 return data_size_[stream_index]; | 339 return data_size_[stream_index]; |
340 } | 340 } |
341 | 341 |
342 int SimpleEntryImpl::ReadData(int stream_index, | 342 int SimpleEntryImpl::ReadData(int stream_index, |
343 int offset, | 343 int offset, |
344 net::IOBuffer* buf, | 344 net::IOBuffer* buf, |
345 int buf_len, | 345 int buf_len, |
346 const CompletionCallback& callback) { | 346 const CompletionCallback& callback) { |
347 DCHECK(io_thread_checker_.CalledOnValidThread()); | 347 DCHECK(io_thread_checker_.CalledOnValidThread()); |
348 | 348 |
349 if (net_log_.GetCaptureMode().enabled()) { | 349 if (net_log_.IsCapturing()) { |
350 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_CALL, | 350 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_CALL, |
351 CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len, | 351 CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len, |
352 false)); | 352 false)); |
353 } | 353 } |
354 | 354 |
355 if (stream_index < 0 || stream_index >= kSimpleEntryStreamCount || | 355 if (stream_index < 0 || stream_index >= kSimpleEntryStreamCount || |
356 buf_len < 0) { | 356 buf_len < 0) { |
357 if (net_log_.GetCaptureMode().enabled()) { | 357 if (net_log_.IsCapturing()) { |
358 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END, | 358 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END, |
359 CreateNetLogReadWriteCompleteCallback(net::ERR_INVALID_ARGUMENT)); | 359 CreateNetLogReadWriteCompleteCallback(net::ERR_INVALID_ARGUMENT)); |
360 } | 360 } |
361 | 361 |
362 RecordReadResult(cache_type_, READ_RESULT_INVALID_ARGUMENT); | 362 RecordReadResult(cache_type_, READ_RESULT_INVALID_ARGUMENT); |
363 return net::ERR_INVALID_ARGUMENT; | 363 return net::ERR_INVALID_ARGUMENT; |
364 } | 364 } |
365 if (pending_operations_.empty() && (offset >= GetDataSize(stream_index) || | 365 if (pending_operations_.empty() && (offset >= GetDataSize(stream_index) || |
366 offset < 0 || !buf_len)) { | 366 offset < 0 || !buf_len)) { |
367 if (net_log_.GetCaptureMode().enabled()) { | 367 if (net_log_.IsCapturing()) { |
368 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END, | 368 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END, |
369 CreateNetLogReadWriteCompleteCallback(0)); | 369 CreateNetLogReadWriteCompleteCallback(0)); |
370 } | 370 } |
371 | 371 |
372 RecordReadResult(cache_type_, READ_RESULT_NONBLOCK_EMPTY_RETURN); | 372 RecordReadResult(cache_type_, READ_RESULT_NONBLOCK_EMPTY_RETURN); |
373 return 0; | 373 return 0; |
374 } | 374 } |
375 | 375 |
376 // TODO(clamy): return immediatly when reading from stream 0. | 376 // TODO(clamy): return immediatly when reading from stream 0. |
377 | 377 |
378 // TODO(felipeg): Optimization: Add support for truly parallel read | 378 // TODO(felipeg): Optimization: Add support for truly parallel read |
379 // operations. | 379 // operations. |
380 bool alone_in_queue = | 380 bool alone_in_queue = |
381 pending_operations_.size() == 0 && state_ == STATE_READY; | 381 pending_operations_.size() == 0 && state_ == STATE_READY; |
382 pending_operations_.push(SimpleEntryOperation::ReadOperation( | 382 pending_operations_.push(SimpleEntryOperation::ReadOperation( |
383 this, stream_index, offset, buf_len, buf, callback, alone_in_queue)); | 383 this, stream_index, offset, buf_len, buf, callback, alone_in_queue)); |
384 RunNextOperationIfNeeded(); | 384 RunNextOperationIfNeeded(); |
385 return net::ERR_IO_PENDING; | 385 return net::ERR_IO_PENDING; |
386 } | 386 } |
387 | 387 |
388 int SimpleEntryImpl::WriteData(int stream_index, | 388 int SimpleEntryImpl::WriteData(int stream_index, |
389 int offset, | 389 int offset, |
390 net::IOBuffer* buf, | 390 net::IOBuffer* buf, |
391 int buf_len, | 391 int buf_len, |
392 const CompletionCallback& callback, | 392 const CompletionCallback& callback, |
393 bool truncate) { | 393 bool truncate) { |
394 DCHECK(io_thread_checker_.CalledOnValidThread()); | 394 DCHECK(io_thread_checker_.CalledOnValidThread()); |
395 | 395 |
396 if (net_log_.GetCaptureMode().enabled()) { | 396 if (net_log_.IsCapturing()) { |
397 net_log_.AddEvent( | 397 net_log_.AddEvent( |
398 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_CALL, | 398 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_CALL, |
399 CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len, | 399 CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len, |
400 truncate)); | 400 truncate)); |
401 } | 401 } |
402 | 402 |
403 if (stream_index < 0 || stream_index >= kSimpleEntryStreamCount || | 403 if (stream_index < 0 || stream_index >= kSimpleEntryStreamCount || |
404 offset < 0 || buf_len < 0) { | 404 offset < 0 || buf_len < 0) { |
405 if (net_log_.GetCaptureMode().enabled()) { | 405 if (net_log_.IsCapturing()) { |
406 net_log_.AddEvent( | 406 net_log_.AddEvent( |
407 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END, | 407 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END, |
408 CreateNetLogReadWriteCompleteCallback(net::ERR_INVALID_ARGUMENT)); | 408 CreateNetLogReadWriteCompleteCallback(net::ERR_INVALID_ARGUMENT)); |
409 } | 409 } |
410 RecordWriteResult(cache_type_, WRITE_RESULT_INVALID_ARGUMENT); | 410 RecordWriteResult(cache_type_, WRITE_RESULT_INVALID_ARGUMENT); |
411 return net::ERR_INVALID_ARGUMENT; | 411 return net::ERR_INVALID_ARGUMENT; |
412 } | 412 } |
413 if (backend_.get() && offset + buf_len > backend_->GetMaxFileSize()) { | 413 if (backend_.get() && offset + buf_len > backend_->GetMaxFileSize()) { |
414 if (net_log_.GetCaptureMode().enabled()) { | 414 if (net_log_.IsCapturing()) { |
415 net_log_.AddEvent( | 415 net_log_.AddEvent( |
416 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END, | 416 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END, |
417 CreateNetLogReadWriteCompleteCallback(net::ERR_FAILED)); | 417 CreateNetLogReadWriteCompleteCallback(net::ERR_FAILED)); |
418 } | 418 } |
419 RecordWriteResult(cache_type_, WRITE_RESULT_OVER_MAX_SIZE); | 419 RecordWriteResult(cache_type_, WRITE_RESULT_OVER_MAX_SIZE); |
420 return net::ERR_FAILED; | 420 return net::ERR_FAILED; |
421 } | 421 } |
422 ScopedOperationRunner operation_runner(this); | 422 ScopedOperationRunner operation_runner(this); |
423 | 423 |
424 // Stream 0 data is kept in memory, so can be written immediatly if there are | 424 // Stream 0 data is kept in memory, so can be written immediatly if there are |
(...skipping 21 matching lines...) Expand all Loading... |
446 } else { | 446 } else { |
447 // TODO(gavinp,pasko): For performance, don't use a copy of an IOBuffer | 447 // TODO(gavinp,pasko): For performance, don't use a copy of an IOBuffer |
448 // here to avoid paying the price of the RefCountedThreadSafe atomic | 448 // here to avoid paying the price of the RefCountedThreadSafe atomic |
449 // operations. | 449 // operations. |
450 if (buf) { | 450 if (buf) { |
451 op_buf = new IOBuffer(buf_len); | 451 op_buf = new IOBuffer(buf_len); |
452 memcpy(op_buf->data(), buf->data(), buf_len); | 452 memcpy(op_buf->data(), buf->data(), buf_len); |
453 } | 453 } |
454 op_callback = CompletionCallback(); | 454 op_callback = CompletionCallback(); |
455 ret_value = buf_len; | 455 ret_value = buf_len; |
456 if (net_log_.GetCaptureMode().enabled()) { | 456 if (net_log_.IsCapturing()) { |
457 net_log_.AddEvent( | 457 net_log_.AddEvent( |
458 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_OPTIMISTIC, | 458 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_OPTIMISTIC, |
459 CreateNetLogReadWriteCompleteCallback(buf_len)); | 459 CreateNetLogReadWriteCompleteCallback(buf_len)); |
460 } | 460 } |
461 } | 461 } |
462 | 462 |
463 pending_operations_.push(SimpleEntryOperation::WriteOperation(this, | 463 pending_operations_.push(SimpleEntryOperation::WriteOperation(this, |
464 stream_index, | 464 stream_index, |
465 offset, | 465 offset, |
466 buf_len, | 466 buf_len, |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 } | 801 } |
802 | 802 |
803 void SimpleEntryImpl::ReadDataInternal(int stream_index, | 803 void SimpleEntryImpl::ReadDataInternal(int stream_index, |
804 int offset, | 804 int offset, |
805 net::IOBuffer* buf, | 805 net::IOBuffer* buf, |
806 int buf_len, | 806 int buf_len, |
807 const CompletionCallback& callback) { | 807 const CompletionCallback& callback) { |
808 DCHECK(io_thread_checker_.CalledOnValidThread()); | 808 DCHECK(io_thread_checker_.CalledOnValidThread()); |
809 ScopedOperationRunner operation_runner(this); | 809 ScopedOperationRunner operation_runner(this); |
810 | 810 |
811 if (net_log_.GetCaptureMode().enabled()) { | 811 if (net_log_.IsCapturing()) { |
812 net_log_.AddEvent( | 812 net_log_.AddEvent( |
813 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_BEGIN, | 813 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_BEGIN, |
814 CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len, | 814 CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len, |
815 false)); | 815 false)); |
816 } | 816 } |
817 | 817 |
818 if (state_ == STATE_FAILURE || state_ == STATE_UNINITIALIZED) { | 818 if (state_ == STATE_FAILURE || state_ == STATE_UNINITIALIZED) { |
819 if (!callback.is_null()) { | 819 if (!callback.is_null()) { |
820 RecordReadResult(cache_type_, READ_RESULT_BAD_STATE); | 820 RecordReadResult(cache_type_, READ_RESULT_BAD_STATE); |
821 // Note that the API states that client-provided callbacks for entry-level | 821 // Note that the API states that client-provided callbacks for entry-level |
822 // (i.e. non-backend) operations (e.g. read, write) are invoked even if | 822 // (i.e. non-backend) operations (e.g. read, write) are invoked even if |
823 // the backend was already destroyed. | 823 // the backend was already destroyed. |
824 base::ThreadTaskRunnerHandle::Get()->PostTask( | 824 base::ThreadTaskRunnerHandle::Get()->PostTask( |
825 FROM_HERE, base::Bind(callback, net::ERR_FAILED)); | 825 FROM_HERE, base::Bind(callback, net::ERR_FAILED)); |
826 } | 826 } |
827 if (net_log_.GetCaptureMode().enabled()) { | 827 if (net_log_.IsCapturing()) { |
828 net_log_.AddEvent( | 828 net_log_.AddEvent( |
829 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END, | 829 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END, |
830 CreateNetLogReadWriteCompleteCallback(net::ERR_FAILED)); | 830 CreateNetLogReadWriteCompleteCallback(net::ERR_FAILED)); |
831 } | 831 } |
832 return; | 832 return; |
833 } | 833 } |
834 DCHECK_EQ(STATE_READY, state_); | 834 DCHECK_EQ(STATE_READY, state_); |
835 if (offset >= GetDataSize(stream_index) || offset < 0 || !buf_len) { | 835 if (offset >= GetDataSize(stream_index) || offset < 0 || !buf_len) { |
836 RecordReadResult(cache_type_, READ_RESULT_FAST_EMPTY_RETURN); | 836 RecordReadResult(cache_type_, READ_RESULT_FAST_EMPTY_RETURN); |
837 // If there is nothing to read, we bail out before setting state_ to | 837 // If there is nothing to read, we bail out before setting state_ to |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
884 | 884 |
885 void SimpleEntryImpl::WriteDataInternal(int stream_index, | 885 void SimpleEntryImpl::WriteDataInternal(int stream_index, |
886 int offset, | 886 int offset, |
887 net::IOBuffer* buf, | 887 net::IOBuffer* buf, |
888 int buf_len, | 888 int buf_len, |
889 const CompletionCallback& callback, | 889 const CompletionCallback& callback, |
890 bool truncate) { | 890 bool truncate) { |
891 DCHECK(io_thread_checker_.CalledOnValidThread()); | 891 DCHECK(io_thread_checker_.CalledOnValidThread()); |
892 ScopedOperationRunner operation_runner(this); | 892 ScopedOperationRunner operation_runner(this); |
893 | 893 |
894 if (net_log_.GetCaptureMode().enabled()) { | 894 if (net_log_.IsCapturing()) { |
895 net_log_.AddEvent( | 895 net_log_.AddEvent( |
896 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_BEGIN, | 896 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_BEGIN, |
897 CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len, | 897 CreateNetLogReadWriteDataCallback(stream_index, offset, buf_len, |
898 truncate)); | 898 truncate)); |
899 } | 899 } |
900 | 900 |
901 if (state_ == STATE_FAILURE || state_ == STATE_UNINITIALIZED) { | 901 if (state_ == STATE_FAILURE || state_ == STATE_UNINITIALIZED) { |
902 RecordWriteResult(cache_type_, WRITE_RESULT_BAD_STATE); | 902 RecordWriteResult(cache_type_, WRITE_RESULT_BAD_STATE); |
903 if (net_log_.GetCaptureMode().enabled()) { | 903 if (net_log_.IsCapturing()) { |
904 net_log_.AddEvent( | 904 net_log_.AddEvent( |
905 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END, | 905 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END, |
906 CreateNetLogReadWriteCompleteCallback(net::ERR_FAILED)); | 906 CreateNetLogReadWriteCompleteCallback(net::ERR_FAILED)); |
907 } | 907 } |
908 if (!callback.is_null()) { | 908 if (!callback.is_null()) { |
909 base::ThreadTaskRunnerHandle::Get()->PostTask( | 909 base::ThreadTaskRunnerHandle::Get()->PostTask( |
910 FROM_HERE, base::Bind(callback, net::ERR_FAILED)); | 910 FROM_HERE, base::Bind(callback, net::ERR_FAILED)); |
911 } | 911 } |
912 // |this| may be destroyed after return here. | 912 // |this| may be destroyed after return here. |
913 return; | 913 return; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1222 | 1222 |
1223 if (*result < 0) { | 1223 if (*result < 0) { |
1224 RecordReadResult(cache_type_, READ_RESULT_SYNC_READ_FAILURE); | 1224 RecordReadResult(cache_type_, READ_RESULT_SYNC_READ_FAILURE); |
1225 } else { | 1225 } else { |
1226 RecordReadResult(cache_type_, READ_RESULT_SUCCESS); | 1226 RecordReadResult(cache_type_, READ_RESULT_SUCCESS); |
1227 if (crc_check_state_[stream_index] == CRC_CHECK_NEVER_READ_TO_END && | 1227 if (crc_check_state_[stream_index] == CRC_CHECK_NEVER_READ_TO_END && |
1228 offset + *result == GetDataSize(stream_index)) { | 1228 offset + *result == GetDataSize(stream_index)) { |
1229 crc_check_state_[stream_index] = CRC_CHECK_NOT_DONE; | 1229 crc_check_state_[stream_index] = CRC_CHECK_NOT_DONE; |
1230 } | 1230 } |
1231 } | 1231 } |
1232 if (net_log_.GetCaptureMode().enabled()) { | 1232 if (net_log_.IsCapturing()) { |
1233 net_log_.AddEvent( | 1233 net_log_.AddEvent( |
1234 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END, | 1234 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END, |
1235 CreateNetLogReadWriteCompleteCallback(*result)); | 1235 CreateNetLogReadWriteCompleteCallback(*result)); |
1236 } | 1236 } |
1237 | 1237 |
1238 EntryOperationComplete(completion_callback, *entry_stat, result.Pass()); | 1238 EntryOperationComplete(completion_callback, *entry_stat, result.Pass()); |
1239 } | 1239 } |
1240 | 1240 |
1241 void SimpleEntryImpl::WriteOperationComplete( | 1241 void SimpleEntryImpl::WriteOperationComplete( |
1242 int stream_index, | 1242 int stream_index, |
1243 const CompletionCallback& completion_callback, | 1243 const CompletionCallback& completion_callback, |
1244 scoped_ptr<SimpleEntryStat> entry_stat, | 1244 scoped_ptr<SimpleEntryStat> entry_stat, |
1245 scoped_ptr<int> result) { | 1245 scoped_ptr<int> result) { |
1246 if (*result >= 0) | 1246 if (*result >= 0) |
1247 RecordWriteResult(cache_type_, WRITE_RESULT_SUCCESS); | 1247 RecordWriteResult(cache_type_, WRITE_RESULT_SUCCESS); |
1248 else | 1248 else |
1249 RecordWriteResult(cache_type_, WRITE_RESULT_SYNC_WRITE_FAILURE); | 1249 RecordWriteResult(cache_type_, WRITE_RESULT_SYNC_WRITE_FAILURE); |
1250 if (net_log_.GetCaptureMode().enabled()) { | 1250 if (net_log_.IsCapturing()) { |
1251 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END, | 1251 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_WRITE_END, |
1252 CreateNetLogReadWriteCompleteCallback(*result)); | 1252 CreateNetLogReadWriteCompleteCallback(*result)); |
1253 } | 1253 } |
1254 | 1254 |
1255 if (*result < 0) { | 1255 if (*result < 0) { |
1256 crc32s_end_offset_[stream_index] = 0; | 1256 crc32s_end_offset_[stream_index] = 0; |
1257 } | 1257 } |
1258 | 1258 |
1259 EntryOperationComplete(completion_callback, *entry_stat, result.Pass()); | 1259 EntryOperationComplete(completion_callback, *entry_stat, result.Pass()); |
1260 } | 1260 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 void SimpleEntryImpl::ChecksumOperationComplete( | 1311 void SimpleEntryImpl::ChecksumOperationComplete( |
1312 int orig_result, | 1312 int orig_result, |
1313 int stream_index, | 1313 int stream_index, |
1314 const CompletionCallback& completion_callback, | 1314 const CompletionCallback& completion_callback, |
1315 scoped_ptr<int> result) { | 1315 scoped_ptr<int> result) { |
1316 DCHECK(io_thread_checker_.CalledOnValidThread()); | 1316 DCHECK(io_thread_checker_.CalledOnValidThread()); |
1317 DCHECK(synchronous_entry_); | 1317 DCHECK(synchronous_entry_); |
1318 DCHECK_EQ(STATE_IO_PENDING, state_); | 1318 DCHECK_EQ(STATE_IO_PENDING, state_); |
1319 DCHECK(result); | 1319 DCHECK(result); |
1320 | 1320 |
1321 if (net_log_.GetCaptureMode().enabled()) { | 1321 if (net_log_.IsCapturing()) { |
1322 net_log_.AddEventWithNetErrorCode( | 1322 net_log_.AddEventWithNetErrorCode( |
1323 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_CHECKSUM_END, | 1323 net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_CHECKSUM_END, |
1324 *result); | 1324 *result); |
1325 } | 1325 } |
1326 | 1326 |
1327 if (*result == net::OK) { | 1327 if (*result == net::OK) { |
1328 *result = orig_result; | 1328 *result = orig_result; |
1329 if (orig_result >= 0) | 1329 if (orig_result >= 0) |
1330 RecordReadResult(cache_type_, READ_RESULT_SUCCESS); | 1330 RecordReadResult(cache_type_, READ_RESULT_SUCCESS); |
1331 else | 1331 else |
1332 RecordReadResult(cache_type_, READ_RESULT_SYNC_READ_FAILURE); | 1332 RecordReadResult(cache_type_, READ_RESULT_SYNC_READ_FAILURE); |
1333 } else { | 1333 } else { |
1334 RecordReadResult(cache_type_, READ_RESULT_SYNC_CHECKSUM_FAILURE); | 1334 RecordReadResult(cache_type_, READ_RESULT_SYNC_CHECKSUM_FAILURE); |
1335 } | 1335 } |
1336 if (net_log_.GetCaptureMode().enabled()) { | 1336 if (net_log_.IsCapturing()) { |
1337 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END, | 1337 net_log_.AddEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY_READ_END, |
1338 CreateNetLogReadWriteCompleteCallback(*result)); | 1338 CreateNetLogReadWriteCompleteCallback(*result)); |
1339 } | 1339 } |
1340 | 1340 |
1341 SimpleEntryStat entry_stat(last_used_, last_modified_, data_size_, | 1341 SimpleEntryStat entry_stat(last_used_, last_modified_, data_size_, |
1342 sparse_data_size_); | 1342 sparse_data_size_); |
1343 EntryOperationComplete(completion_callback, entry_stat, result.Pass()); | 1343 EntryOperationComplete(completion_callback, entry_stat, result.Pass()); |
1344 } | 1344 } |
1345 | 1345 |
1346 void SimpleEntryImpl::CloseOperationComplete() { | 1346 void SimpleEntryImpl::CloseOperationComplete() { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 } | 1523 } |
1524 crc32s_end_offset_[stream_index] = offset + length; | 1524 crc32s_end_offset_[stream_index] = offset + length; |
1525 } else if (offset < crc32s_end_offset_[stream_index]) { | 1525 } else if (offset < crc32s_end_offset_[stream_index]) { |
1526 // If a range for which the crc32 was already computed is rewritten, the | 1526 // If a range for which the crc32 was already computed is rewritten, the |
1527 // computation of the crc32 need to start from 0 again. | 1527 // computation of the crc32 need to start from 0 again. |
1528 crc32s_end_offset_[stream_index] = 0; | 1528 crc32s_end_offset_[stream_index] = 0; |
1529 } | 1529 } |
1530 } | 1530 } |
1531 | 1531 |
1532 } // namespace disk_cache | 1532 } // namespace disk_cache |
OLD | NEW |