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_GDATA_GDATA_CACHE_METADATA_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_METADATA_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_METADATA_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_METADATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 22 matching lines...) Expand all Loading... |
33 // the default value of SequenceToken. | 33 // the default value of SequenceToken. |
34 GDataCacheMetadata( | 34 GDataCacheMetadata( |
35 base::SequencedWorkerPool* pool, | 35 base::SequencedWorkerPool* pool, |
36 const base::SequencedWorkerPool::SequenceToken& sequence_token); | 36 const base::SequencedWorkerPool::SequenceToken& sequence_token); |
37 virtual ~GDataCacheMetadata(); | 37 virtual ~GDataCacheMetadata(); |
38 | 38 |
39 // Updates cache map with entry corresponding to |resource_id|. | 39 // Updates cache map with entry corresponding to |resource_id|. |
40 // Creates new entry if it doesn't exist, otherwise update the entry. | 40 // Creates new entry if it doesn't exist, otherwise update the entry. |
41 virtual void UpdateCache(const std::string& resource_id, | 41 virtual void UpdateCache(const std::string& resource_id, |
42 const std::string& md5, | 42 const std::string& md5, |
| 43 GDataCache::CacheSubDirectoryType subdir, |
43 int cache_state) = 0; | 44 int cache_state) = 0; |
44 | 45 |
45 // Removes entry corresponding to |resource_id| from cache map. | 46 // Removes entry corresponding to |resource_id| from cache map. |
46 virtual void RemoveFromCache(const std::string& resource_id) = 0; | 47 virtual void RemoveFromCache(const std::string& resource_id) = 0; |
47 | 48 |
48 // Returns the cache entry for file corresponding to |resource_id| and |md5| | 49 // Returns the cache entry for file corresponding to |resource_id| and |md5| |
49 // if entry exists in cache map. Otherwise, returns NULL. | 50 // if entry exists in cache map. Otherwise, returns NULL. |
50 // |md5| can be empty if only matching |resource_id| is desired, which may | 51 // |md5| can be empty if only matching |resource_id| is desired, which may |
51 // happen when looking for pinned entries where symlinks' filenames have no | 52 // happen when looking for pinned entries where symlinks' filenames have no |
52 // extension and hence no md5. | 53 // extension and hence no md5. |
(...skipping 27 matching lines...) Expand all Loading... |
80 base::SequencedWorkerPool* pool, | 81 base::SequencedWorkerPool* pool, |
81 const base::SequencedWorkerPool::SequenceToken& sequence_token); | 82 const base::SequencedWorkerPool::SequenceToken& sequence_token); |
82 virtual ~GDataCacheMetadataMap(); | 83 virtual ~GDataCacheMetadataMap(); |
83 | 84 |
84 // Initializes the data. | 85 // Initializes the data. |
85 void Initialize(const std::vector<FilePath>& cache_paths); | 86 void Initialize(const std::vector<FilePath>& cache_paths); |
86 | 87 |
87 // GDataCacheMetadata overrides: | 88 // GDataCacheMetadata overrides: |
88 virtual void UpdateCache(const std::string& resource_id, | 89 virtual void UpdateCache(const std::string& resource_id, |
89 const std::string& md5, | 90 const std::string& md5, |
| 91 GDataCache::CacheSubDirectoryType subdir, |
90 int cache_state) OVERRIDE; | 92 int cache_state) OVERRIDE; |
91 virtual void RemoveFromCache(const std::string& resource_id) OVERRIDE; | 93 virtual void RemoveFromCache(const std::string& resource_id) OVERRIDE; |
92 virtual scoped_ptr<GDataCache::CacheEntry> GetCacheEntry( | 94 virtual scoped_ptr<GDataCache::CacheEntry> GetCacheEntry( |
93 const std::string& resource_id, | 95 const std::string& resource_id, |
94 const std::string& md5) OVERRIDE; | 96 const std::string& md5) OVERRIDE; |
95 virtual void RemoveTemporaryFiles() OVERRIDE; | 97 virtual void RemoveTemporaryFiles() OVERRIDE; |
96 virtual void Iterate(const IterateCallback& callback) OVERRIDE; | 98 virtual void Iterate(const IterateCallback& callback) OVERRIDE; |
97 | 99 |
98 // A map table of cache file's resource id to its CacheEntry* entry. | 100 // A map table of cache file's resource id to its CacheEntry* entry. |
99 typedef std::map<std::string, GDataCache::CacheEntry> CacheMap; | 101 typedef std::map<std::string, GDataCache::CacheEntry> CacheMap; |
(...skipping 22 matching lines...) Expand all Loading... |
122 const GDataCache::CacheEntry& cache_entry); | 124 const GDataCache::CacheEntry& cache_entry); |
123 | 125 |
124 CacheMap cache_map_; | 126 CacheMap cache_map_; |
125 | 127 |
126 DISALLOW_COPY_AND_ASSIGN(GDataCacheMetadataMap); | 128 DISALLOW_COPY_AND_ASSIGN(GDataCacheMetadataMap); |
127 }; | 129 }; |
128 | 130 |
129 } // namespace gdata | 131 } // namespace gdata |
130 | 132 |
131 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_METADATA_H_ | 133 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_METADATA_H_ |
OLD | NEW |