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

Side by Side Diff: base/worker_pool_linux.cc

Issue 3119022: Header cleanup in base.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 4 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
« base/tracked.cc ('K') | « base/win_util_unittest.cc ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/worker_pool.h" 5 #include "base/worker_pool.h"
6 #include "base/worker_pool_linux.h" 6 #include "base/worker_pool_linux.h"
7 7
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/platform_thread.h" 10 #include "base/platform_thread.h"
11 #include "base/ref_counted.h" 11 #include "base/ref_counted.h"
12 #include "base/string_util.h" 12 #include "base/stringprintf.h"
13 #include "base/task.h" 13 #include "base/task.h"
14 14
15 namespace { 15 namespace {
16 16
17 const int kIdleSecondsBeforeExit = 10 * 60; 17 const int kIdleSecondsBeforeExit = 10 * 60;
18 // A stack size of 64 KB is too small for the CERT_PKIXVerifyCert 18 // A stack size of 64 KB is too small for the CERT_PKIXVerifyCert
19 // function of NSS because of NSS bug 439169. 19 // function of NSS because of NSS bug 439169.
20 const int kWorkerThreadStackSize = 128 * 1024; 20 const int kWorkerThreadStackSize = 128 * 1024;
21 21
22 class WorkerPoolImpl { 22 class WorkerPoolImpl {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 private: 60 private:
61 const std::string name_prefix_; 61 const std::string name_prefix_;
62 const int idle_seconds_before_exit_; 62 const int idle_seconds_before_exit_;
63 scoped_refptr<base::LinuxDynamicThreadPool> pool_; 63 scoped_refptr<base::LinuxDynamicThreadPool> pool_;
64 64
65 DISALLOW_COPY_AND_ASSIGN(WorkerThread); 65 DISALLOW_COPY_AND_ASSIGN(WorkerThread);
66 }; 66 };
67 67
68 void WorkerThread::ThreadMain() { 68 void WorkerThread::ThreadMain() {
69 const std::string name = 69 const std::string name = base::StringPrintf(
70 StringPrintf("%s/%d", name_prefix_.c_str(), PlatformThread::CurrentId()); 70 "%s/%d", name_prefix_.c_str(), PlatformThread::CurrentId());
71 PlatformThread::SetName(name.c_str()); 71 PlatformThread::SetName(name.c_str());
72 72
73 for (;;) { 73 for (;;) {
74 Task* task = pool_->WaitForTask(); 74 Task* task = pool_->WaitForTask();
75 if (!task) 75 if (!task)
76 break; 76 break;
77 task->Run(); 77 task->Run();
78 delete task; 78 delete task;
79 } 79 }
80 80
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return NULL; 159 return NULL;
160 } 160 }
161 } 161 }
162 162
163 Task* task = tasks_.front(); 163 Task* task = tasks_.front();
164 tasks_.pop(); 164 tasks_.pop();
165 return task; 165 return task;
166 } 166 }
167 167
168 } // namespace base 168 } // namespace base
OLDNEW
« base/tracked.cc ('K') | « base/win_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698