| 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 if (user_flags_ & kNoRandom) { | 172 if (user_flags_ & kNoRandom) { |
| 173 // This is a unit test, so we want to be strict about not leaking entries | 173 // This is a unit test, so we want to be strict about not leaking entries |
| 174 // and completing all the work. | 174 // and completing all the work. |
| 175 background_queue_.WaitForPendingIO(); | 175 background_queue_.WaitForPendingIO(); |
| 176 } else { | 176 } else { |
| 177 // This is most likely not a test, so we want to do as little work as | 177 // This is most likely not a test, so we want to do as little work as |
| 178 // possible at this time, at the price of leaving dirty entries behind. | 178 // possible at this time, at the price of leaving dirty entries behind. |
| 179 background_queue_.DropPendingIO(); | 179 background_queue_.DropPendingIO(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 if (background_queue_.BackgroundIsCurrentThread()) { | 182 if (background_queue_.BackgroundIsCurrentSequence()) { |
| 183 // Unit tests may use the same thread for everything. | 183 // Unit tests may use the same sequence for everything. |
| 184 CleanupCache(); | 184 CleanupCache(); |
| 185 } else { | 185 } else { |
| 186 background_queue_.background_thread()->PostTask( | 186 background_queue_.background_thread()->PostTask( |
| 187 FROM_HERE, base::Bind(&FinalCleanupCallback, base::Unretained(this))); | 187 FROM_HERE, base::Bind(&FinalCleanupCallback, base::Unretained(this))); |
| 188 // http://crbug.com/74623 | 188 // http://crbug.com/74623 |
| 189 base::ThreadRestrictions::ScopedAllowWait allow_wait; | 189 base::ThreadRestrictions::ScopedAllowWait allow_wait; |
| 190 done_.Wait(); | 190 done_.Wait(); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| (...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2094 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2094 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
| 2095 total_memory = kMaxBuffersSize; | 2095 total_memory = kMaxBuffersSize; |
| 2096 | 2096 |
| 2097 done = true; | 2097 done = true; |
| 2098 } | 2098 } |
| 2099 | 2099 |
| 2100 return static_cast<int>(total_memory); | 2100 return static_cast<int>(total_memory); |
| 2101 } | 2101 } |
| 2102 | 2102 |
| 2103 } // namespace disk_cache | 2103 } // namespace disk_cache |
| OLD | NEW |