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

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

Issue 10581038: chromeos: Stop returning scoped_ptr from GDataCache::GetCacheEntry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 25 matching lines...) Expand all
36 virtual ~GDataCacheMetadata(); 36 virtual ~GDataCacheMetadata();
37 37
38 // Adds a new cache entry corresponding to |resource_id| if it doesn't 38 // Adds a new cache entry corresponding to |resource_id| if it doesn't
39 // exist, otherwise update the existing entry. 39 // exist, otherwise update the existing entry.
40 virtual void AddOrUpdateCacheEntry(const std::string& resource_id, 40 virtual void AddOrUpdateCacheEntry(const std::string& resource_id,
41 const GDataCacheEntry& cache_entry) = 0; 41 const GDataCacheEntry& cache_entry) = 0;
42 42
43 // Removes entry corresponding to |resource_id| from cache map. 43 // Removes entry corresponding to |resource_id| from cache map.
44 virtual void RemoveCacheEntry(const std::string& resource_id) = 0; 44 virtual void RemoveCacheEntry(const std::string& resource_id) = 0;
45 45
46 // Returns the cache entry for file corresponding to |resource_id| and |md5| 46 // Gets the cache entry for file corresponding to |resource_id| and |md5|
47 // if entry exists in cache map. Otherwise, returns NULL. 47 // and returns true if entry exists in cache map. Otherwise, returns false.
48 // |md5| can be empty if only matching |resource_id| is desired, which may 48 // |md5| can be empty if only matching |resource_id| is desired, which may
49 // happen when looking for pinned entries where symlinks' filenames have no 49 // happen when looking for pinned entries where symlinks' filenames have no
50 // extension and hence no md5. 50 // extension and hence no md5.
51 virtual scoped_ptr<GDataCacheEntry> GetCacheEntry( 51 virtual bool GetCacheEntry(const std::string& resource_id,
52 const std::string& resource_id, 52 const std::string& md5,
53 const std::string& md5) = 0; 53 GDataCacheEntry* entry) = 0;
54 54
55 // Removes temporary files (files in CACHE_TYPE_TMP) from the cache map. 55 // Removes temporary files (files in CACHE_TYPE_TMP) from the cache map.
56 virtual void RemoveTemporaryFiles() = 0; 56 virtual void RemoveTemporaryFiles() = 0;
57 57
58 // Iterates over all the cache entries synchronously. |callback| is called 58 // Iterates over all the cache entries synchronously. |callback| is called
59 // on each cache entry. 59 // on each cache entry.
60 virtual void Iterate(const IterateCallback& callback) = 0; 60 virtual void Iterate(const IterateCallback& callback) = 0;
61 61
62 protected: 62 protected:
63 // Checks whether the current thread is on the right sequenced worker pool 63 // Checks whether the current thread is on the right sequenced worker pool
(...skipping 16 matching lines...) Expand all
80 virtual ~GDataCacheMetadataMap(); 80 virtual ~GDataCacheMetadataMap();
81 81
82 // Initializes the data. 82 // Initializes the data.
83 void Initialize(const std::vector<FilePath>& cache_paths); 83 void Initialize(const std::vector<FilePath>& cache_paths);
84 84
85 // GDataCacheMetadata overrides: 85 // GDataCacheMetadata overrides:
86 virtual void AddOrUpdateCacheEntry( 86 virtual void AddOrUpdateCacheEntry(
87 const std::string& resource_id, 87 const std::string& resource_id,
88 const GDataCacheEntry& cache_entry) OVERRIDE; 88 const GDataCacheEntry& cache_entry) OVERRIDE;
89 virtual void RemoveCacheEntry(const std::string& resource_id) OVERRIDE; 89 virtual void RemoveCacheEntry(const std::string& resource_id) OVERRIDE;
90 virtual scoped_ptr<GDataCacheEntry> GetCacheEntry( 90 virtual bool GetCacheEntry(const std::string& resource_id,
91 const std::string& resource_id, 91 const std::string& md5,
92 const std::string& md5) OVERRIDE; 92 GDataCacheEntry* cache_entry) OVERRIDE;
93 virtual void RemoveTemporaryFiles() OVERRIDE; 93 virtual void RemoveTemporaryFiles() OVERRIDE;
94 virtual void Iterate(const IterateCallback& callback) OVERRIDE; 94 virtual void Iterate(const IterateCallback& callback) OVERRIDE;
95 95
96 // A map table of cache file's resource id to its CacheEntry* entry. 96 // A map table of cache file's resource id to its CacheEntry* entry.
97 typedef std::map<std::string, GDataCacheEntry> CacheMap; 97 typedef std::map<std::string, GDataCacheEntry> CacheMap;
98 98
99 // A map table of resource ID to file path. 99 // A map table of resource ID to file path.
100 typedef std::map<std::string, FilePath> ResourceIdToFilePathMap; 100 typedef std::map<std::string, FilePath> ResourceIdToFilePathMap;
101 101
102 private: 102 private:
(...skipping 17 matching lines...) Expand all
120 const GDataCacheEntry& cache_entry); 120 const GDataCacheEntry& cache_entry);
121 121
122 CacheMap cache_map_; 122 CacheMap cache_map_;
123 123
124 DISALLOW_COPY_AND_ASSIGN(GDataCacheMetadataMap); 124 DISALLOW_COPY_AND_ASSIGN(GDataCacheMetadataMap);
125 }; 125 };
126 126
127 } // namespace gdata 127 } // namespace gdata
128 128
129 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_METADATA_H_ 129 #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