| 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/categorized_worker_pool.h" | 5 #include "content/renderer/categorized_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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 threads_.push_back(std::move(thread)); | 145 threads_.push_back(std::move(thread)); |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Start a single thread for background work. | 148 // Start a single thread for background work. |
| 149 std::vector<cc::TaskCategory> background_categories; | 149 std::vector<cc::TaskCategory> background_categories; |
| 150 background_categories.push_back(cc::TASK_CATEGORY_BACKGROUND); | 150 background_categories.push_back(cc::TASK_CATEGORY_BACKGROUND); |
| 151 | 151 |
| 152 // Use background priority for background thread. | 152 // Use background priority for background thread. |
| 153 base::SimpleThread::Options thread_options; | 153 base::SimpleThread::Options thread_options; |
| 154 #if !defined(OS_MACOSX) | 154 #if !defined(OS_MACOSX) |
| 155 thread_options.priority = base::ThreadPriority::BACKGROUND; | 155 thread_options.set_priority(base::ThreadPriority::BACKGROUND); |
| 156 #endif | 156 #endif |
| 157 | 157 |
| 158 std::unique_ptr<base::SimpleThread> thread(new CategorizedWorkerPoolThread( | 158 std::unique_ptr<base::SimpleThread> thread(new CategorizedWorkerPoolThread( |
| 159 "CompositorTileWorkerBackground", thread_options, this, | 159 "CompositorTileWorkerBackground", thread_options, this, |
| 160 background_categories, &has_ready_to_run_background_tasks_cv_)); | 160 background_categories, &has_ready_to_run_background_tasks_cv_)); |
| 161 thread->Start(); | 161 thread->Start(); |
| 162 threads_.push_back(std::move(thread)); | 162 threads_.push_back(std::move(thread)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 void CategorizedWorkerPool::Shutdown() { | 165 void CategorizedWorkerPool::Shutdown() { |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 422 |
| 423 // Overridden from cc::Task: | 423 // Overridden from cc::Task: |
| 424 void CategorizedWorkerPool::ClosureTask::RunOnWorkerThread() { | 424 void CategorizedWorkerPool::ClosureTask::RunOnWorkerThread() { |
| 425 closure_.Run(); | 425 closure_.Run(); |
| 426 closure_.Reset(); | 426 closure_.Reset(); |
| 427 } | 427 } |
| 428 | 428 |
| 429 CategorizedWorkerPool::ClosureTask::~ClosureTask() {} | 429 CategorizedWorkerPool::ClosureTask::~ClosureTask() {} |
| 430 | 430 |
| 431 } // namespace content | 431 } // namespace content |
| OLD | NEW |