Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: sync/internal_api/public/attachments/task_queue.h

Issue 1539843002: Convert Pass()→std::move() in sync/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 #include <utility>
10 11
11 #include "base/bind.h" 12 #include "base/bind.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
16 #include "base/threading/non_thread_safe.h" 17 #include "base/threading/non_thread_safe.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "base/timer/timer.h" 19 #include "base/timer/timer.h"
19 #include "net/base/backoff_entry.h" 20 #include "net/base/backoff_entry.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 void TaskQueue<T>::ResetBackoff() { 227 void TaskQueue<T>::ResetBackoff() {
227 backoff_timer_->Stop(); 228 backoff_timer_->Stop();
228 backoff_entry_->Reset(); 229 backoff_entry_->Reset();
229 ScheduleDispatch(); 230 ScheduleDispatch();
230 } 231 }
231 232
232 template <typename T> 233 template <typename T>
233 void TaskQueue<T>::SetTimerForTest(scoped_ptr<base::Timer> timer) { 234 void TaskQueue<T>::SetTimerForTest(scoped_ptr<base::Timer> timer) {
234 DCHECK(CalledOnValidThread()); 235 DCHECK(CalledOnValidThread());
235 DCHECK(timer.get()); 236 DCHECK(timer.get());
236 backoff_timer_ = timer.Pass(); 237 backoff_timer_ = std::move(timer);
237 } 238 }
238 239
239 template <typename T> 240 template <typename T>
240 void TaskQueue<T>::FinishTask(const T& task) { 241 void TaskQueue<T>::FinishTask(const T& task) {
241 DCHECK(CalledOnValidThread()); 242 DCHECK(CalledOnValidThread());
242 DCHECK_GE(num_in_progress_, 1); 243 DCHECK_GE(num_in_progress_, 1);
243 --num_in_progress_; 244 --num_in_progress_;
244 const size_t num_erased = tasks_.erase(task); 245 const size_t num_erased = tasks_.erase(task);
245 DCHECK_EQ(1U, num_erased); 246 DCHECK_EQ(1U, num_erased);
246 } 247 }
(...skipping 26 matching lines...) Expand all
273 } 274 }
274 275
275 template <typename T> 276 template <typename T>
276 bool TaskQueue<T>::ShouldDispatch() { 277 bool TaskQueue<T>::ShouldDispatch() {
277 return num_in_progress_ < kMaxConcurrentTasks && !queue_.empty(); 278 return num_in_progress_ < kMaxConcurrentTasks && !queue_.empty();
278 } 279 }
279 280
280 } // namespace syncer 281 } // namespace syncer
281 282
282 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_TASK_QUEUE_H_ 283 #endif // SYNC_INTERNAL_API_PUBLIC_ATTACHMENTS_TASK_QUEUE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698