| 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 #include <vector> | 10 #include <vector> |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 const CacheOperationCallback& callback); | 265 const CacheOperationCallback& callback); |
| 266 | 266 |
| 267 // Does the following: | 267 // Does the following: |
| 268 // - remove all the files in the cache directory. | 268 // - remove all the files in the cache directory. |
| 269 // - re-create the |metadata_| instance. | 269 // - re-create the |metadata_| instance. |
| 270 void ClearAllOnUIThread(const ChangeCacheStateCallback& callback); | 270 void ClearAllOnUIThread(const ChangeCacheStateCallback& callback); |
| 271 | 271 |
| 272 // Utility method to call Initialize on UI thread. | 272 // Utility method to call Initialize on UI thread. |
| 273 void RequestInitializeOnUIThread(); | 273 void RequestInitializeOnUIThread(); |
| 274 | 274 |
| 275 // Utility method to call InitializeForTesting on UI thread. |
| 276 void RequestInitializeOnUIThreadForTesting(); |
| 277 |
| 275 // Force a rescan of cache files, for testing. | 278 // Force a rescan of cache files, for testing. |
| 276 void ForceRescanOnUIThreadForTesting(); | 279 void ForceRescanOnUIThreadForTesting(); |
| 277 | 280 |
| 278 // Gets the cache entry for file corresponding to |resource_id| and |md5| | 281 // Gets the cache entry for file corresponding to |resource_id| and |md5| |
| 279 // and returns true if entry exists in cache map. Otherwise, returns false. | 282 // and returns true if entry exists in cache map. Otherwise, returns false. |
| 280 // |md5| can be empty if only matching |resource_id| is desired, which may | 283 // |md5| can be empty if only matching |resource_id| is desired, which may |
| 281 // happen when looking for pinned entries where symlinks' filenames have no | 284 // happen when looking for pinned entries where symlinks' filenames have no |
| 282 // extension and hence no md5. | 285 // extension and hence no md5. |
| 283 bool GetCacheEntry(const std::string& resource_id, | 286 bool GetCacheEntry(const std::string& resource_id, |
| 284 const std::string& md5, | 287 const std::string& md5, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 base::SequencedTaskRunner* blocking_task_runner); | 325 base::SequencedTaskRunner* blocking_task_runner); |
| 323 virtual ~GDataCache(); | 326 virtual ~GDataCache(); |
| 324 | 327 |
| 325 // Checks whether the current thread is on the right sequenced worker pool | 328 // Checks whether the current thread is on the right sequenced worker pool |
| 326 // with the right sequence ID. If not, DCHECK will fail. | 329 // with the right sequence ID. If not, DCHECK will fail. |
| 327 void AssertOnSequencedWorkerPool(); | 330 void AssertOnSequencedWorkerPool(); |
| 328 | 331 |
| 329 // Initializes the cache. | 332 // Initializes the cache. |
| 330 void Initialize(); | 333 void Initialize(); |
| 331 | 334 |
| 335 // Initializes the cache with in-memory cache for testing. |
| 336 // The in-memory cache is used since it's faster than the db. |
| 337 void InitializeForTesting(); |
| 338 |
| 332 // Deletes the cache. | 339 // Deletes the cache. |
| 333 void Destroy(); | 340 void Destroy(); |
| 334 | 341 |
| 335 // Force a rescan of cache directories. | 342 // Force a rescan of cache directories. |
| 336 void ForceRescanForTesting(); | 343 void ForceRescanForTesting(); |
| 337 | 344 |
| 338 // Used to implement GetResourceIdsOfBacklogOnUIThread. | 345 // Used to implement GetResourceIdsOfBacklogOnUIThread. |
| 339 void GetResourceIdsOfBacklog( | 346 void GetResourceIdsOfBacklog( |
| 340 std::vector<std::string>* to_fetch, | 347 std::vector<std::string>* to_fetch, |
| 341 std::vector<std::string>* to_upload); | 348 std::vector<std::string>* to_upload); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 }; | 472 }; |
| 466 | 473 |
| 467 // Sets the free disk space getter for testing. | 474 // Sets the free disk space getter for testing. |
| 468 // The existing getter is deleted. | 475 // The existing getter is deleted. |
| 469 void SetFreeDiskSpaceGetterForTesting( | 476 void SetFreeDiskSpaceGetterForTesting( |
| 470 FreeDiskSpaceGetterInterface* getter); | 477 FreeDiskSpaceGetterInterface* getter); |
| 471 | 478 |
| 472 } // namespace gdata | 479 } // namespace gdata |
| 473 | 480 |
| 474 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ | 481 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ |
| OLD | NEW |