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

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

Issue 8463004: A couple comment updates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jar comments 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.h ('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) 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 #include "base/threading/worker_pool_posix.h" 5 #include "base/threading/worker_pool_posix.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 private: 71 private:
72 const std::string name_prefix_; 72 const std::string name_prefix_;
73 scoped_refptr<base::PosixDynamicThreadPool> pool_; 73 scoped_refptr<base::PosixDynamicThreadPool> pool_;
74 74
75 DISALLOW_COPY_AND_ASSIGN(WorkerThread); 75 DISALLOW_COPY_AND_ASSIGN(WorkerThread);
76 }; 76 };
77 77
78 void WorkerThread::ThreadMain() { 78 void WorkerThread::ThreadMain() {
79 const std::string name = base::StringPrintf( 79 const std::string name = base::StringPrintf(
80 "%s/%d", name_prefix_.c_str(), PlatformThread::CurrentId()); 80 "%s/%d", name_prefix_.c_str(), PlatformThread::CurrentId());
81 // Note |name.c_str()| must remain valid for for the whole life of the thread.
81 PlatformThread::SetName(name.c_str()); 82 PlatformThread::SetName(name.c_str());
82 83
83 for (;;) { 84 for (;;) {
84 PosixDynamicThreadPool::PendingTask pending_task = pool_->WaitForTask(); 85 PosixDynamicThreadPool::PendingTask pending_task = pool_->WaitForTask();
85 if (pending_task.task.is_null()) 86 if (pending_task.task.is_null())
86 break; 87 break;
87 UNSHIPPED_TRACE_EVENT2("task", "WorkerThread::ThreadMain::Run", 88 UNSHIPPED_TRACE_EVENT2("task", "WorkerThread::ThreadMain::Run",
88 "src_file", pending_task.posted_from.file_name(), 89 "src_file", pending_task.posted_from.file_name(),
89 "src_func", pending_task.posted_from.function_name()); 90 "src_func", pending_task.posted_from.function_name());
90 91
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return PendingTask(FROM_HERE, base::Closure()); 218 return PendingTask(FROM_HERE, base::Closure());
218 } 219 }
219 } 220 }
220 221
221 PendingTask pending_task = pending_tasks_.front(); 222 PendingTask pending_task = pending_tasks_.front();
222 pending_tasks_.pop(); 223 pending_tasks_.pop();
223 return pending_task; 224 return pending_task;
224 } 225 }
225 226
226 } // namespace base 227 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/thread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698