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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 last_used_(Time::Now()), | 178 last_used_(Time::Now()), |
179 last_modified_(last_used_), | 179 last_modified_(last_used_), |
180 sparse_data_size_(0), | 180 sparse_data_size_(0), |
181 open_count_(0), | 181 open_count_(0), |
182 doomed_(false), | 182 doomed_(false), |
183 state_(STATE_UNINITIALIZED), | 183 state_(STATE_UNINITIALIZED), |
184 synchronous_entry_(NULL), | 184 synchronous_entry_(NULL), |
185 net_log_(net::BoundNetLog::Make( | 185 net_log_(net::BoundNetLog::Make( |
186 net_log, net::NetLog::SOURCE_DISK_CACHE_ENTRY)), | 186 net_log, net::NetLog::SOURCE_DISK_CACHE_ENTRY)), |
187 stream_0_data_(new net::GrowableIOBuffer()) { | 187 stream_0_data_(new net::GrowableIOBuffer()) { |
188 COMPILE_ASSERT(arraysize(data_size_) == arraysize(crc32s_end_offset_), | 188 static_assert(arraysize(data_size_) == arraysize(crc32s_end_offset_), |
189 arrays_should_be_same_size); | 189 "arrays should be the same size"); |
190 COMPILE_ASSERT(arraysize(data_size_) == arraysize(crc32s_), | 190 static_assert(arraysize(data_size_) == arraysize(crc32s_), |
191 arrays_should_be_same_size); | 191 "arrays should be the same size"); |
192 COMPILE_ASSERT(arraysize(data_size_) == arraysize(have_written_), | 192 static_assert(arraysize(data_size_) == arraysize(have_written_), |
193 arrays_should_be_same_size); | 193 "arrays should be the same size"); |
194 COMPILE_ASSERT(arraysize(data_size_) == arraysize(crc_check_state_), | 194 static_assert(arraysize(data_size_) == arraysize(crc_check_state_), |
195 arrays_should_be_same_size); | 195 "arrays should be the same size"); |
196 MakeUninitialized(); | 196 MakeUninitialized(); |
197 net_log_.BeginEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY, | 197 net_log_.BeginEvent(net::NetLog::TYPE_SIMPLE_CACHE_ENTRY, |
198 CreateNetLogSimpleEntryConstructionCallback(this)); | 198 CreateNetLogSimpleEntryConstructionCallback(this)); |
199 } | 199 } |
200 | 200 |
201 void SimpleEntryImpl::SetActiveEntryProxy( | 201 void SimpleEntryImpl::SetActiveEntryProxy( |
202 scoped_ptr<ActiveEntryProxy> active_entry_proxy) { | 202 scoped_ptr<ActiveEntryProxy> active_entry_proxy) { |
203 DCHECK(!active_entry_proxy_); | 203 DCHECK(!active_entry_proxy_); |
204 active_entry_proxy_.reset(active_entry_proxy.release()); | 204 active_entry_proxy_.reset(active_entry_proxy.release()); |
205 } | 205 } |
(...skipping 1318 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 |