| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/mem_entry_impl.h" | 5 #include "net/disk_cache/mem_entry_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/disk_cache/mem_backend_impl.h" | 10 #include "net/disk_cache/mem_backend_impl.h" |
| 11 | 11 |
| 12 using base::Time; | 12 using base::Time; |
| 13 | 13 |
| 14 namespace disk_cache { | 14 namespace disk_cache { |
| 15 | 15 |
| 16 MemEntryImpl::MemEntryImpl(MemBackendImpl* backend) { | 16 MemEntryImpl::MemEntryImpl(MemBackendImpl* backend) { |
| 17 doomed_ = false; | 17 doomed_ = false; |
| 18 backend_ = backend; | 18 backend_ = backend; |
| 19 ref_count_ = 0; | 19 ref_count_ = 0; |
| 20 next_ = NULL; |
| 21 prev_ = NULL; |
| 20 for (int i = 0; i < NUM_STREAMS; i++) | 22 for (int i = 0; i < NUM_STREAMS; i++) |
| 21 data_size_[i] = 0; | 23 data_size_[i] = 0; |
| 22 } | 24 } |
| 23 | 25 |
| 24 MemEntryImpl::~MemEntryImpl() { | 26 MemEntryImpl::~MemEntryImpl() { |
| 25 for (int i = 0; i < NUM_STREAMS; i++) | 27 for (int i = 0; i < NUM_STREAMS; i++) |
| 26 backend_->ModifyStorageSize(data_size_[i], 0); | 28 backend_->ModifyStorageSize(data_size_[i], 0); |
| 27 backend_->ModifyStorageSize(static_cast<int32>(key_.size()), 0); | 29 backend_->ModifyStorageSize(static_cast<int32>(key_.size()), 0); |
| 28 } | 30 } |
| 29 | 31 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 last_used_ = current; | 172 last_used_ = current; |
| 171 | 173 |
| 172 if (modified) | 174 if (modified) |
| 173 last_modified_ = current; | 175 last_modified_ = current; |
| 174 | 176 |
| 175 if (!doomed_) | 177 if (!doomed_) |
| 176 backend_->UpdateRank(this); | 178 backend_->UpdateRank(this); |
| 177 } | 179 } |
| 178 | 180 |
| 179 } // namespace disk_cache | 181 } // namespace disk_cache |
| OLD | NEW |