| 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_SYNC_TASK_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_TASK_MANAGER_H_ |
| 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_TASK_MANAGER_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_TASK_MANAGER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 explicit SyncTaskManager(base::WeakPtr<Client> client); | 51 explicit SyncTaskManager(base::WeakPtr<Client> client); |
| 52 virtual ~SyncTaskManager(); | 52 virtual ~SyncTaskManager(); |
| 53 | 53 |
| 54 // This needs to be called to start task scheduling. | 54 // This needs to be called to start task scheduling. |
| 55 // If |status| is not SYNC_STATUS_OK calling this may change the | 55 // If |status| is not SYNC_STATUS_OK calling this may change the |
| 56 // service status. This should not be called more than once. | 56 // service status. This should not be called more than once. |
| 57 void Initialize(SyncStatusCode status); | 57 void Initialize(SyncStatusCode status); |
| 58 | 58 |
| 59 // Schedules a task at PRIORITY_MED. | 59 // Schedules a task at the given priority. |
| 60 void ScheduleTask(const tracked_objects::Location& from_here, | 60 void ScheduleTask(const tracked_objects::Location& from_here, |
| 61 const Task& task, | 61 const Task& task, |
| 62 Priority priority, |
| 62 const SyncStatusCallback& callback); | 63 const SyncStatusCallback& callback); |
| 63 void ScheduleSyncTask(const tracked_objects::Location& from_here, | 64 void ScheduleSyncTask(const tracked_objects::Location& from_here, |
| 64 scoped_ptr<SyncTask> task, | 65 scoped_ptr<SyncTask> task, |
| 66 Priority priority, |
| 65 const SyncStatusCallback& callback); | 67 const SyncStatusCallback& callback); |
| 66 | 68 |
| 67 // Schedules a task at the given priority. | |
| 68 void ScheduleTaskAtPriority(const tracked_objects::Location& from_here, | |
| 69 const Task& task, | |
| 70 Priority priority, | |
| 71 const SyncStatusCallback& callback); | |
| 72 void ScheduleSyncTaskAtPriority(const tracked_objects::Location& from_here, | |
| 73 scoped_ptr<SyncTask> task, | |
| 74 Priority priority, | |
| 75 const SyncStatusCallback& callback); | |
| 76 | |
| 77 // Runs the posted task only when we're idle. Returns true if tha task is | 69 // Runs the posted task only when we're idle. Returns true if tha task is |
| 78 // scheduled. | 70 // scheduled. |
| 79 bool ScheduleTaskIfIdle(const tracked_objects::Location& from_here, | 71 bool ScheduleTaskIfIdle(const tracked_objects::Location& from_here, |
| 80 const Task& task, | 72 const Task& task, |
| 81 const SyncStatusCallback& callback); | 73 const SyncStatusCallback& callback); |
| 82 bool ScheduleSyncTaskIfIdle(const tracked_objects::Location& from_here, | 74 bool ScheduleSyncTaskIfIdle(const tracked_objects::Location& from_here, |
| 83 scoped_ptr<SyncTask> task, | 75 scoped_ptr<SyncTask> task, |
| 84 const SyncStatusCallback& callback); | 76 const SyncStatusCallback& callback); |
| 85 | 77 |
| 86 void NotifyTaskDone(scoped_ptr<TaskToken> token, | 78 void NotifyTaskDone(scoped_ptr<TaskToken> token, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // until it finished. And the task must return the instance through | 121 // until it finished. And the task must return the instance through |
| 130 // NotifyTaskDone when the task finished. | 122 // NotifyTaskDone when the task finished. |
| 131 scoped_ptr<TaskToken> token_; | 123 scoped_ptr<TaskToken> token_; |
| 132 | 124 |
| 133 DISALLOW_COPY_AND_ASSIGN(SyncTaskManager); | 125 DISALLOW_COPY_AND_ASSIGN(SyncTaskManager); |
| 134 }; | 126 }; |
| 135 | 127 |
| 136 } // namespace sync_file_system | 128 } // namespace sync_file_system |
| 137 | 129 |
| 138 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_TASK_MANAGER_H_ | 130 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_TASK_MANAGER_H_ |
| OLD | NEW |