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

Unified Diff: content/renderer/raster_worker_pool.cc

Issue 1830693004: content: Depict priority in raster worker thread's name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/raster_worker_pool.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/raster_worker_pool.cc
diff --git a/content/renderer/raster_worker_pool.cc b/content/renderer/raster_worker_pool.cc
index e8ed13bf8cad0012e91abc13f9b2d6d3b23b117a..1aacf12409ca93fa1378299b29652a21bc03b78b 100644
--- a/content/renderer/raster_worker_pool.cc
+++ b/content/renderer/raster_worker_pool.cc
@@ -124,44 +124,46 @@ RasterWorkerPool::RasterWorkerPool()
has_namespaces_with_finished_running_tasks_cv_(&lock_),
shutdown_(false) {}
+void RasterWorkerPool::CreateAndStartRasterWorkerPoolThread(
+ const base::SimpleThread::Options& thread_options,
+ const std::vector<cc::TaskCategory>& categories,
+ base::ConditionVariable* has_ready_to_run_tasks_cv) {
+ scoped_ptr<base::SimpleThread> thread(new RasterWorkerPoolThread(
+ base::StringPrintf(
+ "CompositorTileWorker%u(%s)",
+ static_cast<unsigned>(threads_.size() + 1),
+ base::GetThreadPriorityAbbr(thread_options.priority()).c_str())
+ .c_str(),
+ thread_options, this, categories, has_ready_to_run_tasks_cv));
+ thread->Start();
+ threads_.push_back(std::move(thread));
+}
+
void RasterWorkerPool::Start(int num_threads) {
DCHECK(threads_.empty());
+ base::SimpleThread::Options thread_options;
+
// Start |num_threads| threads for foreground work, including nonconcurrent
// foreground work.
std::vector<cc::TaskCategory> foreground_categories;
foreground_categories.push_back(cc::TASK_CATEGORY_NONCONCURRENT_FOREGROUND);
foreground_categories.push_back(cc::TASK_CATEGORY_FOREGROUND);
-
for (int i = 0; i < num_threads; i++) {
- scoped_ptr<base::SimpleThread> thread(new RasterWorkerPoolThread(
- base::StringPrintf("CompositorTileWorker%u",
- static_cast<unsigned>(threads_.size() + 1))
- .c_str(),
- base::SimpleThread::Options(), this, foreground_categories,
- &has_ready_to_run_foreground_tasks_cv_));
- thread->Start();
- threads_.push_back(std::move(thread));
+ CreateAndStartRasterWorkerPoolThread(
+ thread_options, foreground_categories,
+ &has_ready_to_run_foreground_tasks_cv_);
}
- // Start a single thread for background work.
- std::vector<cc::TaskCategory> background_categories;
- background_categories.push_back(cc::TASK_CATEGORY_BACKGROUND);
-
// Use background priority for background thread.
- base::SimpleThread::Options thread_options;
#if !defined(OS_MACOSX)
thread_options.set_priority(base::ThreadPriority::BACKGROUND);
#endif
-
- scoped_ptr<base::SimpleThread> thread(new RasterWorkerPoolThread(
- base::StringPrintf("CompositorTileWorker%u",
reveman 2016/03/24 15:40:46 Can we reduce this patch to a one line change here
prashant.n 2016/03/24 17:13:29 Okay. I'll reduce the patch. May be later we can a
- static_cast<unsigned>(threads_.size() + 1))
- .c_str(),
- thread_options, this, background_categories,
- &has_ready_to_run_background_tasks_cv_));
- thread->Start();
- threads_.push_back(std::move(thread));
+ // Start a single thread for background work.
+ std::vector<cc::TaskCategory> background_categories;
+ background_categories.push_back(cc::TASK_CATEGORY_BACKGROUND);
+ CreateAndStartRasterWorkerPoolThread(thread_options, background_categories,
+ &has_ready_to_run_background_tasks_cv_);
}
void RasterWorkerPool::Shutdown() {
« no previous file with comments | « content/renderer/raster_worker_pool.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698