| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 // Does the following: | 332 // Does the following: |
| 333 // - remove all delete stale cache versions corresponding to |resource_id| in | 333 // - remove all delete stale cache versions corresponding to |resource_id| in |
| 334 // persistent, tmp and pinned directories | 334 // persistent, tmp and pinned directories |
| 335 // - remove entry corresponding to |resource_id| from cache map. | 335 // - remove entry corresponding to |resource_id| from cache map. |
| 336 void RemoveOnUIThread(const std::string& resource_id, | 336 void RemoveOnUIThread(const std::string& resource_id, |
| 337 const CacheOperationCallback& callback); | 337 const CacheOperationCallback& callback); |
| 338 | 338 |
| 339 // Utility method to call Initialize on UI thread. | 339 // Utility method to call Initialize on UI thread. |
| 340 void RequestInitializeOnUIThread(); | 340 void RequestInitializeOnUIThread(); |
| 341 | 341 |
| 342 // Returns the cache entry for file corresponding to |resource_id| and |md5| | 342 // Gets the cache entry for file corresponding to |resource_id| and |md5| |
| 343 // if entry exists in cache map. Otherwise, returns NULL. | 343 // and returns true if entry exists in cache map. Otherwise, returns false. |
| 344 // |md5| can be empty if only matching |resource_id| is desired, which may | 344 // |md5| can be empty if only matching |resource_id| is desired, which may |
| 345 // happen when looking for pinned entries where symlinks' filenames have no | 345 // happen when looking for pinned entries where symlinks' filenames have no |
| 346 // extension and hence no md5. | 346 // extension and hence no md5. |
| 347 scoped_ptr<CacheEntry> GetCacheEntry(const std::string& resource_id, | 347 bool GetCacheEntry(const std::string& resource_id, |
| 348 const std::string& md5); | 348 const std::string& md5, |
| 349 CacheEntry* entry); |
| 349 | 350 |
| 350 // Factory methods for GDataCache. | 351 // Factory methods for GDataCache. |
| 351 // |pool| and |sequence_token| are used to assert that the functions are | 352 // |pool| and |sequence_token| are used to assert that the functions are |
| 352 // called on the right sequenced worker pool with the right sequence token. | 353 // called on the right sequenced worker pool with the right sequence token. |
| 353 // | 354 // |
| 354 // For testing, the thread assertion can be disabled by passing NULL and | 355 // For testing, the thread assertion can be disabled by passing NULL and |
| 355 // the default value of SequenceToken. | 356 // the default value of SequenceToken. |
| 356 static GDataCache* CreateGDataCacheOnUIThread( | 357 static GDataCache* CreateGDataCacheOnUIThread( |
| 357 const FilePath& cache_root_path, | 358 const FilePath& cache_root_path, |
| 358 base::SequencedWorkerPool* pool, | 359 base::SequencedWorkerPool* pool, |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 }; | 527 }; |
| 527 | 528 |
| 528 // Sets the free disk space getter for testing. | 529 // Sets the free disk space getter for testing. |
| 529 // The existing getter is deleted. | 530 // The existing getter is deleted. |
| 530 void SetFreeDiskSpaceGetterForTesting( | 531 void SetFreeDiskSpaceGetterForTesting( |
| 531 FreeDiskSpaceGetterInterface* getter); | 532 FreeDiskSpaceGetterInterface* getter); |
| 532 | 533 |
| 533 } // namespace gdata | 534 } // namespace gdata |
| 534 | 535 |
| 535 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ | 536 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ |
| OLD | NEW |