Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_cache_metadata.h

Issue 10735049: gdata: Take GDataCache::CacheEntry as parameters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: polish Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 21 matching lines...) Expand all
32 // For testing, the thread assertion can be disabled by passing NULL and 32 // For testing, the thread assertion can be disabled by passing NULL and
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 GDataCache::CacheEntry& cache_entry) = 0;
43 int cache_state) = 0;
44 43
45 // Removes entry corresponding to |resource_id| from cache map. 44 // Removes entry corresponding to |resource_id| from cache map.
46 virtual void RemoveFromCache(const std::string& resource_id) = 0; 45 virtual void RemoveFromCache(const std::string& resource_id) = 0;
47 46
48 // Returns the cache entry for file corresponding to |resource_id| and |md5| 47 // Returns the cache entry for file corresponding to |resource_id| and |md5|
49 // if entry exists in cache map. Otherwise, returns NULL. 48 // if entry exists in cache map. Otherwise, returns NULL.
50 // |md5| can be empty if only matching |resource_id| is desired, which may 49 // |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 50 // happen when looking for pinned entries where symlinks' filenames have no
52 // extension and hence no md5. 51 // extension and hence no md5.
53 virtual scoped_ptr<GDataCache::CacheEntry> GetCacheEntry( 52 virtual scoped_ptr<GDataCache::CacheEntry> GetCacheEntry(
(...skipping 24 matching lines...) Expand all
78 public: 77 public:
79 GDataCacheMetadataMap( 78 GDataCacheMetadataMap(
80 base::SequencedWorkerPool* pool, 79 base::SequencedWorkerPool* pool,
81 const base::SequencedWorkerPool::SequenceToken& sequence_token); 80 const base::SequencedWorkerPool::SequenceToken& sequence_token);
82 virtual ~GDataCacheMetadataMap(); 81 virtual ~GDataCacheMetadataMap();
83 82
84 // Initializes the data. 83 // Initializes the data.
85 void Initialize(const std::vector<FilePath>& cache_paths); 84 void Initialize(const std::vector<FilePath>& cache_paths);
86 85
87 // GDataCacheMetadata overrides: 86 // GDataCacheMetadata overrides:
88 virtual void UpdateCache(const std::string& resource_id, 87 virtual void UpdateCache(
89 const std::string& md5, 88 const std::string& resource_id,
90 int cache_state) OVERRIDE; 89 const GDataCache::CacheEntry& cache_entry) OVERRIDE;
91 virtual void RemoveFromCache(const std::string& resource_id) OVERRIDE; 90 virtual void RemoveFromCache(const std::string& resource_id) OVERRIDE;
92 virtual scoped_ptr<GDataCache::CacheEntry> GetCacheEntry( 91 virtual scoped_ptr<GDataCache::CacheEntry> GetCacheEntry(
93 const std::string& resource_id, 92 const std::string& resource_id,
94 const std::string& md5) OVERRIDE; 93 const std::string& md5) OVERRIDE;
95 virtual void RemoveTemporaryFiles() OVERRIDE; 94 virtual void RemoveTemporaryFiles() OVERRIDE;
96 virtual void Iterate(const IterateCallback& callback) OVERRIDE; 95 virtual void Iterate(const IterateCallback& callback) OVERRIDE;
97 96
98 // A map table of cache file's resource id to its CacheEntry* entry. 97 // A map table of cache file's resource id to its CacheEntry* entry.
99 typedef std::map<std::string, GDataCache::CacheEntry> CacheMap; 98 typedef std::map<std::string, GDataCache::CacheEntry> CacheMap;
100 99
(...skipping 21 matching lines...) Expand all
122 const GDataCache::CacheEntry& cache_entry); 121 const GDataCache::CacheEntry& cache_entry);
123 122
124 CacheMap cache_map_; 123 CacheMap cache_map_;
125 124
126 DISALLOW_COPY_AND_ASSIGN(GDataCacheMetadataMap); 125 DISALLOW_COPY_AND_ASSIGN(GDataCacheMetadataMap);
127 }; 126 };
128 127
129 } // namespace gdata 128 } // namespace gdata
130 129
131 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_METADATA_H_ 130 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_METADATA_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_cache.cc ('k') | chrome/browser/chromeos/gdata/gdata_cache_metadata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698