| 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_backend_impl.h" | 5 #include "net/disk_cache/simple/simple_backend_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstdlib> | 8 #include <cstdlib> |
| 9 #include <functional> | 9 #include <functional> |
| 10 | 10 |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 } | 288 } |
| 289 | 289 |
| 290 void SimpleBackendImpl::OnDoomComplete(uint64_t entry_hash) { | 290 void SimpleBackendImpl::OnDoomComplete(uint64_t entry_hash) { |
| 291 DCHECK_EQ(1u, entries_pending_doom_.count(entry_hash)); | 291 DCHECK_EQ(1u, entries_pending_doom_.count(entry_hash)); |
| 292 base::hash_map<uint64_t, std::vector<Closure>>::iterator it = | 292 base::hash_map<uint64_t, std::vector<Closure>>::iterator it = |
| 293 entries_pending_doom_.find(entry_hash); | 293 entries_pending_doom_.find(entry_hash); |
| 294 std::vector<Closure> to_run_closures; | 294 std::vector<Closure> to_run_closures; |
| 295 to_run_closures.swap(it->second); | 295 to_run_closures.swap(it->second); |
| 296 entries_pending_doom_.erase(it); | 296 entries_pending_doom_.erase(it); |
| 297 | 297 |
| 298 std::for_each(to_run_closures.begin(), to_run_closures.end(), | 298 for (auto& closure : to_run_closures) |
| 299 std::mem_fun_ref(&Closure::Run)); | 299 closure.Run(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 void SimpleBackendImpl::DoomEntries(std::vector<uint64_t>* entry_hashes, | 302 void SimpleBackendImpl::DoomEntries(std::vector<uint64_t>* entry_hashes, |
| 303 const net::CompletionCallback& callback) { | 303 const net::CompletionCallback& callback) { |
| 304 scoped_ptr<std::vector<uint64_t>> mass_doom_entry_hashes( | 304 scoped_ptr<std::vector<uint64_t>> mass_doom_entry_hashes( |
| 305 new std::vector<uint64_t>()); | 305 new std::vector<uint64_t>()); |
| 306 mass_doom_entry_hashes->swap(*entry_hashes); | 306 mass_doom_entry_hashes->swap(*entry_hashes); |
| 307 | 307 |
| 308 std::vector<uint64_t> to_doom_individually_hashes; | 308 std::vector<uint64_t> to_doom_individually_hashes; |
| 309 | 309 |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 } | 746 } |
| 747 | 747 |
| 748 // static | 748 // static |
| 749 void SimpleBackendImpl::FlushWorkerPoolForTesting() { | 749 void SimpleBackendImpl::FlushWorkerPoolForTesting() { |
| 750 // We only need to do this if we there is an active task runner. | 750 // We only need to do this if we there is an active task runner. |
| 751 if (base::ThreadTaskRunnerHandle::IsSet()) | 751 if (base::ThreadTaskRunnerHandle::IsSet()) |
| 752 g_sequenced_worker_pool.Get().FlushForTesting(); | 752 g_sequenced_worker_pool.Get().FlushForTesting(); |
| 753 } | 753 } |
| 754 | 754 |
| 755 } // namespace disk_cache | 755 } // namespace disk_cache |
| OLD | NEW |