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

Side by Side Diff: base/threading/sequenced_worker_pool.cc

Issue 445413003: Creating a framework for suppressing pollution of the profiler data (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clarifying terminology Created 6 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 | Annotate | Revision Log
OLDNEW
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
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));
jar (doing other things) 2014/09/02 16:52:16 The reason there is an API called NowForStartOfRun
vadimt 2014/09/02 22:41:37 Done.
761 task.task.Run();
762 stopwatch.Stop(tracked_objects::ThreadData::NowForEndOfRun());
jar (doing other things) 2014/09/02 16:52:16 This call can then be simply: stopwatch.Stop(); I
vadimt 2014/09/02 22:41:37 Done. Given that there are 3 methods that can foll
760 763
761 task.task.Run(); 764 tracked_objects::ThreadData::TallyRunOnNamedThreadIfTracking(
762 765 task, stopwatch);
jar (doing other things) 2014/09/02 16:52:16 If you're willing to embed the Stop() into the abo
vadimt 2014/09/02 22:41:36 See the above answer.
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698