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

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

Issue 8548005: Adjust interfaces to indicate when tracking is in progress (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
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 for (;;) { 84 for (;;) {
85 PosixDynamicThreadPool::PendingTask pending_task = pool_->WaitForTask(); 85 PosixDynamicThreadPool::PendingTask pending_task = pool_->WaitForTask();
86 if (pending_task.task.is_null()) 86 if (pending_task.task.is_null())
87 break; 87 break;
88 UNSHIPPED_TRACE_EVENT2("task", "WorkerThread::ThreadMain::Run", 88 UNSHIPPED_TRACE_EVENT2("task", "WorkerThread::ThreadMain::Run",
89 "src_file", pending_task.posted_from.file_name(), 89 "src_file", pending_task.posted_from.file_name(),
90 "src_func", pending_task.posted_from.function_name()); 90 "src_func", pending_task.posted_from.function_name());
91 91
92 tracked_objects::TrackedTime start_time = 92 tracked_objects::TrackedTime start_time =
93 tracked_objects::ThreadData::Now(); 93 tracked_objects::ThreadData::NowForStartOfRun();
94 94
95 pending_task.task.Run(); 95 pending_task.task.Run();
96 96
97 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking( 97 tracked_objects::ThreadData::TallyRunOnWorkerThreadIfTracking(
98 pending_task.birth_tally, pending_task.time_posted, 98 pending_task.birth_tally, pending_task.time_posted,
99 start_time, tracked_objects::ThreadData::Now()); 99 start_time, tracked_objects::ThreadData::NowForEndOfRun());
100 } 100 }
101 101
102 // The WorkerThread is non-joinable, so it deletes itself. 102 // The WorkerThread is non-joinable, so it deletes itself.
103 delete this; 103 delete this;
104 } 104 }
105 105
106 } // namespace 106 } // namespace
107 107
108 bool WorkerPool::PostTask(const tracked_objects::Location& from_here, 108 bool WorkerPool::PostTask(const tracked_objects::Location& from_here,
109 Task* task, bool task_is_slow) { 109 Task* task, bool task_is_slow) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return PendingTask(FROM_HERE, base::Closure()); 218 return PendingTask(FROM_HERE, base::Closure());
219 } 219 }
220 } 220 }
221 221
222 PendingTask pending_task = pending_tasks_.front(); 222 PendingTask pending_task = pending_tasks_.front();
223 pending_tasks_.pop(); 223 pending_tasks_.pop();
224 return pending_task; 224 return pending_task;
225 } 225 }
226 226
227 } // namespace base 227 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698