| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/threading/sequenced_worker_pool.h" | 5 #include "base/threading/sequenced_worker_pool.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 SignalHasWork(); | 748 SignalHasWork(); |
| 749 delete_these_outside_lock.clear(); | 749 delete_these_outside_lock.clear(); |
| 750 | 750 |
| 751 // Complete thread creation outside the lock if necessary. | 751 // Complete thread creation outside the lock if necessary. |
| 752 if (new_thread_id) | 752 if (new_thread_id) |
| 753 FinishStartingAdditionalThread(new_thread_id); | 753 FinishStartingAdditionalThread(new_thread_id); |
| 754 | 754 |
| 755 this_worker->set_running_task_info( | 755 this_worker->set_running_task_info( |
| 756 SequenceToken(task.sequence_token_id), task.shutdown_behavior); | 756 SequenceToken(task.sequence_token_id), task.shutdown_behavior); |
| 757 | 757 |
| 758 tracked_objects::TrackedTime start_time = | 758 tracked_objects::TaskStopwatch stopwatch; |
| 759 tracked_objects::ThreadData::NowForStartOfRun(task.birth_tally); | 759 stopwatch.Start( |
| 760 tracked_objects::ThreadData::NowForStartOfRun(task.birth_tally)); |
| 761 task.task.Run(); |
| 762 stopwatch.Stop(tracked_objects::ThreadData::NowForEndOfRun()); |
| 760 | 763 |
| 761 task.task.Run(); | 764 tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking( |
| 762 | 765 task, stopwatch); |
| 763 tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking(task, | |
| 764 start_time, tracked_objects::ThreadData::NowForEndOfRun()); | |
| 765 | 766 |
| 766 // Make sure our task is erased outside the lock for the | 767 // Make sure our task is erased outside the lock for the |
| 767 // same reason we do this with delete_these_oustide_lock. | 768 // same reason we do this with delete_these_oustide_lock. |
| 768 // Also, do it before calling set_running_task_info() so | 769 // Also, do it before calling set_running_task_info() so |
| 769 // that sequence-checking from within the task's destructor | 770 // that sequence-checking from within the task's destructor |
| 770 // still works. | 771 // still works. |
| 771 task.task = Closure(); | 772 task.task = Closure(); |
| 772 | 773 |
| 773 this_worker->set_running_task_info( | 774 this_worker->set_running_task_info( |
| 774 SequenceToken(), CONTINUE_ON_SHUTDOWN); | 775 SequenceToken(), CONTINUE_ON_SHUTDOWN); |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1285 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { | 1286 void SequencedWorkerPool::Shutdown(int max_new_blocking_tasks_after_shutdown) { |
| 1286 DCHECK(constructor_message_loop_->BelongsToCurrentThread()); | 1287 DCHECK(constructor_message_loop_->BelongsToCurrentThread()); |
| 1287 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); | 1288 inner_->Shutdown(max_new_blocking_tasks_after_shutdown); |
| 1288 } | 1289 } |
| 1289 | 1290 |
| 1290 bool SequencedWorkerPool::IsShutdownInProgress() { | 1291 bool SequencedWorkerPool::IsShutdownInProgress() { |
| 1291 return inner_->IsShutdownInProgress(); | 1292 return inner_->IsShutdownInProgress(); |
| 1292 } | 1293 } |
| 1293 | 1294 |
| 1294 } // namespace base | 1295 } // namespace base |
| OLD | NEW |