| 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 SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_TASK_QUEUE_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_TASK_QUEUE_H_ |
| 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_TASK_QUEUE_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_TASK_QUEUE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 |
| 9 #include <deque> | 10 #include <deque> |
| 10 #include <set> | 11 #include <set> |
| 11 #include <utility> | 12 #include <utility> |
| 12 | 13 |
| 13 #include "base/bind.h" | 14 #include "base/bind.h" |
| 14 #include "base/callback.h" | 15 #include "base/callback.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
| 17 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
| 18 #include "base/threading/non_thread_safe.h" | 20 #include "base/threading/non_thread_safe.h" |
| 19 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 20 #include "base/timer/timer.h" | 22 #include "base/timer/timer.h" |
| 21 #include "net/base/backoff_entry.h" | 23 #include "net/base/backoff_entry.h" |
| 22 | 24 |
| 23 namespace syncer { | 25 namespace syncer { |
| 24 | 26 |
| 25 // A queue that dispatches tasks, ignores duplicates, and provides backoff | 27 // A queue that dispatches tasks, ignores duplicates, and provides backoff |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 } | 277 } |
| 276 | 278 |
| 277 template <typename T> | 279 template <typename T> |
| 278 bool TaskQueue<T>::ShouldDispatch() { | 280 bool TaskQueue<T>::ShouldDispatch() { |
| 279 return num_in_progress_ < kMaxConcurrentTasks && !queue_.empty(); | 281 return num_in_progress_ < kMaxConcurrentTasks && !queue_.empty(); |
| 280 } | 282 } |
| 281 | 283 |
| 282 } // namespace syncer | 284 } // namespace syncer |
| 283 | 285 |
| 284 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_TASK_QUEUE_H_ | 286 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_TASK_QUEUE_H_ |
| OLD | NEW |