| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/blockfile/backend_impl.h" | 5 #include "net/disk_cache/blockfile/backend_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 user_flags_(0), | 129 user_flags_(0), |
| 130 init_(false), | 130 init_(false), |
| 131 restarted_(false), | 131 restarted_(false), |
| 132 unit_test_(false), | 132 unit_test_(false), |
| 133 read_only_(false), | 133 read_only_(false), |
| 134 disabled_(false), | 134 disabled_(false), |
| 135 new_eviction_(false), | 135 new_eviction_(false), |
| 136 first_timer_(true), | 136 first_timer_(true), |
| 137 user_load_(false), | 137 user_load_(false), |
| 138 net_log_(net_log), | 138 net_log_(net_log), |
| 139 done_(true, false), | 139 done_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 140 ptr_factory_(this) { | 140 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 141 } | 141 ptr_factory_(this) {} |
| 142 | 142 |
| 143 BackendImpl::BackendImpl( | 143 BackendImpl::BackendImpl( |
| 144 const base::FilePath& path, | 144 const base::FilePath& path, |
| 145 uint32_t mask, | 145 uint32_t mask, |
| 146 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread, | 146 const scoped_refptr<base::SingleThreadTaskRunner>& cache_thread, |
| 147 net::NetLog* net_log) | 147 net::NetLog* net_log) |
| 148 : background_queue_(this, cache_thread), | 148 : background_queue_(this, cache_thread), |
| 149 path_(path), | 149 path_(path), |
| 150 block_files_(path), | 150 block_files_(path), |
| 151 mask_(mask), | 151 mask_(mask), |
| 152 max_size_(0), | 152 max_size_(0), |
| 153 up_ticks_(0), | 153 up_ticks_(0), |
| 154 cache_type_(net::DISK_CACHE), | 154 cache_type_(net::DISK_CACHE), |
| 155 uma_report_(0), | 155 uma_report_(0), |
| 156 user_flags_(kMask), | 156 user_flags_(kMask), |
| 157 init_(false), | 157 init_(false), |
| 158 restarted_(false), | 158 restarted_(false), |
| 159 unit_test_(false), | 159 unit_test_(false), |
| 160 read_only_(false), | 160 read_only_(false), |
| 161 disabled_(false), | 161 disabled_(false), |
| 162 new_eviction_(false), | 162 new_eviction_(false), |
| 163 first_timer_(true), | 163 first_timer_(true), |
| 164 user_load_(false), | 164 user_load_(false), |
| 165 net_log_(net_log), | 165 net_log_(net_log), |
| 166 done_(true, false), | 166 done_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 167 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 167 ptr_factory_(this) {} | 168 ptr_factory_(this) {} |
| 168 | 169 |
| 169 BackendImpl::~BackendImpl() { | 170 BackendImpl::~BackendImpl() { |
| 170 if (user_flags_ & kNoRandom) { | 171 if (user_flags_ & kNoRandom) { |
| 171 // This is a unit test, so we want to be strict about not leaking entries | 172 // This is a unit test, so we want to be strict about not leaking entries |
| 172 // and completing all the work. | 173 // and completing all the work. |
| 173 background_queue_.WaitForPendingIO(); | 174 background_queue_.WaitForPendingIO(); |
| 174 } else { | 175 } else { |
| 175 // This is most likely not a test, so we want to do as little work as | 176 // This is most likely not a test, so we want to do as little work as |
| 176 // possible at this time, at the price of leaving dirty entries behind. | 177 // possible at this time, at the price of leaving dirty entries behind. |
| (...skipping 1933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2110 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2111 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
| 2111 total_memory = kMaxBuffersSize; | 2112 total_memory = kMaxBuffersSize; |
| 2112 | 2113 |
| 2113 done = true; | 2114 done = true; |
| 2114 } | 2115 } |
| 2115 | 2116 |
| 2116 return static_cast<int>(total_memory); | 2117 return static_cast<int>(total_memory); |
| 2117 } | 2118 } |
| 2118 | 2119 |
| 2119 } // namespace disk_cache | 2120 } // namespace disk_cache |
| OLD | NEW |