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

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

Issue 10830181: Implement initialization for GDataCache to use in-memory metadata for tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase, fix comment text. Created 8 years, 4 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
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 <vector> 9 #include <vector>
10 #include <string> 10 #include <string>
(...skipping 13 matching lines...) Expand all
24 // Callback for Iterate(). 24 // Callback for Iterate().
25 typedef base::Callback<void(const std::string& resource_id, 25 typedef base::Callback<void(const std::string& resource_id,
26 const GDataCacheEntry& cache_entry)> 26 const GDataCacheEntry& cache_entry)>
27 IterateCallback; 27 IterateCallback;
28 28
29 // A map table of cache file's resource id to its CacheEntry* entry. 29 // A map table of cache file's resource id to its CacheEntry* entry.
30 typedef std::map<std::string, GDataCacheEntry> CacheMap; 30 typedef std::map<std::string, GDataCacheEntry> CacheMap;
31 31
32 virtual ~GDataCacheMetadata(); 32 virtual ~GDataCacheMetadata();
33 33
34 // |pool| and |sequence_token| are used to assert that the functions are 34 // Creates GDataCacheMetadata instance.
35 // called on the right sequenced worker pool with the right sequence token.
36 //
37 // For testing, the thread assertion can be disabled by passing NULL and
38 // the default value of SequenceToken.
39 static scoped_ptr<GDataCacheMetadata> CreateGDataCacheMetadata( 35 static scoped_ptr<GDataCacheMetadata> CreateGDataCacheMetadata(
40 base::SequencedTaskRunner* blocking_task_runner); 36 base::SequencedTaskRunner* blocking_task_runner);
41 37
38 // Creates GDataCacheMetadata instance. This uses FakeGDataCacheMetadata,
39 // which is an in-memory implmentation and faster than GDataCacheMetadataDB.
40 static scoped_ptr<GDataCacheMetadata> CreateGDataCacheMetadataForTesting(
41 base::SequencedTaskRunner* blocking_task_runner);
42
42 // Initialize the cache metadata store. 43 // Initialize the cache metadata store.
43 virtual void Initialize(const std::vector<FilePath>& cache_paths) = 0; 44 virtual void Initialize(const std::vector<FilePath>& cache_paths) = 0;
44 // Adds a new cache entry corresponding to |resource_id| if it doesn't 45 // Adds a new cache entry corresponding to |resource_id| if it doesn't
45 // exist, otherwise update the existing entry. 46 // exist, otherwise update the existing entry.
46 virtual void AddOrUpdateCacheEntry(const std::string& resource_id, 47 virtual void AddOrUpdateCacheEntry(const std::string& resource_id,
47 const GDataCacheEntry& cache_entry) = 0; 48 const GDataCacheEntry& cache_entry) = 0;
48 49
49 // Removes entry corresponding to |resource_id| from cache map. 50 // Removes entry corresponding to |resource_id| from cache map.
50 virtual void RemoveCacheEntry(const std::string& resource_id) = 0; 51 virtual void RemoveCacheEntry(const std::string& resource_id) = 0;
51 52
(...skipping 26 matching lines...) Expand all
78 79
79 private: 80 private:
80 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 81 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
81 82
82 DISALLOW_COPY_AND_ASSIGN(GDataCacheMetadata); 83 DISALLOW_COPY_AND_ASSIGN(GDataCacheMetadata);
83 }; 84 };
84 85
85 } // namespace gdata 86 } // namespace gdata
86 87
87 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_METADATA_H_ 88 #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