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/backend_impl.h" | 5 #include "net/disk_cache/backend_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 303 |
304 if (init_) { | 304 if (init_) { |
305 StoreStats(); | 305 StoreStats(); |
306 if (data_) | 306 if (data_) |
307 data_->header.crash = 0; | 307 data_->header.crash = 0; |
308 | 308 |
309 if (user_flags_ & kNoRandom) { | 309 if (user_flags_ & kNoRandom) { |
310 // This is a net_unittest, verify that we are not 'leaking' entries. | 310 // This is a net_unittest, verify that we are not 'leaking' entries. |
311 File::WaitForPendingIO(&num_pending_io_); | 311 File::WaitForPendingIO(&num_pending_io_); |
312 DCHECK(!num_refs_); | 312 DCHECK(!num_refs_); |
| 313 } else { |
| 314 File::DropPendingIO(); |
313 } | 315 } |
314 } | 316 } |
315 block_files_.CloseFiles(); | 317 block_files_.CloseFiles(); |
316 FlushIndex(); | 318 FlushIndex(); |
317 index_ = NULL; | 319 index_ = NULL; |
318 ptr_factory_.InvalidateWeakPtrs(); | 320 ptr_factory_.InvalidateWeakPtrs(); |
319 done_.Signal(); | 321 done_.Signal(); |
320 } | 322 } |
321 | 323 |
322 // ------------------------------------------------------------------------ | 324 // ------------------------------------------------------------------------ |
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2089 if (total_memory > kMaxBuffersSize || total_memory <= 0) | 2091 if (total_memory > kMaxBuffersSize || total_memory <= 0) |
2090 total_memory = kMaxBuffersSize; | 2092 total_memory = kMaxBuffersSize; |
2091 | 2093 |
2092 done = true; | 2094 done = true; |
2093 } | 2095 } |
2094 | 2096 |
2095 return static_cast<int>(total_memory); | 2097 return static_cast<int>(total_memory); |
2096 } | 2098 } |
2097 | 2099 |
2098 } // namespace disk_cache | 2100 } // namespace disk_cache |
OLD | NEW |