Chromium Code Reviews| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 PRIORITY_MED. |
| 60 void ScheduleTask(const Task& task, | 60 void ScheduleTask(const tracked_objects::Location& from_here, |
| 61 const Task& task, | |
| 61 const SyncStatusCallback& callback); | 62 const SyncStatusCallback& callback); |
| 62 void ScheduleSyncTask(scoped_ptr<SyncTask> task, | 63 void ScheduleSyncTask(const tracked_objects::Location& from_here, |
| 64 scoped_ptr<SyncTask> task, | |
| 63 const SyncStatusCallback& callback); | 65 const SyncStatusCallback& callback); |
| 64 | 66 |
| 65 // Schedules a task at the given priority. | 67 // Schedules a task at the given priority. |
| 66 void ScheduleTaskAtPriority(const Task& task, | 68 void ScheduleTaskAtPriority(const tracked_objects::Location& from_here, |
| 69 const Task& task, | |
| 67 Priority priority, | 70 Priority priority, |
| 68 const SyncStatusCallback& callback); | 71 const SyncStatusCallback& callback); |
| 69 void ScheduleSyncTaskAtPriority(scoped_ptr<SyncTask> task, | 72 void ScheduleSyncTaskAtPriority(const tracked_objects::Location& from_here, |
| 73 scoped_ptr<SyncTask> task, | |
| 70 Priority priority, | 74 Priority priority, |
| 71 const SyncStatusCallback& callback); | 75 const SyncStatusCallback& callback); |
| 72 | 76 |
| 73 // Runs the posted task only when we're idle. Returns true if tha task is | 77 // Runs the posted task only when we're idle. Returns true if tha task is |
| 74 // scheduled. | 78 // scheduled. |
| 75 bool ScheduleTaskIfIdle(const Task& task, const SyncStatusCallback& callback); | 79 bool ScheduleTaskIfIdle(const tracked_objects::Location& from_here, |
| 76 bool ScheduleSyncTaskIfIdle(scoped_ptr<SyncTask> task, | 80 const Task& task, const SyncStatusCallback& callback); |
|
nhiroki
2014/03/07 07:12:03
style-nit: can you add a line-break between "task"
tzik
2014/03/07 09:38:11
Done.
| |
| 81 bool ScheduleSyncTaskIfIdle(const tracked_objects::Location& from_here, | |
| 82 scoped_ptr<SyncTask> task, | |
| 77 const SyncStatusCallback& callback); | 83 const SyncStatusCallback& callback); |
| 78 | 84 |
| 79 void NotifyTaskDone(scoped_ptr<TaskToken> token, | 85 void NotifyTaskDone(scoped_ptr<TaskToken> token, |
| 80 SyncStatusCode status); | 86 SyncStatusCode status); |
| 81 | 87 |
| 82 private: | 88 private: |
| 83 struct PendingTask { | 89 struct PendingTask { |
| 84 base::Closure task; | 90 base::Closure task; |
| 85 Priority priority; | 91 Priority priority; |
| 86 int64 seq; | 92 int64 seq; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 // until it finished. And the task must return the instance through | 128 // until it finished. And the task must return the instance through |
| 123 // NotifyTaskDone when the task finished. | 129 // NotifyTaskDone when the task finished. |
| 124 scoped_ptr<TaskToken> token_; | 130 scoped_ptr<TaskToken> token_; |
| 125 | 131 |
| 126 DISALLOW_COPY_AND_ASSIGN(SyncTaskManager); | 132 DISALLOW_COPY_AND_ASSIGN(SyncTaskManager); |
| 127 }; | 133 }; |
| 128 | 134 |
| 129 } // namespace sync_file_system | 135 } // namespace sync_file_system |
| 130 | 136 |
| 131 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_TASK_MANAGER_H_ | 137 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_TASK_MANAGER_H_ |
| OLD | NEW |