Chromium Code Reviews| 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_DRIVE_FILE_CACHE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 255 const FileOperationCallback& callback); | 255 const FileOperationCallback& callback); |
| 256 | 256 |
| 257 // Modifies cache state, i.e. creates symlink in outgoing | 257 // Modifies cache state, i.e. creates symlink in outgoing |
| 258 // dir to reference dirty file in persistent dir. | 258 // dir to reference dirty file in persistent dir. |
| 259 // |callback| must not be null. | 259 // |callback| must not be null. |
| 260 // Must be called on the UI thread. | 260 // Must be called on the UI thread. |
| 261 void CommitDirtyOnUIThread(const std::string& resource_id, | 261 void CommitDirtyOnUIThread(const std::string& resource_id, |
| 262 const std::string& md5, | 262 const std::string& md5, |
| 263 const FileOperationCallback& callback); | 263 const FileOperationCallback& callback); |
| 264 | 264 |
| 265 // Modifies cache state, which involves the following: | 265 // Runs ClearDirty() with |blocking_task_runner_| and runs |callback| with the |
| 266 // - moves |source_path| to |dest_path| in persistent dir if | 266 // result. |
| 267 // file is pinned or tmp dir otherwise, where |source_path| has .local | |
| 268 // extension and |dest_path| has .<md5> extension | |
| 269 // - deletes symlink in outgoing dir | |
| 270 // - if file is pinned, updates symlink in pinned dir to reference | |
| 271 // |dest_path| | |
| 272 // |callback| must not be null. | 267 // |callback| must not be null. |
| 273 // Must be called on the UI thread. | |
| 274 void ClearDirtyOnUIThread(const std::string& resource_id, | 268 void ClearDirtyOnUIThread(const std::string& resource_id, |
| 275 const std::string& md5, | 269 const std::string& md5, |
| 276 const FileOperationCallback& callback); | 270 const FileOperationCallback& callback); |
|
kinaba
2013/05/28 06:29:40
Looks like UpdateOperation is the only client usin
hashimoto
2013/05/28 06:55:09
Done.
| |
| 277 | 271 |
| 272 // Clears dirty state of the specified entry. | |
| 273 FileError ClearDirty(const std::string& resource_id, | |
| 274 const std::string& md5); | |
| 275 | |
| 278 // Runs Remove() on |blocking_task_runner_| and runs |callback| with the | 276 // Runs Remove() on |blocking_task_runner_| and runs |callback| with the |
| 279 // result. | 277 // result. |
| 280 // Must be called on the UI thread. | 278 // Must be called on the UI thread. |
| 281 void RemoveOnUIThread(const std::string& resource_id, | 279 void RemoveOnUIThread(const std::string& resource_id, |
| 282 const FileOperationCallback& callback); | 280 const FileOperationCallback& callback); |
| 283 | 281 |
| 284 // Removes the specified cache entry and delete cache files if available. | 282 // Removes the specified cache entry and delete cache files if available. |
| 285 // Synchronous version of RemoveOnUIThread(). | 283 // Synchronous version of RemoveOnUIThread(). |
| 286 FileError Remove(const std::string& resource_id); | 284 FileError Remove(const std::string& resource_id); |
| 287 | 285 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 const std::string& md5, | 372 const std::string& md5, |
| 375 base::FilePath* cache_file_path); | 373 base::FilePath* cache_file_path); |
| 376 | 374 |
| 377 // Used to implement MarkAsUnmountedOnUIThread. | 375 // Used to implement MarkAsUnmountedOnUIThread. |
| 378 FileError MarkAsUnmounted(const base::FilePath& file_path); | 376 FileError MarkAsUnmounted(const base::FilePath& file_path); |
| 379 | 377 |
| 380 // Used to implement MarkDirtyOnUIThread. | 378 // Used to implement MarkDirtyOnUIThread. |
| 381 FileError MarkDirty(const std::string& resource_id, | 379 FileError MarkDirty(const std::string& resource_id, |
| 382 const std::string& md5); | 380 const std::string& md5); |
| 383 | 381 |
| 384 // Used to implement ClearDirtyOnUIThread. | |
| 385 FileError ClearDirty(const std::string& resource_id, | |
| 386 const std::string& md5); | |
| 387 | |
| 388 // Used to implement ClearAllOnUIThread. | 382 // Used to implement ClearAllOnUIThread. |
| 389 bool ClearAll(); | 383 bool ClearAll(); |
| 390 | 384 |
| 391 // Runs callback and notifies the observers when file is pinned. | 385 // Runs callback and notifies the observers when file is pinned. |
| 392 void OnPinned(const std::string& resource_id, | 386 void OnPinned(const std::string& resource_id, |
| 393 const std::string& md5, | 387 const std::string& md5, |
| 394 const FileOperationCallback& callback, | 388 const FileOperationCallback& callback, |
| 395 FileError error); | 389 FileError error); |
| 396 | 390 |
| 397 // Runs callback and notifies the observers when file is unpinned. | 391 // Runs callback and notifies the observers when file is unpinned. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 // this value. | 429 // this value. |
| 436 // | 430 // |
| 437 // Copied from cryptohome/homedirs.h. | 431 // Copied from cryptohome/homedirs.h. |
| 438 // TODO(satorux): Share the constant. | 432 // TODO(satorux): Share the constant. |
| 439 const int64 kMinFreeSpace = 512 * 1LL << 20; | 433 const int64 kMinFreeSpace = 512 * 1LL << 20; |
| 440 | 434 |
| 441 } // namespace internal | 435 } // namespace internal |
| 442 } // namespace drive | 436 } // namespace drive |
| 443 | 437 |
| 444 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_ | 438 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_FILE_CACHE_H_ |
| OLD | NEW |