| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <memory> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/callback.h" | 14 #include "base/callback.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/scoped_ptr.h" | |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/threading/non_thread_safe.h" | 17 #include "base/threading/non_thread_safe.h" |
| 18 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" | 18 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" |
| 19 #include "storage/browser/fileapi/file_system_url.h" | 19 #include "storage/browser/fileapi/file_system_url.h" |
| 20 | 20 |
| 21 namespace storage { | 21 namespace storage { |
| 22 class FileSystemURL; | 22 class FileSystemURL; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace sync_file_system { | 25 namespace sync_file_system { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // LocalFileSyncStatus::Observer overrides. | 61 // LocalFileSyncStatus::Observer overrides. |
| 62 void OnSyncEnabled(const storage::FileSystemURL& url) override; | 62 void OnSyncEnabled(const storage::FileSystemURL& url) override; |
| 63 void OnWriteEnabled(const storage::FileSystemURL& url) override; | 63 void OnWriteEnabled(const storage::FileSystemURL& url) override; |
| 64 | 64 |
| 65 // Runs the given |task| if no sync operation is running on any of | 65 // Runs the given |task| if no sync operation is running on any of |
| 66 // its target_paths(). This also runs pending tasks that have become | 66 // its target_paths(). This also runs pending tasks that have become |
| 67 // runnable (before running the given operation). | 67 // runnable (before running the given operation). |
| 68 // If there're ongoing sync tasks on the target_paths this method | 68 // If there're ongoing sync tasks on the target_paths this method |
| 69 // just queues up the |task|. | 69 // just queues up the |task|. |
| 70 // Pending tasks are cancelled when this class is destructed. | 70 // Pending tasks are cancelled when this class is destructed. |
| 71 void PostOperationTask(scoped_ptr<Task> task); | 71 void PostOperationTask(std::unique_ptr<Task> task); |
| 72 | 72 |
| 73 // Runs a next runnable task (if there's any). | 73 // Runs a next runnable task (if there's any). |
| 74 void RunNextRunnableTask(); | 74 void RunNextRunnableTask(); |
| 75 | 75 |
| 76 // Called when an operation is completed. This will make |target_paths| | 76 // Called when an operation is completed. This will make |target_paths| |
| 77 // writable and may start a next runnable task. | 77 // writable and may start a next runnable task. |
| 78 void OnOperationCompleted( | 78 void OnOperationCompleted( |
| 79 const std::vector<storage::FileSystemURL>& target_paths); | 79 const std::vector<storage::FileSystemURL>& target_paths); |
| 80 | 80 |
| 81 LocalFileSyncStatus* sync_status() const { return sync_status_; } | 81 LocalFileSyncStatus* sync_status() const { return sync_status_; } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 97 | 97 |
| 98 const int64_t max_inflight_tasks_; | 98 const int64_t max_inflight_tasks_; |
| 99 int64_t num_inflight_tasks_; | 99 int64_t num_inflight_tasks_; |
| 100 | 100 |
| 101 DISALLOW_COPY_AND_ASSIGN(SyncableFileOperationRunner); | 101 DISALLOW_COPY_AND_ASSIGN(SyncableFileOperationRunner); |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 } // namespace sync_file_system | 104 } // namespace sync_file_system |
| 105 | 105 |
| 106 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_
H_ | 106 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_OPERATION_RUNNER_
H_ |
| OLD | NEW |