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

Side by Side Diff: base/task_scheduler/scheduler_worker.cc

Issue 2122543002: Replace Closure in TaskRunner::PostTask with OneShotCallback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@07_oneshot
Patch Set: fix Created 4 years, 3 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 | « base/task_scheduler/post_task.cc ('k') | base/task_scheduler/scheduler_worker_pool_impl.cc » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/task_scheduler/scheduler_worker.h" 5 #include "base/task_scheduler/scheduler_worker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 DCHECK_EQ(detached_thread.get(), this); 63 DCHECK_EQ(detached_thread.get(), this);
64 PlatformThread::Detach(thread_handle_); 64 PlatformThread::Detach(thread_handle_);
65 outer_ = nullptr; 65 outer_ = nullptr;
66 break; 66 break;
67 } 67 }
68 } 68 }
69 WaitForWork(); 69 WaitForWork();
70 continue; 70 continue;
71 } 71 }
72 72
73 const Task* task = sequence->PeekTask(); 73 Task* task = sequence->PeekTask();
74 const TimeTicks start_time = TimeTicks::Now(); 74 const TimeTicks start_time = TimeTicks::Now();
75 if (outer_->task_tracker_->RunTask(task, sequence->token())) 75 if (outer_->task_tracker_->RunTask(task, sequence->token()))
76 outer_->delegate_->DidRunTask(task, start_time - task->sequenced_time); 76 outer_->delegate_->DidRunTask(task, start_time - task->sequenced_time);
77 77
78 const bool sequence_became_empty = sequence->PopTask(); 78 const bool sequence_became_empty = sequence->PopTask();
79 79
80 // If |sequence| isn't empty immediately after the pop, re-enqueue it to 80 // If |sequence| isn't empty immediately after the pop, re-enqueue it to
81 // maintain the invariant that a non-empty Sequence is always referenced 81 // maintain the invariant that a non-empty Sequence is always referenced
82 // by either a PriorityQueue or a SchedulerWorker. If it is empty 82 // by either a PriorityQueue or a SchedulerWorker. If it is empty
83 // and there are live references to it, it will be enqueued when a Task is 83 // and there are live references to it, it will be enqueued when a Task is
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 CreateThread(); 269 CreateThread();
270 } 270 }
271 271
272 bool SchedulerWorker::ShouldExitForTesting() const { 272 bool SchedulerWorker::ShouldExitForTesting() const {
273 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_); 273 AutoSchedulerLock auto_lock(should_exit_for_testing_lock_);
274 return should_exit_for_testing_; 274 return should_exit_for_testing_;
275 } 275 }
276 276
277 } // namespace internal 277 } // namespace internal
278 } // namespace base 278 } // namespace base
OLDNEW
« no previous file with comments | « base/task_scheduler/post_task.cc ('k') | base/task_scheduler/scheduler_worker_pool_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698