| 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 { | 72 // Blocks until the background worker is running. |
| 73 return threads_.back()->tid(); | 73 base::PlatformThreadId GetBackgroundWorkerThreadId() const; |
| 74 } | |
| 75 | 74 |
| 76 protected: | 75 protected: |
| 77 ~CategorizedWorkerPool() override; | 76 ~CategorizedWorkerPool() override; |
| 78 | 77 |
| 79 private: | 78 private: |
| 80 class CategorizedWorkerPoolSequencedTaskRunner; | 79 class CategorizedWorkerPoolSequencedTaskRunner; |
| 81 friend class CategorizedWorkerPoolSequencedTaskRunner; | 80 friend class CategorizedWorkerPoolSequencedTaskRunner; |
| 82 | 81 |
| 83 // Simple Task for the TaskGraphRunner that wraps a closure. | 82 // Simple Task for the TaskGraphRunner that wraps a closure. |
| 84 // This class is used to schedule TaskRunner tasks on the | 83 // This class is used to schedule TaskRunner tasks on the |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 // Condition variable that is waited on by origin threads until a namespace | 142 // Condition variable that is waited on by origin threads until a namespace |
| 144 // has finished running all associated tasks. | 143 // has finished running all associated tasks. |
| 145 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_; | 144 base::ConditionVariable has_namespaces_with_finished_running_tasks_cv_; |
| 146 // Set during shutdown. Tells Run() to return when no more tasks are pending. | 145 // Set during shutdown. Tells Run() to return when no more tasks are pending. |
| 147 bool shutdown_; | 146 bool shutdown_; |
| 148 }; | 147 }; |
| 149 | 148 |
| 150 } // namespace content | 149 } // namespace content |
| 151 | 150 |
| 152 #endif // CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ | 151 #endif // CONTENT_RENDERER_CATEGORIZED_WORKER_POOL_H_ |
| OLD | NEW |