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