| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 // Does the following: | 285 // Does the following: |
| 286 // - remove all delete stale cache versions corresponding to |resource_id| in | 286 // - remove all delete stale cache versions corresponding to |resource_id| in |
| 287 // persistent, tmp and pinned directories | 287 // persistent, tmp and pinned directories |
| 288 // - remove entry corresponding to |resource_id| from cache map. | 288 // - remove entry corresponding to |resource_id| from cache map. |
| 289 void RemoveOnUIThread(const std::string& resource_id, | 289 void RemoveOnUIThread(const std::string& resource_id, |
| 290 const CacheOperationCallback& callback); | 290 const CacheOperationCallback& callback); |
| 291 | 291 |
| 292 // Utility method to call Initialize on UI thread. | 292 // Utility method to call Initialize on UI thread. |
| 293 void RequestInitializeOnUIThread(); | 293 void RequestInitializeOnUIThread(); |
| 294 | 294 |
| 295 // Returns the cache entry for file corresponding to |resource_id| and |md5| | 295 // Gets the cache entry for file corresponding to |resource_id| and |md5| |
| 296 // if entry exists in cache map. Otherwise, returns NULL. | 296 // and returns true if entry exists in cache map. Otherwise, returns false. |
| 297 // |md5| can be empty if only matching |resource_id| is desired, which may | 297 // |md5| can be empty if only matching |resource_id| is desired, which may |
| 298 // happen when looking for pinned entries where symlinks' filenames have no | 298 // happen when looking for pinned entries where symlinks' filenames have no |
| 299 // extension and hence no md5. | 299 // extension and hence no md5. |
| 300 scoped_ptr<CacheEntry> GetCacheEntry(const std::string& resource_id, | 300 bool GetCacheEntry(const std::string& resource_id, |
| 301 const std::string& md5); | 301 const std::string& md5, |
| 302 CacheEntry* entry); |
| 302 | 303 |
| 303 // Factory methods for GDataCache. | 304 // Factory methods for GDataCache. |
| 304 // |pool| and |sequence_token| are used to assert that the functions are | 305 // |pool| and |sequence_token| are used to assert that the functions are |
| 305 // called on the right sequenced worker pool with the right sequence token. | 306 // called on the right sequenced worker pool with the right sequence token. |
| 306 // | 307 // |
| 307 // For testing, the thread assertion can be disabled by passing NULL and | 308 // For testing, the thread assertion can be disabled by passing NULL and |
| 308 // the default value of SequenceToken. | 309 // the default value of SequenceToken. |
| 309 static GDataCache* CreateGDataCacheOnUIThread( | 310 static GDataCache* CreateGDataCacheOnUIThread( |
| 310 const FilePath& cache_root_path, | 311 const FilePath& cache_root_path, |
| 311 base::SequencedWorkerPool* pool, | 312 base::SequencedWorkerPool* pool, |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 }; | 451 }; |
| 451 | 452 |
| 452 // Sets the free disk space getter for testing. | 453 // Sets the free disk space getter for testing. |
| 453 // The existing getter is deleted. | 454 // The existing getter is deleted. |
| 454 void SetFreeDiskSpaceGetterForTesting( | 455 void SetFreeDiskSpaceGetterForTesting( |
| 455 FreeDiskSpaceGetterInterface* getter); | 456 FreeDiskSpaceGetterInterface* getter); |
| 456 | 457 |
| 457 } // namespace gdata | 458 } // namespace gdata |
| 458 | 459 |
| 459 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ | 460 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ |
| OLD | NEW |