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

Side by Side Diff: components/scheduler/base/task_queue_manager.cc

Issue 1886453003: Make PendingTask move-only and pass it by value on retaining params (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months 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 #include "components/scheduler/base/task_queue_manager.h" 5 #include "components/scheduler/base/task_queue_manager.h"
6 6
7 #include <queue> 7 #include <queue>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 295
296 currently_executing_task_queue_ = prev_executing_task_queue; 296 currently_executing_task_queue_ = prev_executing_task_queue;
297 297
298 if (queue->GetShouldNotifyObservers()) { 298 if (queue->GetShouldNotifyObservers()) {
299 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, 299 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_,
300 DidProcessTask(pending_task)); 300 DidProcessTask(pending_task));
301 queue->NotifyDidProcessTask(pending_task); 301 queue->NotifyDidProcessTask(pending_task);
302 } 302 }
303 303
304 pending_task.task.Reset(); 304 pending_task.task.Reset();
305 *out_previous_task = pending_task; 305 *out_previous_task = std::move(pending_task);
306 return ProcessTaskResult::EXECUTED; 306 return ProcessTaskResult::EXECUTED;
307 } 307 }
308 308
309 void TaskQueueManager::MaybeRecordTaskDelayHistograms( 309 void TaskQueueManager::MaybeRecordTaskDelayHistograms(
310 const internal::TaskQueueImpl::Task& pending_task, 310 const internal::TaskQueueImpl::Task& pending_task,
311 const internal::TaskQueueImpl* queue) { 311 const internal::TaskQueueImpl* queue) {
312 if ((task_count_++ % kRecordRecordTaskDelayHistogramsEveryNTasks) != 0) 312 if ((task_count_++ % kRecordRecordTaskDelayHistogramsEveryNTasks) != 0)
313 return; 313 return;
314 314
315 // Record delayed task lateness and immediate task queueing durations, but 315 // Record delayed task lateness and immediate task queueing durations, but
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 internal::WorkQueue* work_queue) { 407 internal::WorkQueue* work_queue) {
408 DCHECK(main_thread_checker_.CalledOnValidThread()); 408 DCHECK(main_thread_checker_.CalledOnValidThread());
409 DCHECK(!work_queue->Empty()); 409 DCHECK(!work_queue->Empty());
410 if (observer_) { 410 if (observer_) {
411 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), 411 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(),
412 *work_queue->GetFrontTask()); 412 *work_queue->GetFrontTask());
413 } 413 }
414 } 414 }
415 415
416 } // namespace scheduler 416 } // namespace scheduler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698