#ifndef BASE_THREADING_THREAD_RESTRICTIONS_H_
#define BASE_THREADING_THREAD_RESTRICTIONS_H_
#include <optional>
#include "arkweb/build/features/features.h"
#include "base/auto_reset.h"
#include "base/base_export.h"
#include "base/compiler_specific.h"
#include "base/debug/stack_trace.h"
#include "base/gtest_prod_util.h"
#include "base/location.h"
#include "build/build_config.h"
class BrowserProcessImpl;
class BrowserThemePack;
class ChromeContentRendererClient;
class ChromeNSSCryptoModuleDelegate;
class DesktopNotificationBalloon;
class FirefoxProfileLock;
class GaiaConfig;
class KeyStorageLinux;
class NativeBackendKWallet;
class NativeDesktopMediaList;
class PartnerBookmarksReader;
class Profile;
class ProfileImpl;
class ScopedAllowBlockingForProfile;
#if BUILDFLAG(ARKWEB_COOKIE)
class CefCookieManagerImplExt;
#endif
class StartupTabProviderImpl;
class WebEngineBrowserMainParts;
struct StartupProfilePathInfo;
#if BUILDFLAG(ARKWEB_MSGPORT)
class ArkWebBrowserHostExtImpl;
#endif
#if BUILDFLAG(ARKWEB_API_INIT_WEB_ENGINE)
class ScopedAllowBlockingForNwebInit;
#endif
namespace base {
class Environment;
class File;
class FilePath;
class CommandLine;
namespace sequence_manager::internal {
class WorkTracker;
}
}
StartupProfilePathInfo GetStartupProfilePath(
const base::FilePath& cur_dir,
const base::CommandLine& command_line,
bool ignore_profile_picker);
#if BUILDFLAG(IS_IOS)
class BrowserStateDirectoryBuilder;
#endif
Profile* GetLastProfileMac();
bool HasWaylandDisplay(base::Environment* env);
namespace android_webview {
class AwBrowserContext;
class AwBrowserContextStore;
class AwMetricsServiceClient;
class CookieManager;
class JsSandboxIsolate;
class OverlayProcessorWebView;
class ScopedAllowInitGLBindings;
class VizCompositorThreadRunnerWebView;
}
namespace ash {
class LoginEventRecorder;
class StartupCustomizationDocument;
class StartupUtils;
bool CameraAppUIShouldEnableLocalOverride(const std::string&);
namespace converters::diagnostics {
class MojoUtils;
}
namespace system {
class StatisticsProviderImpl;
class ProcStatFile;
}
}
namespace audio {
class OutputDevice;
}
namespace blink {
class AudioDestination;
class DiskDataAllocator;
class RTCVideoDecoderAdapter;
class RTCVideoEncoder;
class SourceStream;
class VideoFrameResourceProvider;
class WebRtcVideoFrameAdapter;
class VideoTrackRecorderImplContextProvider;
class WorkerThread;
namespace scheduler {
class NonMainThreadImpl;
}
}
namespace cc {
class CategorizedWorkerPoolJob;
class CategorizedWorkerPool;
class CompletionEvent;
class TileTaskManagerImpl;
}
namespace chrome {
bool PathProvider(int, base::FilePath*);
void SessionEnding();
}
namespace chromecast {
class CrashUtil;
}
namespace chromeos {
class BlockingMethodCaller;
namespace system {
bool IsCoreSchedulingAvailable();
int NumberOfPhysicalCores();
}
}
namespace content {
class BrowserGpuChannelHostFactory;
class BrowserMainLoop;
class BrowserProcessIOThread;
class BrowserTestBase;
#if BUILDFLAG(IS_IOS)
class ContentMainRunnerImpl;
#endif
class DesktopCaptureDevice;
class DWriteFontCollectionProxy;
class DWriteFontProxyImpl;
class EmergencyTraceFinalisationCoordinator;
class InProcessUtilityThread;
class NestedMessagePumpAndroid;
class NetworkServiceInstancePrivate;
class PepperPrintSettingsManagerImpl;
class RenderProcessHostImpl;
class RenderProcessHost;
class RenderWidgetHostViewMac;
class RendererBlinkPlatformImpl;
class SandboxHostLinux;
class ScopedAllowWaitForDebugURL;
class ServiceWorkerContextClient;
class ShellPathProvider;
class SlowWebPreferenceCache;
class SynchronousCompositor;
class SynchronousCompositorHost;
class SynchronousCompositorSyncCallBridge;
class ScopedAllowBlockingForViewAura;
class TextInputClientMac;
class WebContentsViewMac;
base::File CreateFileForDrop(base::FilePath*);
}
namespace cronet {
class CronetPrefsManager;
class CronetContext;
}
namespace crypto {
class ScopedAllowBlockingForNSS;
}
namespace dbus {
class Bus;
}
namespace drive {
class FakeDriveService;
}
namespace device {
class UsbContext;
}
namespace discardable_memory {
class ClientDiscardableSharedMemoryManager;
}
namespace disk_cache {
class BackendImpl;
class InFlightIO;
bool CleanupDirectorySync(const base::FilePath&);
}
namespace enterprise_connectors {
class LinuxKeyRotationCommand;
}
namespace extensions {
class InstalledLoader;
class UnpackedInstaller;
}
namespace font_service::internal {
class MappedFontFile;
}
namespace gfx {
class WUCBackdrop;
}
namespace gl {
struct GLImplementationParts;
namespace init {
bool InitializeStaticGLBindings(GLImplementationParts);
}
}
namespace gpu {
class MappableBufferAHB;
class MappableBufferDXGI;
class GpuPersistentCache;
}
namespace history_report {
class HistoryReportJniBridge;
}
namespace ios_web_view {
class WebViewBrowserState;
}
namespace io_thread {
class IOSIOThread;
}
namespace leveldb::port {
class CondVar;
}
namespace nearby::chrome {
class BleV2GattClient;
class BleV2Medium;
class ScheduledExecutor;
class SubmittableExecutor;
class WifiDirectSocket;
}
namespace media {
class AudioInputDevice;
class AudioOutputDevice;
class BlockingUrlProtocol;
template <class WorkerInterface,
class WorkerImpl,
class Worker,
class WorkerStatus,
WorkerStatus StatusNotOk,
WorkerStatus StatusOk,
WorkerStatus StatusWork>
class CodecWorkerImpl;
class FileVideoCaptureDeviceFactory;
class GpuMojoMediaClientWin;
class MailboxVideoFrameConverter;
class MojoVideoEncodeAccelerator;
class PaintCanvasVideoRenderer;
class V4L2DevicePoller;
}
namespace memory_instrumentation {
class OSMetrics;
}
namespace content {
class UserLevelMemoryPressureSignalGenerator;
}
namespace metrics {
class CleanExitBeacon;
}
namespace midi {
class TaskService;
}
namespace module_installer {
class ScopedAllowModulePakLoad;
}
namespace mojo {
class SyncCallRestrictions;
namespace core {
class ScopedIPCSupport;
namespace ipcz_driver {
class MojoTrap;
}
}
}
namespace net {
class GSSAPISharedLibrary;
class MultiThreadedCertVerifierScopedAllowBaseSyncPrimitives;
class MultiThreadedProxyResolverScopedAllowJoinOnIO;
class NetworkChangeNotifierApple;
class NetworkConfigWatcherAppleThread;
class ProxyConfigServiceWin;
class ScopedAllowBlockingForSettingGetter;
namespace internal {
class AddressTrackerLinux;
class PemFileCertStore;
}
}
namespace printing {
class LocalPrinterHandlerDefault;
#if BUILDFLAG(IS_MAC)
class PrintBackendServiceImpl;
#endif
class PrintBackendServiceManager;
class PrintPreviewUIUntrusted;
class PrinterQuery;
base::FilePath GetAbsoluteSystemDestinationLocation(const base::FilePath&);
}
namespace proxy_resolver {
class ScopedAllowThreadJoinForProxyResolverV8Tracing;
}
namespace remote_cocoa {
class DroppedScreenShotCopierMac;
class SelectFileDialogBridge;
}
namespace remoting {
class AutoThread;
class ScopedAllowBlockingForCrashReporting;
class ScopedBypassIOThreadRestrictions;
namespace protocol {
class ScopedAllowSyncPrimitivesForWebRtcDataStreamAdapter;
class ScopedAllowSyncPrimitivesForWebRtcTransport;
class ScopedAllowSyncPrimitivesForWebRtcVideoStream;
class ScopedAllowThreadJoinForWebRtcTransport;
}
}
namespace rlz_lib {
class FinancialPing;
}
namespace service_manager {
class ServiceProcessLauncher;
}
namespace shell_integration_linux {
class LaunchXdgUtilityScopedAllowBaseSyncPrimitives;
}
namespace storage {
class ObfuscatedFileUtil;
}
namespace syncer {
class GetLocalChangesRequest;
class HttpBridge;
}
namespace tracing {
class FuchsiaPerfettoProducerConnector;
}
namespace ui {
class DrmThreadProxy;
class DrmDisplayHostManager;
class ScopedAllowBlockingForGbmSurface;
class SelectFileDialogLinux;
#if BUILDFLAG(IS_OHOS)
class SelectFileDialogOHOS;
#endif
class WindowResizeHelperMac;
}
namespace updater {
class SystemctlLauncherScopedAllowBaseSyncPrimitives;
}
namespace viz {
class HostGpuMemoryBufferManager;
class ClientGpuMemoryBufferManager;
class DisplayCompositorMemoryAndTaskController;
class SkiaOutputSurfaceImpl;
class SharedImageInterfaceProvider;
}
namespace vr {
class VrShell;
}
namespace web {
class WebMainLoop;
}
namespace base {
namespace android {
class JavaHandlerThread;
class PmfUtils;
class ScopedAllowBlockingForImportantFileWriter;
}
namespace apple::internal {
base::FilePath GetExecutablePath();
}
namespace debug {
class StackTrace;
}
namespace internal {
class GetAppOutputScopedAllowBaseSyncPrimitives;
class JobTaskSource;
class TaskTracker;
bool ReadProcFile(const FilePath& file, std::string* buffer);
}
namespace sequence_manager::internal {
class TaskQueueImpl;
}
namespace subtle {
class PlatformSharedMemoryRegion;
}
namespace win {
class OSInfo;
class ObjectWatcher;
class ScopedAllowBlockingForUserAccountControl;
}
class AdjustOOMScoreHelper;
class ChromeOSVersionInfo;
class FileDescriptorWatcher;
class FilePath;
class Process;
class ScopedAllowBlockingForProc;
class ScopedAllowBlockingForProcessMetrics;
class ScopedAllowThreadRecallForStackSamplingProfiler;
class SimpleThread;
class StackSamplingProfiler;
class TestCustomDisallow;
class Thread;
#if BUILDFLAG(IS_ANDROID)
#define CAPTURE_THREAD_RESTRICTIONS_STACK_TRACES() false
#else
#define CAPTURE_THREAD_RESTRICTIONS_STACK_TRACES() EXPENSIVE_DCHECKS_ARE_ON()
#endif
class BooleanWithOptionalStack {
public:
BooleanWithOptionalStack() = default;
explicit BooleanWithOptionalStack(bool value);
explicit operator bool() const { return value_; }
friend std::ostream& operator<<(std::ostream& out,
const BooleanWithOptionalStack& bws);
private:
bool value_ = false;
#if CAPTURE_THREAD_RESTRICTIONS_STACK_TRACES()
std::optional<debug::StackTrace> stack_;
#endif
};
NOT_TAIL_CALLED BASE_EXPORT void AssertBlockingAllowed();
NOT_TAIL_CALLED BASE_EXPORT void AssertBlockingDisallowedForTesting();
NOT_TAIL_CALLED BASE_EXPORT void DisallowBlocking();
class BASE_EXPORT ScopedDisallowBlocking {
public:
ScopedDisallowBlocking();
ScopedDisallowBlocking(const ScopedDisallowBlocking&) = delete;
ScopedDisallowBlocking& operator=(const ScopedDisallowBlocking&) = delete;
~ScopedDisallowBlocking();
private:
const AutoReset<BooleanWithOptionalStack> resetter_;
};
class BASE_EXPORT ScopedAllowBlocking {
public:
ScopedAllowBlocking(const ScopedAllowBlocking&) = delete;
ScopedAllowBlocking& operator=(const ScopedAllowBlocking&) = delete;
private:
FRIEND_TEST_ALL_PREFIXES(ThreadRestrictionsTest,
NestedAllowRestoresPreviousStack);
FRIEND_TEST_ALL_PREFIXES(ThreadRestrictionsTest, ScopedAllowBlocking);
friend class ScopedAllowBlockingForTesting;
friend class ::BrowserProcessImpl;
friend class ::BrowserThemePack;
friend class ::ChromeContentRendererClient;
friend class ::DesktopNotificationBalloon;
friend class ::FirefoxProfileLock;
friend class ::GaiaConfig;
friend class ::ProfileImpl;
friend class ::ScopedAllowBlockingForProfile;
friend class ::StartupTabProviderImpl;
friend class ::WebEngineBrowserMainParts;
friend class android_webview::AwBrowserContext;
friend class android_webview::AwBrowserContextStore;
friend class android_webview::AwMetricsServiceClient;
friend class android_webview::CookieManager;
friend class android_webview::ScopedAllowInitGLBindings;
friend class ash::LoginEventRecorder;
friend class ash::StartupCustomizationDocument;
friend class ash::StartupUtils;
friend class ash::converters::diagnostics::MojoUtils;
friend class ash::system::ProcStatFile;
friend class base::AdjustOOMScoreHelper;
friend class base::ChromeOSVersionInfo;
friend class base::Process;
friend class base::ScopedAllowBlockingForProc;
friend class base::ScopedAllowBlockingForProcessMetrics;
friend class base::StackSamplingProfiler;
friend class base::android::ScopedAllowBlockingForImportantFileWriter;
friend class base::android::PmfUtils;
friend class base::debug::StackTrace;
friend class base::subtle::PlatformSharedMemoryRegion;
friend class base::win::ScopedAllowBlockingForUserAccountControl;
friend class blink::DiskDataAllocator;
friend class chromecast::CrashUtil;
friend class content::BrowserProcessIOThread;
friend class content::DWriteFontProxyImpl;
friend class content::NetworkServiceInstancePrivate;
friend class content::PepperPrintSettingsManagerImpl;
friend class content::RenderProcessHostImpl;
friend class content::RenderWidgetHostViewMac;
friend class content::
ScopedAllowBlockingForViewAura;
friend class content::ShellPathProvider;
friend class content::UserLevelMemoryPressureSignalGenerator;
friend class content::WebContentsViewMac;
friend class cronet::CronetContext;
friend class cronet::CronetPrefsManager;
friend class crypto::ScopedAllowBlockingForNSS;
friend class drive::FakeDriveService;
friend class extensions::InstalledLoader;
friend class extensions::UnpackedInstaller;
friend class font_service::internal::MappedFontFile;
friend class ios_web_view::WebViewBrowserState;
friend class io_thread::IOSIOThread;
friend class media::FileVideoCaptureDeviceFactory;
friend class memory_instrumentation::OSMetrics;
friend class metrics::CleanExitBeacon;
friend class module_installer::ScopedAllowModulePakLoad;
friend class net::GSSAPISharedLibrary;
friend class net::ProxyConfigServiceWin;
friend class net::
ScopedAllowBlockingForSettingGetter;
friend class net::internal::PemFileCertStore;
friend class printing::LocalPrinterHandlerDefault;
friend class printing::PrintBackendServiceManager;
friend class printing::PrintPreviewUIUntrusted;
friend class printing::PrinterQuery;
friend class remote_cocoa::
DroppedScreenShotCopierMac;
friend class remote_cocoa::SelectFileDialogBridge;
friend class remoting::
ScopedBypassIOThreadRestrictions;
friend class remoting::ScopedAllowBlockingForCrashReporting;
friend class ui::DrmDisplayHostManager;
friend class ui::ScopedAllowBlockingForGbmSurface;
friend class ui::SelectFileDialogLinux;
#if BUILDFLAG(IS_OHOS)
friend class ui::SelectFileDialogOHOS;
#endif
#if BUILDFLAG(IS_MAC)
friend class printing::PrintBackendServiceImpl;
#endif
#if BUILDFLAG(IS_WIN)
friend class base::win::OSInfo;
friend class content::SlowWebPreferenceCache;
friend class media::GpuMojoMediaClientWin;
friend class gfx::WUCBackdrop;
#endif
#if BUILDFLAG(IS_IOS)
friend class ::BrowserStateDirectoryBuilder;
#endif
#if BUILDFLAG(ARKWEB_MSGPORT)
friend class ::ArkWebBrowserHostExtImpl;
#endif
#if BUILDFLAG(ARKWEB_API_INIT_WEB_ENGINE)
friend class ::ScopedAllowBlockingForNwebInit;
#endif
friend Profile* ::GetLastProfileMac();
friend auto ::GetStartupProfilePath(const base::FilePath& cur_dir,
const base::CommandLine& command_line,
bool ignore_profile_picker)
-> StartupProfilePathInfo;
friend bool ::HasWaylandDisplay(
base::Environment* env);
friend bool ash::CameraAppUIShouldEnableLocalOverride(const std::string&);
friend base::FilePath base::apple::internal::GetExecutablePath();
friend bool base::internal::ReadProcFile(const FilePath& file,
std::string* buffer);
friend bool chrome::PathProvider(int,
base::FilePath*);
friend void chrome::SessionEnding();
friend bool chromeos::system::IsCoreSchedulingAvailable();
friend int chromeos::system::NumberOfPhysicalCores();
friend base::File content::CreateFileForDrop(
base::FilePath* file_path);
friend bool disk_cache::CleanupDirectorySync(const base::FilePath&);
friend bool gl::init::InitializeStaticGLBindings(gl::GLImplementationParts);
friend base::FilePath printing::GetAbsoluteSystemDestinationLocation(
const base::FilePath&);
ScopedAllowBlocking(const Location& from_here = Location::Current());
~ScopedAllowBlocking();
const AutoReset<BooleanWithOptionalStack> resetter_;
};
class ScopedAllowBlockingForTesting {
public:
ScopedAllowBlockingForTesting() = default;
ScopedAllowBlockingForTesting(const ScopedAllowBlockingForTesting&) = delete;
ScopedAllowBlockingForTesting& operator=(
const ScopedAllowBlockingForTesting&) = delete;
~ScopedAllowBlockingForTesting() = default;
private:
ScopedAllowBlocking scoped_allow_blocking_;
};
NOT_TAIL_CALLED BASE_EXPORT void DisallowBaseSyncPrimitives();
class BASE_EXPORT ScopedDisallowBaseSyncPrimitives {
public:
ScopedDisallowBaseSyncPrimitives();
ScopedDisallowBaseSyncPrimitives(const ScopedDisallowBaseSyncPrimitives&) =
delete;
ScopedDisallowBaseSyncPrimitives& operator=(
const ScopedDisallowBaseSyncPrimitives&) = delete;
~ScopedDisallowBaseSyncPrimitives();
private:
const AutoReset<BooleanWithOptionalStack> resetter_;
};
class BASE_EXPORT ScopedAllowBaseSyncPrimitives {
public:
ScopedAllowBaseSyncPrimitives(const ScopedAllowBaseSyncPrimitives&) = delete;
ScopedAllowBaseSyncPrimitives& operator=(
const ScopedAllowBaseSyncPrimitives&) = delete;
private:
FRIEND_TEST_ALL_PREFIXES(ThreadRestrictionsTest,
ScopedAllowBaseSyncPrimitives);
FRIEND_TEST_ALL_PREFIXES(ThreadRestrictionsTest,
ScopedAllowBaseSyncPrimitivesResetsState);
FRIEND_TEST_ALL_PREFIXES(ThreadRestrictionsTest,
ScopedAllowBaseSyncPrimitivesWithBlockingDisallowed);
friend class ::ChromeNSSCryptoModuleDelegate;
friend class ::PartnerBookmarksReader;
friend class ::tracing::FuchsiaPerfettoProducerConnector;
friend class android_webview::JsSandboxIsolate;
friend class base::SimpleThread;
friend class base::internal::GetAppOutputScopedAllowBaseSyncPrimitives;
friend class blink::SourceStream;
friend class blink::VideoTrackRecorderImplContextProvider;
friend class blink::WorkerThread;
friend class blink::scheduler::NonMainThreadImpl;
friend class cc::CategorizedWorkerPoolJob;
friend class content::BrowserMainLoop;
friend class content::BrowserProcessIOThread;
friend class content::DWriteFontCollectionProxy;
friend class content::RendererBlinkPlatformImpl;
friend class content::ServiceWorkerContextClient;
friend class device::UsbContext;
friend class enterprise_connectors::LinuxKeyRotationCommand;
friend class gpu::GpuPersistentCache;
friend class history_report::HistoryReportJniBridge;
friend class internal::TaskTracker;
friend class leveldb::port::CondVar;
friend class nearby::chrome::ScheduledExecutor;
friend class nearby::chrome::SubmittableExecutor;
friend class nearby::chrome::BleV2GattClient;
friend class nearby::chrome::BleV2Medium;
friend class nearby::chrome::WifiDirectSocket;
friend class media::AudioOutputDevice;
friend class media::BlockingUrlProtocol;
template <class WorkerInterface,
class WorkerImpl,
class Worker,
class WorkerStatus,
WorkerStatus StatusNotOk,
WorkerStatus StatusOk,
WorkerStatus StatusWork>
friend class media::CodecWorkerImpl;
friend class media::MojoVideoEncodeAccelerator;
friend class mojo::core::ScopedIPCSupport;
friend class net::MultiThreadedCertVerifierScopedAllowBaseSyncPrimitives;
friend class rlz_lib::FinancialPing;
friend class shell_integration_linux::
LaunchXdgUtilityScopedAllowBaseSyncPrimitives;
friend class storage::ObfuscatedFileUtil;
friend class syncer::HttpBridge;
friend class syncer::GetLocalChangesRequest;
friend class updater::SystemctlLauncherScopedAllowBaseSyncPrimitives;
friend class ::NativeBackendKWallet;
friend class android_webview::
OverlayProcessorWebView;
friend class blink::VideoFrameResourceProvider;
friend class viz::
DisplayCompositorMemoryAndTaskController;
friend class viz::SkiaOutputSurfaceImpl;
friend class viz::SharedImageInterfaceProvider;
ScopedAllowBaseSyncPrimitives();
~ScopedAllowBaseSyncPrimitives();
const AutoReset<BooleanWithOptionalStack> resetter_;
};
class BASE_EXPORT
[[maybe_unused,
nodiscard]] ScopedAllowBaseSyncPrimitivesOutsideBlockingScope {
public:
ScopedAllowBaseSyncPrimitivesOutsideBlockingScope(
const ScopedAllowBaseSyncPrimitivesOutsideBlockingScope&) = delete;
ScopedAllowBaseSyncPrimitivesOutsideBlockingScope& operator=(
const ScopedAllowBaseSyncPrimitivesOutsideBlockingScope&) = delete;
private:
FRIEND_TEST_ALL_PREFIXES(ThreadRestrictionsTest,
ScopedAllowBaseSyncPrimitivesOutsideBlockingScope);
FRIEND_TEST_ALL_PREFIXES(
ThreadRestrictionsTest,
ScopedAllowBaseSyncPrimitivesOutsideBlockingScopeResetsState);
friend class ::BrowserProcessImpl;
friend class ::ChromeContentRendererClient;
friend class ::KeyStorageLinux;
friend class ::NativeDesktopMediaList;
friend class android::JavaHandlerThread;
friend class android_webview::CookieManager;
#if BUILDFLAG(ARKWEB_COOKIE)
friend class ::CefCookieManagerImplExt;
#endif
friend class android_webview::VizCompositorThreadRunnerWebView;
friend class audio::OutputDevice;
friend class base::FileDescriptorWatcher;
friend class base::ScopedAllowThreadRecallForStackSamplingProfiler;
friend class base::StackSamplingProfiler;
friend class base::internal::JobTaskSource;
friend class base::sequence_manager::internal::TaskQueueImpl;
friend class base::sequence_manager::internal::WorkTracker;
friend class base::win::ObjectWatcher;
friend class blink::AudioDestination;
friend class blink::RTCVideoDecoderAdapter;
friend class blink::RTCVideoEncoder;
friend class blink::WebRtcVideoFrameAdapter;
friend class cc::CategorizedWorkerPoolJob;
friend class cc::CategorizedWorkerPool;
friend class cc::TileTaskManagerImpl;
friend class content::DesktopCaptureDevice;
friend class content::EmergencyTraceFinalisationCoordinator;
friend class content::InProcessUtilityThread;
friend class content::RenderProcessHost;
friend class content::SandboxHostLinux;
friend class content::ScopedAllowWaitForDebugURL;
friend class content::SynchronousCompositor;
friend class content::SynchronousCompositorHost;
friend class content::SynchronousCompositorSyncCallBridge;
friend class gpu::MappableBufferAHB;
friend class gpu::MappableBufferDXGI;
friend class media::AudioInputDevice;
friend class media::AudioOutputDevice;
friend class media::MailboxVideoFrameConverter;
friend class media::PaintCanvasVideoRenderer;
friend class media::V4L2DevicePoller;
friend class mojo::SyncCallRestrictions;
friend class mojo::core::ipcz_driver::MojoTrap;
friend class net::NetworkConfigWatcherAppleThread;
friend class ui::DrmThreadProxy;
friend class viz::ClientGpuMemoryBufferManager;
friend class viz::HostGpuMemoryBufferManager;
friend class vr::VrShell;
friend class ::ash::system::StatisticsProviderImpl;
friend class ::chromeos::BlockingMethodCaller;
friend class base::Thread;
friend class cc::CompletionEvent;
friend class content::
BrowserGpuChannelHostFactory;
friend class content::TextInputClientMac;
friend class dbus::Bus;
friend class discardable_memory::
ClientDiscardableSharedMemoryManager;
friend class disk_cache::BackendImpl;
friend class disk_cache::InFlightIO;
friend class midi::TaskService;
friend class net::
MultiThreadedProxyResolverScopedAllowJoinOnIO;
friend class net::NetworkChangeNotifierApple;
friend class net::internal::AddressTrackerLinux;
friend class proxy_resolver::
ScopedAllowThreadJoinForProxyResolverV8Tracing;
friend class remoting::AutoThread;
friend class remoting::protocol::
ScopedAllowSyncPrimitivesForWebRtcDataStreamAdapter;
friend class remoting::protocol::
ScopedAllowSyncPrimitivesForWebRtcTransport;
friend class remoting::protocol::
ScopedAllowSyncPrimitivesForWebRtcVideoStream;
friend class remoting::protocol::
ScopedAllowThreadJoinForWebRtcTransport;
friend class service_manager::ServiceProcessLauncher;
friend class ui::WindowResizeHelperMac;
ScopedAllowBaseSyncPrimitivesOutsideBlockingScope(
const Location& from_here = Location::Current());
~ScopedAllowBaseSyncPrimitivesOutsideBlockingScope();
const AutoReset<BooleanWithOptionalStack> resetter_;
};
class BASE_EXPORT ScopedAllowBaseSyncPrimitivesForTesting {
public:
ScopedAllowBaseSyncPrimitivesForTesting();
ScopedAllowBaseSyncPrimitivesForTesting(
const ScopedAllowBaseSyncPrimitivesForTesting&) = delete;
ScopedAllowBaseSyncPrimitivesForTesting& operator=(
const ScopedAllowBaseSyncPrimitivesForTesting&) = delete;
~ScopedAllowBaseSyncPrimitivesForTesting();
private:
const AutoReset<BooleanWithOptionalStack> resetter_;
};
class BASE_EXPORT ScopedAllowUnresponsiveTasksForTesting {
public:
ScopedAllowUnresponsiveTasksForTesting();
ScopedAllowUnresponsiveTasksForTesting(
const ScopedAllowUnresponsiveTasksForTesting&) = delete;
ScopedAllowUnresponsiveTasksForTesting& operator=(
const ScopedAllowUnresponsiveTasksForTesting&) = delete;
~ScopedAllowUnresponsiveTasksForTesting();
private:
const AutoReset<BooleanWithOptionalStack> base_sync_resetter_;
const AutoReset<BooleanWithOptionalStack> blocking_resetter_;
const AutoReset<BooleanWithOptionalStack> cpu_resetter_;
};
namespace internal {
NOT_TAIL_CALLED BASE_EXPORT void AssertBaseSyncPrimitivesAllowed();
BASE_EXPORT void ResetThreadRestrictionsForTesting();
NOT_TAIL_CALLED BASE_EXPORT void AssertSingletonAllowed();
}
NOT_TAIL_CALLED BASE_EXPORT void DisallowSingleton();
class BASE_EXPORT ScopedDisallowSingleton {
public:
ScopedDisallowSingleton();
ScopedDisallowSingleton(const ScopedDisallowSingleton&) = delete;
ScopedDisallowSingleton& operator=(const ScopedDisallowSingleton&) = delete;
~ScopedDisallowSingleton();
private:
const AutoReset<BooleanWithOptionalStack> resetter_;
};
NOT_TAIL_CALLED BASE_EXPORT void AssertLongCPUWorkAllowed();
NOT_TAIL_CALLED BASE_EXPORT void DisallowUnresponsiveTasks();
class BASE_EXPORT PermanentThreadAllowance {
public:
PermanentThreadAllowance() = delete;
private:
friend class base::TestCustomDisallow;
friend class content::BrowserMainLoop;
friend class content::BrowserTestBase;
#if BUILDFLAG(IS_IOS)
friend class content::ContentMainRunnerImpl;
#endif
friend class web::WebMainLoop;
static void AllowBlocking();
static void AllowBaseSyncPrimitives();
};
}
#endif