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 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_METADATA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_METADATA_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_METADATA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_METADATA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // Removes entry corresponding to |resource_id| from cache map. | 81 // Removes entry corresponding to |resource_id| from cache map. |
82 void RemoveCacheEntry(const std::string& resource_id); | 82 void RemoveCacheEntry(const std::string& resource_id); |
83 | 83 |
84 // Gets the cache entry for file corresponding to |resource_id| and |md5| | 84 // Gets the cache entry for file corresponding to |resource_id| and |md5| |
85 // and returns true if entry exists in cache map. Otherwise, returns false. | 85 // and returns true if entry exists in cache map. Otherwise, returns false. |
86 // |md5| can be empty if only matching |resource_id| is desired. | 86 // |md5| can be empty if only matching |resource_id| is desired. |
87 bool GetCacheEntry(const std::string& resource_id, | 87 bool GetCacheEntry(const std::string& resource_id, |
88 const std::string& md5, | 88 const std::string& md5, |
89 FileCacheEntry* entry); | 89 FileCacheEntry* entry); |
90 | 90 |
91 // Removes temporary files (files in CACHE_TYPE_TMP) from the cache map. | |
92 void RemoveTemporaryFiles(); | |
93 | |
94 // Returns an object to iterate over entries. | 91 // Returns an object to iterate over entries. |
95 scoped_ptr<Iterator> GetIterator(); | 92 scoped_ptr<Iterator> GetIterator(); |
96 | 93 |
97 private: | 94 private: |
98 // Checks whether the current thread is on the right sequenced worker pool | 95 // Checks whether the current thread is on the right sequenced worker pool |
99 // with the right sequence ID. If not, DCHECK will fail. | 96 // with the right sequence ID. If not, DCHECK will fail. |
100 void AssertOnSequencedWorkerPool(); | 97 void AssertOnSequencedWorkerPool(); |
101 | 98 |
102 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 99 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
103 scoped_ptr<leveldb::DB> level_db_; | 100 scoped_ptr<leveldb::DB> level_db_; |
104 | 101 |
105 DISALLOW_COPY_AND_ASSIGN(FileCacheMetadata); | 102 DISALLOW_COPY_AND_ASSIGN(FileCacheMetadata); |
106 }; | 103 }; |
107 | 104 |
108 } // namespace internal | 105 } // namespace internal |
109 } // namespace drive | 106 } // namespace drive |
110 | 107 |
111 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_METADATA_H_ | 108 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_METADATA_H_ |
OLD | NEW |