#include "base/threading/thread_restrictions.h"
#include "base/threading/hang_watcher.h"
#include "base/trace_event/base_tracing.h"
#include "build/build_config.h"
#if DCHECK_IS_ON()
#include "base/check_op.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_ANDROID)
constexpr bool kCaptureStackTraces = false;
#else
constexpr bool kCaptureStackTraces = …;
#endif
namespace base {
BooleanWithStack::BooleanWithStack(bool value) : … { … }
std::ostream& operator<<(std::ostream& out, const BooleanWithStack& bws) { … }
namespace {
ABSL_CONST_INIT thread_local BooleanWithStack tls_blocking_disallowed;
ABSL_CONST_INIT thread_local BooleanWithStack tls_singleton_disallowed;
ABSL_CONST_INIT thread_local BooleanWithStack
tls_base_sync_primitives_disallowed;
ABSL_CONST_INIT thread_local BooleanWithStack tls_cpu_intensive_work_disallowed;
}
namespace internal {
void AssertBlockingAllowed() { … }
void AssertBlockingDisallowedForTesting() { … }
}
void DisallowBlocking() { … }
ScopedDisallowBlocking::ScopedDisallowBlocking()
: … { … }
ScopedDisallowBlocking::~ScopedDisallowBlocking() { … }
void DisallowBaseSyncPrimitives() { … }
ScopedDisallowBaseSyncPrimitives::ScopedDisallowBaseSyncPrimitives()
: … { … }
ScopedDisallowBaseSyncPrimitives::~ScopedDisallowBaseSyncPrimitives() { … }
ScopedAllowBaseSyncPrimitives::ScopedAllowBaseSyncPrimitives()
: … { … }
ScopedAllowBaseSyncPrimitives::~ScopedAllowBaseSyncPrimitives() { … }
ScopedAllowBaseSyncPrimitivesForTesting::
ScopedAllowBaseSyncPrimitivesForTesting()
: … { … }
ScopedAllowBaseSyncPrimitivesForTesting::
~ScopedAllowBaseSyncPrimitivesForTesting() { … }
ScopedAllowUnresponsiveTasksForTesting::ScopedAllowUnresponsiveTasksForTesting()
: … { … }
ScopedAllowUnresponsiveTasksForTesting::
~ScopedAllowUnresponsiveTasksForTesting() { … }
namespace internal {
void AssertBaseSyncPrimitivesAllowed() { … }
void ResetThreadRestrictionsForTesting() { … }
void AssertSingletonAllowed() { … }
}
void DisallowSingleton() { … }
ScopedDisallowSingleton::ScopedDisallowSingleton()
: … { … }
ScopedDisallowSingleton::~ScopedDisallowSingleton() { … }
void AssertLongCPUWorkAllowed() { … }
void DisallowUnresponsiveTasks() { … }
void PermanentThreadAllowance::AllowBlocking() { … }
void PermanentThreadAllowance::AllowBaseSyncPrimitives() { … }
}
#endif
namespace base {
ScopedAllowBlocking::ScopedAllowBlocking(const Location& from_here)
#if DCHECK_IS_ON()
: … { … }
ScopedAllowBlocking::~ScopedAllowBlocking() { … }
ScopedAllowBaseSyncPrimitivesOutsideBlockingScope::
ScopedAllowBaseSyncPrimitivesOutsideBlockingScope(const Location& from_here)
#if DCHECK_IS_ON()
: … { … }
ScopedAllowBaseSyncPrimitivesOutsideBlockingScope::
~ScopedAllowBaseSyncPrimitivesOutsideBlockingScope() { … }
}