OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 // Called for creating WorkerThreadLifecycleObserver on both the main thread | 153 // Called for creating WorkerThreadLifecycleObserver on both the main thread |
154 // and the worker thread. | 154 // and the worker thread. |
155 WorkerThreadLifecycleContext* getWorkerThreadLifecycleContext() const { | 155 WorkerThreadLifecycleContext* getWorkerThreadLifecycleContext() const { |
156 return m_workerThreadLifecycleContext; | 156 return m_workerThreadLifecycleContext; |
157 } | 157 } |
158 | 158 |
159 // Number of active worker threads. | 159 // Number of active worker threads. |
160 static unsigned workerThreadCount(); | 160 static unsigned workerThreadCount(); |
161 | 161 |
| 162 // Returns a set of all worker threads. This must be called only on the main |
| 163 // thread and the returned set must not be stored for future use. |
| 164 static HashSet<WorkerThread*>& workerThreads(); |
| 165 |
162 PlatformThreadId platformThreadId(); | 166 PlatformThreadId platformThreadId(); |
163 | 167 |
164 bool isForciblyTerminated(); | 168 bool isForciblyTerminated(); |
165 | 169 |
166 void waitForShutdownForTesting() { m_shutdownEvent->wait(); } | 170 void waitForShutdownForTesting() { m_shutdownEvent->wait(); } |
167 | 171 |
168 protected: | 172 protected: |
169 WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); | 173 WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); |
170 | 174 |
171 // Factory method for creating a new worker context for the thread. | 175 // Factory method for creating a new worker context for the thread. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 // Scheduled when termination starts with TerminationMode::Force, and | 293 // Scheduled when termination starts with TerminationMode::Force, and |
290 // cancelled when the worker thread is gracefully shut down. | 294 // cancelled when the worker thread is gracefully shut down. |
291 std::unique_ptr<ForceTerminationTask> m_scheduledForceTerminationTask; | 295 std::unique_ptr<ForceTerminationTask> m_scheduledForceTerminationTask; |
292 | 296 |
293 Persistent<WorkerThreadLifecycleContext> m_workerThreadLifecycleContext; | 297 Persistent<WorkerThreadLifecycleContext> m_workerThreadLifecycleContext; |
294 }; | 298 }; |
295 | 299 |
296 } // namespace blink | 300 } // namespace blink |
297 | 301 |
298 #endif // WorkerThread_h | 302 #endif // WorkerThread_h |
OLD | NEW |