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 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 int64 sparse_offset, | 1015 int64 sparse_offset, |
1016 net::IOBuffer* buf, | 1016 net::IOBuffer* buf, |
1017 int buf_len, | 1017 int buf_len, |
1018 const CompletionCallback& callback) { | 1018 const CompletionCallback& callback) { |
1019 DCHECK(io_thread_checker_.CalledOnValidThread()); | 1019 DCHECK(io_thread_checker_.CalledOnValidThread()); |
1020 ScopedOperationRunner operation_runner(this); | 1020 ScopedOperationRunner operation_runner(this); |
1021 | 1021 |
1022 DCHECK_EQ(STATE_READY, state_); | 1022 DCHECK_EQ(STATE_READY, state_); |
1023 state_ = STATE_IO_PENDING; | 1023 state_ = STATE_IO_PENDING; |
1024 | 1024 |
1025 int64 max_sparse_data_size = kint64max; | 1025 uint64 max_sparse_data_size = kint64max; |
1026 if (backend_.get()) { | 1026 if (backend_.get()) { |
1027 int64 max_cache_size = backend_->index()->max_size(); | 1027 uint64 max_cache_size = backend_->index()->max_size(); |
1028 max_sparse_data_size = max_cache_size / kMaxSparseDataSizeDivisor; | 1028 max_sparse_data_size = max_cache_size / kMaxSparseDataSizeDivisor; |
1029 } | 1029 } |
1030 | 1030 |
1031 scoped_ptr<SimpleEntryStat> entry_stat( | 1031 scoped_ptr<SimpleEntryStat> entry_stat( |
1032 new SimpleEntryStat(last_used_, last_modified_, data_size_, | 1032 new SimpleEntryStat(last_used_, last_modified_, data_size_, |
1033 sparse_data_size_)); | 1033 sparse_data_size_)); |
1034 | 1034 |
1035 last_used_ = last_modified_ = base::Time::Now(); | 1035 last_used_ = last_modified_ = base::Time::Now(); |
1036 | 1036 |
1037 scoped_ptr<int> result(new int()); | 1037 scoped_ptr<int> result(new int()); |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 } | 1524 } |
1525 crc32s_end_offset_[stream_index] = offset + length; | 1525 crc32s_end_offset_[stream_index] = offset + length; |
1526 } else if (offset < crc32s_end_offset_[stream_index]) { | 1526 } else if (offset < crc32s_end_offset_[stream_index]) { |
1527 // If a range for which the crc32 was already computed is rewritten, the | 1527 // If a range for which the crc32 was already computed is rewritten, the |
1528 // computation of the crc32 need to start from 0 again. | 1528 // computation of the crc32 need to start from 0 again. |
1529 crc32s_end_offset_[stream_index] = 0; | 1529 crc32s_end_offset_[stream_index] = 0; |
1530 } | 1530 } |
1531 } | 1531 } |
1532 | 1532 |
1533 } // namespace disk_cache | 1533 } // namespace disk_cache |
OLD | NEW |