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. | |
achuithb
2012/08/08 05:07:31
nit: maybe add a comment saying that the in-memory
Haruki Sato
2012/08/08 05:57:38
Done. Thanks.
| |
336 void InitializeForTesting(); | |
337 | |
332 // Deletes the cache. | 338 // Deletes the cache. |
333 void Destroy(); | 339 void Destroy(); |
334 | 340 |
335 // Force a rescan of cache directories. | 341 // Force a rescan of cache directories. |
336 void ForceRescanForTesting(); | 342 void ForceRescanForTesting(); |
337 | 343 |
338 // Used to implement GetResourceIdsOfBacklogOnUIThread. | 344 // Used to implement GetResourceIdsOfBacklogOnUIThread. |
339 void GetResourceIdsOfBacklog( | 345 void GetResourceIdsOfBacklog( |
340 std::vector<std::string>* to_fetch, | 346 std::vector<std::string>* to_fetch, |
341 std::vector<std::string>* to_upload); | 347 std::vector<std::string>* to_upload); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
465 }; | 471 }; |
466 | 472 |
467 // Sets the free disk space getter for testing. | 473 // Sets the free disk space getter for testing. |
468 // The existing getter is deleted. | 474 // The existing getter is deleted. |
469 void SetFreeDiskSpaceGetterForTesting( | 475 void SetFreeDiskSpaceGetterForTesting( |
470 FreeDiskSpaceGetterInterface* getter); | 476 FreeDiskSpaceGetterInterface* getter); |
471 | 477 |
472 } // namespace gdata | 478 } // namespace gdata |
473 | 479 |
474 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ | 480 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_CACHE_H_ |
OLD | NEW |