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_index.h" | 5 #include "net/disk_cache/simple/simple_index.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 (*it)->second.SetEntrySize(entry_size); | 394 (*it)->second.SetEntrySize(entry_size); |
395 } | 395 } |
396 | 396 |
397 void SimpleIndex::MergeInitializingSet( | 397 void SimpleIndex::MergeInitializingSet( |
398 scoped_ptr<SimpleIndexLoadResult> load_result) { | 398 scoped_ptr<SimpleIndexLoadResult> load_result) { |
399 DCHECK(io_thread_checker_.CalledOnValidThread()); | 399 DCHECK(io_thread_checker_.CalledOnValidThread()); |
400 DCHECK(load_result->did_load); | 400 DCHECK(load_result->did_load); |
401 | 401 |
402 EntrySet* index_file_entries = &load_result->entries; | 402 EntrySet* index_file_entries = &load_result->entries; |
403 | 403 |
404 for (std::unordered_set<uint64_t>::const_iterator it = | 404 for (base::hash_set<uint64_t>::const_iterator it = removed_entries_.begin(); |
405 removed_entries_.begin(); | |
406 it != removed_entries_.end(); ++it) { | 405 it != removed_entries_.end(); ++it) { |
407 index_file_entries->erase(*it); | 406 index_file_entries->erase(*it); |
408 } | 407 } |
409 removed_entries_.clear(); | 408 removed_entries_.clear(); |
410 | 409 |
411 for (EntrySet::const_iterator it = entries_set_.begin(); | 410 for (EntrySet::const_iterator it = entries_set_.begin(); |
412 it != entries_set_.end(); ++it) { | 411 it != entries_set_.end(); ++it) { |
413 const uint64_t entry_hash = it->first; | 412 const uint64_t entry_hash = it->first; |
414 std::pair<EntrySet::iterator, bool> insert_result = | 413 std::pair<EntrySet::iterator, bool> insert_result = |
415 index_file_entries->insert(EntrySet::value_type(entry_hash, | 414 index_file_entries->insert(EntrySet::value_type(entry_hash, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 start - last_write_to_disk_); | 479 start - last_write_to_disk_); |
481 } | 480 } |
482 } | 481 } |
483 last_write_to_disk_ = start; | 482 last_write_to_disk_ = start; |
484 | 483 |
485 index_file_->WriteToDisk(entries_set_, cache_size_, | 484 index_file_->WriteToDisk(entries_set_, cache_size_, |
486 start, app_on_background_, base::Closure()); | 485 start, app_on_background_, base::Closure()); |
487 } | 486 } |
488 | 487 |
489 } // namespace disk_cache | 488 } // namespace disk_cache |
OLD | NEW |