#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "content/browser/browser_thread_impl.h"
#include <string>
#include <utility>
#include "base/atomicops.h"
#include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/sequence_checker.h"
#include "base/task/current_thread.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "content/browser/scheduler/browser_task_executor.h"
#include "content/public/browser/content_browser_client.h"
namespace content {
namespace {
enum BrowserThreadState { … };
struct BrowserThreadGlobals { … };
BrowserThreadGlobals& GetBrowserThreadGlobals() { … }
}
scoped_refptr<base::SingleThreadTaskRunner> GetUIThreadTaskRunner(
const BrowserTaskTraits& traits) { … }
scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner(
const BrowserTaskTraits& traits) { … }
BrowserThreadImpl::BrowserThreadImpl(
ID identifier,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
BrowserThreadImpl::~BrowserThreadImpl() { … }
void BrowserThreadImpl::ResetGlobalsForTesting(BrowserThread::ID identifier) { … }
const char* BrowserThreadImpl::GetThreadName(BrowserThread::ID thread) { … }
bool BrowserThread::IsThreadInitialized(ID identifier) { … }
bool BrowserThread::CurrentlyOn(ID identifier) { … }
std::string BrowserThread::GetCurrentlyOnErrorMessage(ID expected) { … }
bool BrowserThread::GetCurrentThreadIdentifier(ID* identifier) { … }
scoped_refptr<base::SingleThreadTaskRunner>
BrowserThread::GetTaskRunnerForThread(ID identifier) { … }
void BrowserThread::RunAllPendingTasksOnThreadForTesting(ID identifier) { … }
void BrowserThread::PostBestEffortTask(
const base::Location& from_here,
scoped_refptr<base::TaskRunner> task_runner,
base::OnceClosure task) { … }
namespace internal {
bool BrowserThreadChecker::CalledOnValidBrowserThread(
BrowserThread::ID thread_identifier) const { … }
const BrowserThreadChecker& GetBrowserThreadChecker(
BrowserThread::ID thread_identifier) { … }
ScopedValidateBrowserThreadChecker::ScopedValidateBrowserThreadChecker(
BrowserThread::ID thread_identifier,
base::NotFatalUntil fatal_milestone) { … }
ScopedValidateBrowserThreadChecker::~ScopedValidateBrowserThreadChecker() =
default;
#if DCHECK_IS_ON()
ScopedValidateBrowserThreadDebugChecker::
ScopedValidateBrowserThreadDebugChecker(
BrowserThread::ID thread_identifier) { … }
#endif
}
}