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