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

Side by Side Diff: base/threading/worker_pool_posix.h

Issue 8429009: Enable tracking of objects by default (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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
« no previous file with comments | « base/threading/thread.cc ('k') | base/threading/worker_pool_posix.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // The thread pool used in the POSIX implementation of WorkerPool dynamically 5 // The thread pool used in the POSIX implementation of WorkerPool dynamically
6 // adds threads as necessary to handle all tasks. It keeps old threads around 6 // adds threads as necessary to handle all tasks. It keeps old threads around
7 // for a period of time to allow them to be reused. After this waiting period, 7 // for a period of time to allow them to be reused. After this waiting period,
8 // the threads exit. This thread pool uses non-joinable threads, therefore 8 // the threads exit. This thread pool uses non-joinable threads, therefore
9 // worker threads are not joined during process shutdown. This means that 9 // worker threads are not joined during process shutdown. This means that
10 // potentially long running tasks (such as DNS lookup) do not block process 10 // potentially long running tasks (such as DNS lookup) do not block process
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class BASE_EXPORT PosixDynamicThreadPool 46 class BASE_EXPORT PosixDynamicThreadPool
47 : public RefCountedThreadSafe<PosixDynamicThreadPool> { 47 : public RefCountedThreadSafe<PosixDynamicThreadPool> {
48 public: 48 public:
49 class PosixDynamicThreadPoolPeer; 49 class PosixDynamicThreadPoolPeer;
50 50
51 struct PendingTask { 51 struct PendingTask {
52 PendingTask(const tracked_objects::Location& posted_from, 52 PendingTask(const tracked_objects::Location& posted_from,
53 const base::Closure& task); 53 const base::Closure& task);
54 ~PendingTask(); 54 ~PendingTask();
55 55
56 #if defined(TRACK_ALL_TASK_OBJECTS)
57 // Counter for location where the Closure was posted from. 56 // Counter for location where the Closure was posted from.
58 tracked_objects::Births* post_births; 57 tracked_objects::Births* birth_tally;
59 58
60 // Time the task was posted. 59 // Time the task was posted.
61 TimeTicks time_posted; 60 tracked_objects::TrackedTime time_posted;
62 #endif // defined(TRACK_ALL_TASK_OBJECTS)
63 61
64 const tracked_objects::Location posted_from; 62 const tracked_objects::Location posted_from;
65 63
66 // The task to run. 64 // The task to run.
67 base::Closure task; 65 base::Closure task;
68 }; 66 };
69 67
70 // All worker threads will share the same |name_prefix|. They will exit after 68 // All worker threads will share the same |name_prefix|. They will exit after
71 // |idle_seconds_before_exit|. 69 // |idle_seconds_before_exit|.
72 PosixDynamicThreadPool(const std::string& name_prefix, 70 PosixDynamicThreadPool(const std::string& name_prefix,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // Only used for tests to ensure correct thread ordering. It will always be 112 // Only used for tests to ensure correct thread ordering. It will always be
115 // NULL in non-test code. 113 // NULL in non-test code.
116 scoped_ptr<ConditionVariable> num_idle_threads_cv_; 114 scoped_ptr<ConditionVariable> num_idle_threads_cv_;
117 115
118 DISALLOW_COPY_AND_ASSIGN(PosixDynamicThreadPool); 116 DISALLOW_COPY_AND_ASSIGN(PosixDynamicThreadPool);
119 }; 117 };
120 118
121 } // namespace base 119 } // namespace base
122 120
123 #endif // BASE_THREADING_WORKER_POOL_POSIX_H_ 121 #endif // BASE_THREADING_WORKER_POOL_POSIX_H_
OLDNEW
« no previous file with comments | « base/threading/thread.cc ('k') | base/threading/worker_pool_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698