Support nested ScopedBlockingCalls

Desktop / Chromium - Francois Doray [chromium.org] - 11 September 2017 13:27 EDT

Nested ScopedBlockingCalls are useful when Chrome code makes a blocking call to an external library which may reenter Chrome, and the reentrant code may itself make another blocking call.

A WILL_BLOCK ScopedBlockingCall within the scope of another WILL_BLOCK ScopedBlockingCall has no effect. A MAY_BLOCK within the scope of another ScopedBlockingCall (of any type) has no effect. A WILL_BLOCK ScopedBlockingCall within the scope of a MAY_BLOCK ScopedBlockingCall is equivalent to causing the timeout of the MAY_BLOCK ScopedBlockingCall to expire immediately.

Bug: 738104 Change-Id: I1f19f626ebb602d0366258bc74d3127e636eeb99 Reviewed-on: https://chromium-review.googlesource.com/653595

adf582e Support nested ScopedBlockingCalls.
base/BUILD.gn | 1 +
base/task_scheduler/scheduler_worker_pool_impl.cc | 45 +++--
base/task_scheduler/scheduler_worker_pool_impl.h | 2 +-
.../scheduler_worker_pool_impl_unittest.cc | 191 +++++++++++++++++----
base/threading/scoped_blocking_call.cc | 44 ++---
base/threading/scoped_blocking_call.h | 34 +++-
base/threading/scoped_blocking_call_unittest.cc | 132 ++++++++++++++
7 files changed, 373 insertions(+), 76 deletions(-)

Upstream: git.chromium.org


  • Share