Add ScopedMayBlock and BlockingObserver classes

Desktop / Chromium - Jeffrey He [google.com] - 9 August 2017 10:47 EDT

The ScopedMayBlock class is used to annotate code that may block. It informs the BlockingObserver object for the current thread in TLS by calling BlockingObserver::BlockingScopeEntered() when ScopedMayBlock is created and BlockingObserver::BlockingScopeExited() when destroyed.

Bug: 738104 Change-Id: I965932a058a0ac22e465e2afa2f85b515c35a439 Reviewed-on: https://chromium-review.googlesource.com/587390

1471bcd Add ScopedMayBlock and BlockingObserver classes
base/BUILD.gn | 2 ++
base/threading/scoped_may_block.cc | 42 ++++++++++++++++++++++++++++++++++++++
base/threading/scoped_may_block.h | 41 +++++++++++++++++++++++++++++++++++++
3 files changed, 85 insertions(+)

Upstream: git.chromium.org


  • Share