| 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 #ifndef CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ | 5 #ifndef CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ |
| 6 #define CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ | 6 #define CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // of all the associated task runners. | 62 // of all the associated task runners. |
| 63 // Once all the tasks are executed the method blocks until the threads are | 63 // Once all the tasks are executed the method blocks until the threads are |
| 64 // terminated. | 64 // terminated. |
| 65 void Shutdown(); | 65 void Shutdown(); |
| 66 | 66 |
| 67 cc::TaskGraphRunner* GetTaskGraphRunner() { return this; } | 67 cc::TaskGraphRunner* GetTaskGraphRunner() { return this; } |
| 68 | 68 |
| 69 // Create a new sequenced task graph runner. | 69 // Create a new sequenced task graph runner. |
| 70 scoped_refptr<base::SequencedTaskRunner> CreateSequencedTaskRunner(); | 70 scoped_refptr<base::SequencedTaskRunner> CreateSequencedTaskRunner(); |
| 71 | 71 |
| 72 base::PlatformThreadId background_worker_thread_id() const { |
| 73 return threads_.back()->tid(); |
| 74 } |
| 75 |
| 72 protected: | 76 protected: |
| 73 ~CategorizedWorkerPool() override; | 77 ~CategorizedWorkerPool() override; |
| 74 | 78 |
| 75 private: | 79 private: |
| 76 class CategorizedWorkerPoolSequencedTaskRunner; | 80 class CategorizedWorkerPoolSequencedTaskRunner; |
| 77 friend class CategorizedWorkerPoolSequencedTaskRunner; | 81 friend class CategorizedWorkerPoolSequencedTaskRunner; |
| 78 | 82 |
| 79 // Simple Task for the TaskGraphRunner that wraps a closure. | 83 // Simple Task for the TaskGraphRunner that wraps a closure. |
| 80 // This class is used to schedule TaskRunner tasks on the | 84 // This class is used to schedule TaskRunner tasks on the |
| 81 // |task_graph_runner_|. | 85 // |task_graph_runner_|. |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // Condition variable that is waited on by origin threads until a namespace | 143 // Condition variable that is waited on by origin threads until a namespace |
| 140 // has finished running all associated tasks. | 144 // has finished running all associated tasks. |
| 141 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_; | 145 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_; |
| 142 // Set during shutdown. Tells Run() to return when no more tasks are pending. | 146 // Set during shutdown. Tells Run() to return when no more tasks are pending. |
| 143 bool shutdown_; | 147 bool shutdown_; |
| 144 }; | 148 }; |
| 145 | 149 |
| 146 } // namespace content | 150 } // namespace content |
| 147 | 151 |
| 148 #endif // CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ | 152 #endif // CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ |
| OLD | NEW |