OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_DRIVE_BACKEND_SYNC_TASK_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_MANAGER_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_MANAGER_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_MANAGER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <queue> | 12 #include <queue> |
| 13 #include <unordered_map> |
13 #include <vector> | 14 #include <vector> |
14 | 15 |
15 #include "base/callback.h" | 16 #include "base/callback.h" |
16 #include "base/containers/scoped_ptr_hash_map.h" | |
17 #include "base/macros.h" | 17 #include "base/macros.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/sequence_checker.h" | 19 #include "base/sequence_checker.h" |
20 #include "base/threading/sequenced_worker_pool.h" | 20 #include "base/threading/sequenced_worker_pool.h" |
21 #include "chrome/browser/sync_file_system/drive_backend/task_dependency_manager.
h" | 21 #include "chrome/browser/sync_file_system/drive_backend/task_dependency_manager.
h" |
22 #include "chrome/browser/sync_file_system/sync_callbacks.h" | 22 #include "chrome/browser/sync_file_system/sync_callbacks.h" |
23 #include "chrome/browser/sync_file_system/sync_status_code.h" | 23 #include "chrome/browser/sync_file_system/sync_status_code.h" |
24 #include "chrome/browser/sync_file_system/task_logger.h" | 24 #include "chrome/browser/sync_file_system/task_logger.h" |
25 | 25 |
26 namespace base { | 26 namespace base { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 // If |token| is non-nullptr, put |token| back to |token_| beforehand. | 179 // If |token| is non-nullptr, put |token| back to |token_| beforehand. |
180 void MaybeStartNextForegroundTask(std::unique_ptr<SyncTaskToken> token); | 180 void MaybeStartNextForegroundTask(std::unique_ptr<SyncTaskToken> token); |
181 | 181 |
182 base::WeakPtr<Client> client_; | 182 base::WeakPtr<Client> client_; |
183 | 183 |
184 // Owns running SyncTask to cancel the task on SyncTaskManager deletion. | 184 // Owns running SyncTask to cancel the task on SyncTaskManager deletion. |
185 std::unique_ptr<SyncTask> running_foreground_task_; | 185 std::unique_ptr<SyncTask> running_foreground_task_; |
186 | 186 |
187 // Owns running backgrounded SyncTask to cancel the task on SyncTaskManager | 187 // Owns running backgrounded SyncTask to cancel the task on SyncTaskManager |
188 // deletion. | 188 // deletion. |
189 base::ScopedPtrHashMap<int64_t, std::unique_ptr<SyncTask>> | 189 std::unordered_map<int64_t, std::unique_ptr<SyncTask>> |
190 running_background_tasks_; | 190 running_background_tasks_; |
191 | 191 |
192 size_t maximum_background_task_; | 192 size_t maximum_background_task_; |
193 | 193 |
194 // Holds pending continuation to move task to background. | 194 // Holds pending continuation to move task to background. |
195 base::Closure pending_backgrounding_task_; | 195 base::Closure pending_backgrounding_task_; |
196 | 196 |
197 std::priority_queue<PendingTask, std::vector<PendingTask>, | 197 std::priority_queue<PendingTask, std::vector<PendingTask>, |
198 PendingTaskComparator> pending_tasks_; | 198 PendingTaskComparator> pending_tasks_; |
199 int64_t pending_task_seq_; | 199 int64_t pending_task_seq_; |
(...skipping 14 matching lines...) Expand all Loading... |
214 | 214 |
215 base::WeakPtrFactory<SyncTaskManager> weak_ptr_factory_; | 215 base::WeakPtrFactory<SyncTaskManager> weak_ptr_factory_; |
216 | 216 |
217 DISALLOW_COPY_AND_ASSIGN(SyncTaskManager); | 217 DISALLOW_COPY_AND_ASSIGN(SyncTaskManager); |
218 }; | 218 }; |
219 | 219 |
220 } // namespace drive_backend | 220 } // namespace drive_backend |
221 } // namespace sync_file_system | 221 } // namespace sync_file_system |
222 | 222 |
223 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_MANAGER_H_ | 223 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_BACKEND_SYNC_TASK_MANAGER_H_ |
OLD | NEW |