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_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // Does the following: | 244 // Does the following: |
245 // - remove all delete stale cache versions corresponding to |resource_id| in | 245 // - remove all delete stale cache versions corresponding to |resource_id| in |
246 // persistent, tmp and pinned directories | 246 // persistent, tmp and pinned directories |
247 // - remove entry corresponding to |resource_id| from cache map. | 247 // - remove entry corresponding to |resource_id| from cache map. |
248 void RemoveOnUIThread(const std::string& resource_id, | 248 void RemoveOnUIThread(const std::string& resource_id, |
249 const CacheOperationCallback& callback); | 249 const CacheOperationCallback& callback); |
250 | 250 |
251 // Utility method to call Initialize on UI thread. | 251 // Utility method to call Initialize on UI thread. |
252 void RequestInitializeOnUIThread(); | 252 void RequestInitializeOnUIThread(); |
253 | 253 |
254 // Returns the cache entry for file corresponding to |resource_id| and |md5| | 254 // Gets the cache entry for file corresponding to |resource_id| and |md5| |
255 // if entry exists in cache map. Otherwise, returns NULL. | 255 // and returns true if entry exists in cache map. Otherwise, returns false. |
256 // |md5| can be empty if only matching |resource_id| is desired, which may | 256 // |md5| can be empty if only matching |resource_id| is desired, which may |
257 // happen when looking for pinned entries where symlinks' filenames have no | 257 // happen when looking for pinned entries where symlinks' filenames have no |
258 // extension and hence no md5. | 258 // extension and hence no md5. |
259 scoped_ptr<GDataCacheEntry> GetCacheEntry(const std::string& resource_id, | 259 bool GetCacheEntry(const std::string& resource_id, |
260 const std::string& md5); | 260 const std::string& md5, |
| 261 GDataCacheEntry* entry); |
261 | 262 |
262 // Factory methods for GDataCache. | 263 // Factory methods for GDataCache. |
263 // |pool| and |sequence_token| are used to assert that the functions are | 264 // |pool| and |sequence_token| are used to assert that the functions are |
264 // called on the right sequenced worker pool with the right sequence token. | 265 // called on the right sequenced worker pool with the right sequence token. |
265 // | 266 // |
266 // For testing, the thread assertion can be disabled by passing NULL and | 267 // For testing, the thread assertion can be disabled by passing NULL and |
267 // the default value of SequenceToken. | 268 // the default value of SequenceToken. |
268 static GDataCache* CreateGDataCacheOnUIThread( | 269 static GDataCache* CreateGDataCacheOnUIThread( |
269 const FilePath& cache_root_path, | 270 const FilePath& cache_root_path, |
270 base::SequencedWorkerPool* pool, | 271 base::SequencedWorkerPool* pool, |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 }; | 436 }; |
436 | 437 |
437 // Sets the free disk space getter for testing. | 438 // Sets the free disk space getter for testing. |
438 // The existing getter is deleted. | 439 // The existing getter is deleted. |
439 void SetFreeDiskSpaceGetterForTesting( | 440 void SetFreeDiskSpaceGetterForTesting( |
440 FreeDiskSpaceGetterInterface* getter); | 441 FreeDiskSpaceGetterInterface* getter); |
441 | 442 |
442 } // namespace gdata | 443 } // namespace gdata |
443 | 444 |
444 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ | 445 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ |
OLD | NEW |