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

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: mac test fix Created 4 years, 5 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
« no previous file with comments | « components/scheduler/base/task_queue_impl.cc ('k') | components/scheduler/base/work_queue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 297
298 currently_executing_task_queue_ = prev_executing_task_queue; 298 currently_executing_task_queue_ = prev_executing_task_queue;
299 299
300 if (queue->GetShouldNotifyObservers()) { 300 if (queue->GetShouldNotifyObservers()) {
301 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_, 301 FOR_EACH_OBSERVER(base::MessageLoop::TaskObserver, task_observers_,
302 DidProcessTask(pending_task)); 302 DidProcessTask(pending_task));
303 queue->NotifyDidProcessTask(pending_task); 303 queue->NotifyDidProcessTask(pending_task);
304 } 304 }
305 305
306 pending_task.task.Reset(); 306 pending_task.task.Reset();
307 *out_previous_task = pending_task; 307 *out_previous_task = std::move(pending_task);
308 return ProcessTaskResult::EXECUTED; 308 return ProcessTaskResult::EXECUTED;
309 } 309 }
310 310
311 void TaskQueueManager::MaybeRecordTaskDelayHistograms( 311 void TaskQueueManager::MaybeRecordTaskDelayHistograms(
312 const internal::TaskQueueImpl::Task& pending_task, 312 const internal::TaskQueueImpl::Task& pending_task,
313 const internal::TaskQueueImpl* queue) { 313 const internal::TaskQueueImpl* queue) {
314 if ((task_count_++ % kRecordRecordTaskDelayHistogramsEveryNTasks) != 0) 314 if ((task_count_++ % kRecordRecordTaskDelayHistogramsEveryNTasks) != 0)
315 return; 315 return;
316 316
317 // Record delayed task lateness and immediate task queueing durations, but 317 // Record delayed task lateness and immediate task queueing durations, but
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 internal::WorkQueue* work_queue) { 409 internal::WorkQueue* work_queue) {
410 DCHECK(main_thread_checker_.CalledOnValidThread()); 410 DCHECK(main_thread_checker_.CalledOnValidThread());
411 DCHECK(!work_queue->Empty()); 411 DCHECK(!work_queue->Empty());
412 if (observer_) { 412 if (observer_) {
413 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(), 413 observer_->OnTriedToExecuteBlockedTask(*work_queue->task_queue(),
414 *work_queue->GetFrontTask()); 414 *work_queue->GetFrontTask());
415 } 415 }
416 } 416 }
417 417
418 } // namespace scheduler 418 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/base/task_queue_impl.cc ('k') | components/scheduler/base/work_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698