| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Adds a new cache entry corresponding to |resource_id| if it doesn't | 59 // Adds a new cache entry corresponding to |resource_id| if it doesn't |
| 60 // exist, otherwise update the existing entry. | 60 // exist, otherwise update the existing entry. |
| 61 virtual void AddOrUpdateCacheEntry(const std::string& resource_id, | 61 virtual void AddOrUpdateCacheEntry(const std::string& resource_id, |
| 62 const FileCacheEntry& cache_entry) = 0; | 62 const FileCacheEntry& cache_entry) = 0; |
| 63 | 63 |
| 64 // Removes entry corresponding to |resource_id| from cache map. | 64 // Removes entry corresponding to |resource_id| from cache map. |
| 65 virtual void RemoveCacheEntry(const std::string& resource_id) = 0; | 65 virtual void RemoveCacheEntry(const std::string& resource_id) = 0; |
| 66 | 66 |
| 67 // Gets the cache entry for file corresponding to |resource_id| and |md5| | 67 // Gets the cache entry for file corresponding to |resource_id| and |md5| |
| 68 // and returns true if entry exists in cache map. Otherwise, returns false. | 68 // and returns true if entry exists in cache map. Otherwise, returns false. |
| 69 // |md5| can be empty if only matching |resource_id| is desired, which may | 69 // |md5| can be empty if only matching |resource_id| is desired. |
| 70 // happen when looking for pinned entries where symlinks' filenames have no | |
| 71 // extension and hence no md5. | |
| 72 virtual bool GetCacheEntry(const std::string& resource_id, | 70 virtual bool GetCacheEntry(const std::string& resource_id, |
| 73 const std::string& md5, | 71 const std::string& md5, |
| 74 FileCacheEntry* entry) = 0; | 72 FileCacheEntry* entry) = 0; |
| 75 | 73 |
| 76 // Removes temporary files (files in CACHE_TYPE_TMP) from the cache map. | 74 // Removes temporary files (files in CACHE_TYPE_TMP) from the cache map. |
| 77 virtual void RemoveTemporaryFiles() = 0; | 75 virtual void RemoveTemporaryFiles() = 0; |
| 78 | 76 |
| 79 // Iterates over all the cache entries synchronously. |callback| is called | 77 // Iterates over all the cache entries synchronously. |callback| is called |
| 80 // on each cache entry. | 78 // on each cache entry. |
| 81 virtual void Iterate(const CacheIterateCallback& callback) = 0; | 79 virtual void Iterate(const CacheIterateCallback& callback) = 0; |
| 82 | 80 |
| 83 protected: | 81 protected: |
| 84 explicit FileCacheMetadata(base::SequencedTaskRunner* blocking_task_runner); | 82 explicit FileCacheMetadata(base::SequencedTaskRunner* blocking_task_runner); |
| 85 | 83 |
| 86 // Checks whether the current thread is on the right sequenced worker pool | 84 // Checks whether the current thread is on the right sequenced worker pool |
| 87 // with the right sequence ID. If not, DCHECK will fail. | 85 // with the right sequence ID. If not, DCHECK will fail. |
| 88 void AssertOnSequencedWorkerPool(); | 86 void AssertOnSequencedWorkerPool(); |
| 89 | 87 |
| 90 private: | 88 private: |
| 91 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 89 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 92 | 90 |
| 93 DISALLOW_COPY_AND_ASSIGN(FileCacheMetadata); | 91 DISALLOW_COPY_AND_ASSIGN(FileCacheMetadata); |
| 94 }; | 92 }; |
| 95 | 93 |
| 96 } // namespace internal | 94 } // namespace internal |
| 97 } // namespace drive | 95 } // namespace drive |
| 98 | 96 |
| 99 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_METADATA_H_ | 97 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_METADATA_H_ |
| OLD | NEW |