Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 5 #ifndef BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
| 6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 6 #define BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 | 309 |
| 310 // A variant that allows an arbitrary number of new blocking tasks to | 310 // A variant that allows an arbitrary number of new blocking tasks to |
| 311 // be posted during shutdown from within tasks that execute during shutdown. | 311 // be posted during shutdown from within tasks that execute during shutdown. |
| 312 // Only tasks designated as BLOCKING_SHUTDOWN will be allowed, and only if | 312 // Only tasks designated as BLOCKING_SHUTDOWN will be allowed, and only if |
| 313 // posted by tasks that are not designated as CONTINUE_ON_SHUTDOWN. Once | 313 // posted by tasks that are not designated as CONTINUE_ON_SHUTDOWN. Once |
| 314 // the limit is reached, subsequent calls to post task fail in all cases. | 314 // the limit is reached, subsequent calls to post task fail in all cases. |
| 315 // | 315 // |
| 316 // Must be called from the same thread this object was constructed on. | 316 // Must be called from the same thread this object was constructed on. |
| 317 void Shutdown(int max_new_blocking_tasks_after_shutdown); | 317 void Shutdown(int max_new_blocking_tasks_after_shutdown); |
| 318 | 318 |
| 319 // Check if Shutdown was called for given threading pool. This method is used | |
| 320 // for aborting time consuming operation to don't block shutdown. | |
|
jar (doing other things)
2013/07/10 15:07:06
nit: typo:
"...to don't block shutdown." --> "...
Dmitry Polukhin
2013/07/10 17:24:22
Done.
| |
| 321 // | |
| 322 // Can be called from any thread. | |
| 323 bool IsShutdownInProgress(); | |
| 324 | |
| 319 protected: | 325 protected: |
| 320 virtual ~SequencedWorkerPool(); | 326 virtual ~SequencedWorkerPool(); |
| 321 | 327 |
| 322 virtual void OnDestruct() const OVERRIDE; | 328 virtual void OnDestruct() const OVERRIDE; |
| 323 | 329 |
| 324 private: | 330 private: |
| 325 friend class RefCountedThreadSafe<SequencedWorkerPool>; | 331 friend class RefCountedThreadSafe<SequencedWorkerPool>; |
| 326 friend class DeleteHelper<SequencedWorkerPool>; | 332 friend class DeleteHelper<SequencedWorkerPool>; |
| 327 | 333 |
| 328 class Inner; | 334 class Inner; |
| 329 class Worker; | 335 class Worker; |
| 330 | 336 |
| 331 const scoped_refptr<MessageLoopProxy> constructor_message_loop_; | 337 const scoped_refptr<MessageLoopProxy> constructor_message_loop_; |
| 332 | 338 |
| 333 // Avoid pulling in too many headers by putting (almost) everything | 339 // Avoid pulling in too many headers by putting (almost) everything |
| 334 // into |inner_|. | 340 // into |inner_|. |
| 335 const scoped_ptr<Inner> inner_; | 341 const scoped_ptr<Inner> inner_; |
| 336 | 342 |
| 337 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); | 343 DISALLOW_COPY_AND_ASSIGN(SequencedWorkerPool); |
| 338 }; | 344 }; |
| 339 | 345 |
| 340 } // namespace base | 346 } // namespace base |
| 341 | 347 |
| 342 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ | 348 #endif // BASE_THREADING_SEQUENCED_WORKER_POOL_H_ |
| OLD | NEW |