| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/raster_worker_pool.h" | 5 #include "content/renderer/raster_worker_pool.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 std::vector<cc::TaskCategory> background_categories; | 148 std::vector<cc::TaskCategory> background_categories; |
| 149 background_categories.push_back(cc::TASK_CATEGORY_BACKGROUND); | 149 background_categories.push_back(cc::TASK_CATEGORY_BACKGROUND); |
| 150 | 150 |
| 151 // Use background priority for background thread. | 151 // Use background priority for background thread. |
| 152 base::SimpleThread::Options thread_options; | 152 base::SimpleThread::Options thread_options; |
| 153 #if !defined(OS_MACOSX) | 153 #if !defined(OS_MACOSX) |
| 154 thread_options.set_priority(base::ThreadPriority::BACKGROUND); | 154 thread_options.set_priority(base::ThreadPriority::BACKGROUND); |
| 155 #endif | 155 #endif |
| 156 | 156 |
| 157 scoped_ptr<base::SimpleThread> thread(new RasterWorkerPoolThread( | 157 scoped_ptr<base::SimpleThread> thread(new RasterWorkerPoolThread( |
| 158 base::StringPrintf("CompositorTileWorker%u", | 158 "CompositorTileWorkerBackground", thread_options, this, |
| 159 static_cast<unsigned>(threads_.size() + 1)) | 159 background_categories, &has_ready_to_run_background_tasks_cv_)); |
| 160 .c_str(), | |
| 161 thread_options, this, background_categories, | |
| 162 &has_ready_to_run_background_tasks_cv_)); | |
| 163 thread->Start(); | 160 thread->Start(); |
| 164 threads_.push_back(std::move(thread)); | 161 threads_.push_back(std::move(thread)); |
| 165 } | 162 } |
| 166 | 163 |
| 167 void RasterWorkerPool::Shutdown() { | 164 void RasterWorkerPool::Shutdown() { |
| 168 WaitForTasksToFinishRunning(namespace_token_); | 165 WaitForTasksToFinishRunning(namespace_token_); |
| 169 CollectCompletedTasks(namespace_token_, &completed_tasks_); | 166 CollectCompletedTasks(namespace_token_, &completed_tasks_); |
| 170 // Shutdown raster threads. | 167 // Shutdown raster threads. |
| 171 { | 168 { |
| 172 base::AutoLock lock(lock_); | 169 base::AutoLock lock(lock_); |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 | 424 |
| 428 // Overridden from cc::Task: | 425 // Overridden from cc::Task: |
| 429 void RasterWorkerPool::ClosureTask::RunOnWorkerThread() { | 426 void RasterWorkerPool::ClosureTask::RunOnWorkerThread() { |
| 430 closure_.Run(); | 427 closure_.Run(); |
| 431 closure_.Reset(); | 428 closure_.Reset(); |
| 432 } | 429 } |
| 433 | 430 |
| 434 RasterWorkerPool::ClosureTask::~ClosureTask() {} | 431 RasterWorkerPool::ClosureTask::~ClosureTask() {} |
| 435 | 432 |
| 436 } // namespace content | 433 } // namespace content |
| OLD | NEW |