| 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 "base/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
| 6 #include "base/hash.h" | 6 #include "base/hash.h" |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
| 10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 : SimpleIndexFile(NULL, base::FilePath()), | 46 : SimpleIndexFile(NULL, base::FilePath()), |
| 47 get_index_entries_calls_(0), | 47 get_index_entries_calls_(0), |
| 48 doom_entry_set_calls_(0), | 48 doom_entry_set_calls_(0), |
| 49 last_response_thread_(NULL), | 49 last_response_thread_(NULL), |
| 50 disk_writes_(0) {} | 50 disk_writes_(0) {} |
| 51 | 51 |
| 52 virtual void LoadIndexEntries( | 52 virtual void LoadIndexEntries( |
| 53 scoped_refptr<base::SingleThreadTaskRunner> response_thread, | 53 scoped_refptr<base::SingleThreadTaskRunner> response_thread, |
| 54 const SimpleIndexFile::IndexCompletionCallback& | 54 const SimpleIndexFile::IndexCompletionCallback& |
| 55 completion_callback) OVERRIDE { | 55 completion_callback) OVERRIDE { |
| 56 last_response_thread_ = response_thread; | 56 last_response_thread_ = response_thread.get(); |
| 57 completion_callback_ = completion_callback; | 57 completion_callback_ = completion_callback; |
| 58 ++get_index_entries_calls_; | 58 ++get_index_entries_calls_; |
| 59 } | 59 } |
| 60 | 60 |
| 61 virtual void WriteToDisk(const SimpleIndex::EntrySet& entry_set, | 61 virtual void WriteToDisk(const SimpleIndex::EntrySet& entry_set, |
| 62 uint64 cache_size, | 62 uint64 cache_size, |
| 63 const base::TimeTicks& start, | 63 const base::TimeTicks& start, |
| 64 bool app_on_background) OVERRIDE { | 64 bool app_on_background) OVERRIDE { |
| 65 disk_writes_++; | 65 disk_writes_++; |
| 66 disk_write_entry_set_ = entry_set; | 66 disk_write_entry_set_ = entry_set; |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 WaitForTimeChange(); | 566 WaitForTimeChange(); |
| 567 EXPECT_EQ(expected_trigger, index()->write_to_disk_timer_.desired_run_time()); | 567 EXPECT_EQ(expected_trigger, index()->write_to_disk_timer_.desired_run_time()); |
| 568 index()->Insert("key2"); | 568 index()->Insert("key2"); |
| 569 index()->UpdateEntrySize("key2", 40); | 569 index()->UpdateEntrySize("key2", 40); |
| 570 EXPECT_TRUE(index()->write_to_disk_timer_.IsRunning()); | 570 EXPECT_TRUE(index()->write_to_disk_timer_.IsRunning()); |
| 571 EXPECT_LT(expected_trigger,index()->write_to_disk_timer_.desired_run_time()); | 571 EXPECT_LT(expected_trigger,index()->write_to_disk_timer_.desired_run_time()); |
| 572 index()->write_to_disk_timer_.Stop(); | 572 index()->write_to_disk_timer_.Stop(); |
| 573 } | 573 } |
| 574 | 574 |
| 575 } // namespace disk_cache | 575 } // namespace disk_cache |
| OLD | NEW |