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

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

Issue 1124563003: Revert some other possible suspects of a 0.43% size increase of setup.exe: https://build.chromium.o… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « base/threading/watchdog.cc ('k') | base/trace_event/trace_event.h » ('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) 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/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/callback.h" 8 #include "base/callback.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 scoped_refptr<base::PosixDynamicThreadPool> pool_; 70 scoped_refptr<base::PosixDynamicThreadPool> pool_;
71 71
72 DISALLOW_COPY_AND_ASSIGN(WorkerThread); 72 DISALLOW_COPY_AND_ASSIGN(WorkerThread);
73 }; 73 };
74 74
75 void WorkerThread::ThreadMain() { 75 void WorkerThread::ThreadMain() {
76 g_worker_pool_running_on_this_thread.Get().Set(true); 76 g_worker_pool_running_on_this_thread.Get().Set(true);
77 const std::string name = base::StringPrintf( 77 const std::string name = base::StringPrintf(
78 "%s/%d", name_prefix_.c_str(), PlatformThread::CurrentId()); 78 "%s/%d", name_prefix_.c_str(), PlatformThread::CurrentId());
79 // Note |name.c_str()| must remain valid for for the whole life of the thread. 79 // Note |name.c_str()| must remain valid for for the whole life of the thread.
80 PlatformThread::SetName(name); 80 PlatformThread::SetName(name.c_str());
81 81
82 for (;;) { 82 for (;;) {
83 PendingTask pending_task = pool_->WaitForTask(); 83 PendingTask pending_task = pool_->WaitForTask();
84 if (pending_task.task.is_null()) 84 if (pending_task.task.is_null())
85 break; 85 break;
86 TRACE_EVENT2("toplevel", "WorkerThread::ThreadMain::Run", 86 TRACE_EVENT2("toplevel", "WorkerThread::ThreadMain::Run",
87 "src_file", pending_task.posted_from.file_name(), 87 "src_file", pending_task.posted_from.file_name(),
88 "src_func", pending_task.posted_from.function_name()); 88 "src_func", pending_task.posted_from.function_name());
89 89
90 tracked_objects::TaskStopwatch stopwatch; 90 tracked_objects::TaskStopwatch stopwatch;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 return PendingTask(FROM_HERE, base::Closure()); 184 return PendingTask(FROM_HERE, base::Closure());
185 } 185 }
186 } 186 }
187 187
188 PendingTask pending_task = pending_tasks_.front(); 188 PendingTask pending_task = pending_tasks_.front();
189 pending_tasks_.pop(); 189 pending_tasks_.pop();
190 return pending_task; 190 return pending_task;
191 } 191 }
192 192
193 } // namespace base 193 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/watchdog.cc ('k') | base/trace_event/trace_event.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698