| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <functional> | 6 #include <functional> |
| 7 | 7 |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/hash.h" | 9 #include "base/hash.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 const base::Closure& callback, | 61 const base::Closure& callback, |
| 62 SimpleIndexLoadResult* out_load_result) override { | 62 SimpleIndexLoadResult* out_load_result) override { |
| 63 load_callback_ = callback; | 63 load_callback_ = callback; |
| 64 load_result_ = out_load_result; | 64 load_result_ = out_load_result; |
| 65 ++load_index_entries_calls_; | 65 ++load_index_entries_calls_; |
| 66 } | 66 } |
| 67 | 67 |
| 68 void WriteToDisk(const SimpleIndex::EntrySet& entry_set, | 68 void WriteToDisk(const SimpleIndex::EntrySet& entry_set, |
| 69 uint64 cache_size, | 69 uint64 cache_size, |
| 70 const base::TimeTicks& start, | 70 const base::TimeTicks& start, |
| 71 bool app_on_background) override { | 71 bool app_on_background, |
| 72 const base::Closure& callback) override { |
| 72 disk_writes_++; | 73 disk_writes_++; |
| 73 disk_write_entry_set_ = entry_set; | 74 disk_write_entry_set_ = entry_set; |
| 74 } | 75 } |
| 75 | 76 |
| 76 void GetAndResetDiskWriteEntrySet(SimpleIndex::EntrySet* entry_set) { | 77 void GetAndResetDiskWriteEntrySet(SimpleIndex::EntrySet* entry_set) { |
| 77 entry_set->swap(disk_write_entry_set_); | 78 entry_set->swap(disk_write_entry_set_); |
| 78 } | 79 } |
| 79 | 80 |
| 80 const base::Closure& load_callback() const { return load_callback_; } | 81 const base::Closure& load_callback() const { return load_callback_; } |
| 81 SimpleIndexLoadResult* load_result() const { return load_result_; } | 82 SimpleIndexLoadResult* load_result() const { return load_result_; } |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 WaitForTimeChange(); | 619 WaitForTimeChange(); |
| 619 EXPECT_EQ(expected_trigger, index()->write_to_disk_timer_.desired_run_time()); | 620 EXPECT_EQ(expected_trigger, index()->write_to_disk_timer_.desired_run_time()); |
| 620 index()->Insert(hashes_.at<2>()); | 621 index()->Insert(hashes_.at<2>()); |
| 621 index()->UpdateEntrySize(hashes_.at<2>(), 40); | 622 index()->UpdateEntrySize(hashes_.at<2>(), 40); |
| 622 EXPECT_TRUE(index()->write_to_disk_timer_.IsRunning()); | 623 EXPECT_TRUE(index()->write_to_disk_timer_.IsRunning()); |
| 623 EXPECT_LT(expected_trigger, index()->write_to_disk_timer_.desired_run_time()); | 624 EXPECT_LT(expected_trigger, index()->write_to_disk_timer_.desired_run_time()); |
| 624 index()->write_to_disk_timer_.Stop(); | 625 index()->write_to_disk_timer_.Stop(); |
| 625 } | 626 } |
| 626 | 627 |
| 627 } // namespace disk_cache | 628 } // namespace disk_cache |
| OLD | NEW |