#include "components/webrtc/thread_wrapper.h"
#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <optional>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/sequence_checker.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/single_thread_task_runner.h"
#include "base/thread_annotations.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
#include "third_party/webrtc/rtc_base/physical_socket_server.h"
#include "third_party/webrtc_overrides/api/location.h"
#include "third_party/webrtc_overrides/metronome_source.h"
#include "third_party/webrtc_overrides/timer_based_tick_provider.h"
namespace webrtc {
namespace {
constexpr base::TimeDelta kTaskLatencySampleDuration = …;
ABSL_CONST_INIT thread_local ThreadWrapper* jingle_thread_wrapper = …;
}
class ThreadWrapper::PostTaskLatencySampler { … };
struct ThreadWrapper::PendingSend { … };
void ThreadWrapper::EnsureForCurrentMessageLoop() { … }
std::unique_ptr<ThreadWrapper> ThreadWrapper::WrapTaskRunner(
::scoped_refptr<base::SingleThreadTaskRunner> task_runner) { … }
ThreadWrapper* ThreadWrapper::current() { … }
void ThreadWrapper::SetLatencyAndTaskDurationCallbacks(
SampledDurationCallback task_latency_callback,
SampledDurationCallback task_duration_callback) { … }
ThreadWrapper::ThreadWrapper(
::scoped_refptr<base::SingleThreadTaskRunner> task_runner)
: … { … }
ThreadWrapper::~ThreadWrapper() { … }
rtc::SocketServer* ThreadWrapper::SocketServer() { … }
void ThreadWrapper::WillDestroyCurrentMessageLoop() { … }
void ThreadWrapper::BlockingCallImpl(rtc::FunctionView<void()> functor,
const webrtc::Location& location) { … }
void ThreadWrapper::ProcessPendingSends() { … }
void ThreadWrapper::PostTaskImpl(absl::AnyInvocable<void() &&> task,
const PostTaskTraits& traits,
const Location& location) { … }
void ThreadWrapper::PostDelayedTaskImpl(absl::AnyInvocable<void() &&> task,
TimeDelta delay,
const PostDelayedTaskTraits& traits,
const Location& location) { … }
std::optional<base::TimeTicks> ThreadWrapper::PrepareRunTask() { … }
void ThreadWrapper::RunTaskQueueTask(absl::AnyInvocable<void() &&> task) { … }
void ThreadWrapper::RunCoalescedTaskQueueTasks(base::TimeTicks scheduled_time) { … }
void ThreadWrapper::FinalizeRunTask(
std::optional<base::TimeTicks> task_start_timestamp) { … }
bool ThreadWrapper::IsQuitting() { … }
void ThreadWrapper::Quit() { … }
void ThreadWrapper::Restart() { … }
int ThreadWrapper::GetDelay() { … }
void ThreadWrapper::Stop() { … }
void ThreadWrapper::Run() { … }
}