chromium/base/threading/scoped_blocking_call_internal.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "base/threading/scoped_blocking_call_internal.h"

#include <algorithm>
#include <utility>

#include "base/check_op.h"
#include "base/compiler_specific.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/no_destructor.h"
#include "base/numerics/safe_conversions.h"
#include "base/scoped_clear_last_error.h"
#include "base/task/scoped_set_task_priority_for_current_thread.h"
#include "base/task/thread_pool.h"
#include "base/task/thread_pool/environment_config.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/scoped_blocking_call.h"
#include "build/build_config.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"

namespace base {
namespace internal {

namespace {

ABSL_CONST_INIT thread_local BlockingObserver* blocking_observer =;

// Last ScopedBlockingCall instantiated on this thread.
ABSL_CONST_INIT thread_local UncheckedScopedBlockingCall*
    last_scoped_blocking_call =;

// These functions can be removed, and the calls below replaced with direct
// variable accesses, once the MSAN workaround is not necessary.
BlockingObserver* GetBlockingObserver() {}
UncheckedScopedBlockingCall* GetLastScopedBlockingCall() {}

// Set to true by scoped_blocking_call_unittest to ensure unrelated threads
// entering ScopedBlockingCalls don't affect test outcomes.
bool g_only_monitor_observed_threads =;

bool IsBackgroundPriorityWorker() {}

}  // namespace

void SetBlockingObserverForCurrentThread(
    BlockingObserver* new_blocking_observer) {}

void ClearBlockingObserverForCurrentThread() {}

IOJankMonitoringWindow::ScopedMonitoredCall::ScopedMonitoredCall()
    :{}

IOJankMonitoringWindow::ScopedMonitoredCall::~ScopedMonitoredCall() {}

void IOJankMonitoringWindow::ScopedMonitoredCall::Cancel() {}

IOJankMonitoringWindow::IOJankMonitoringWindow(TimeTicks start_time)
    :{}

// static
void IOJankMonitoringWindow::CancelMonitoringForTesting() {}

// static
constexpr TimeDelta IOJankMonitoringWindow::kIOJankInterval;
// static
constexpr TimeDelta IOJankMonitoringWindow::kMonitoringWindow;
// static
constexpr TimeDelta IOJankMonitoringWindow::kTimeDiscrepancyTimeout;
// static
constexpr int IOJankMonitoringWindow::kNumIntervals;

// static
scoped_refptr<IOJankMonitoringWindow>
IOJankMonitoringWindow::MonitorNextJankWindowIfNecessary(TimeTicks recent_now) {}

// NO_THREAD_SAFETY_ANALYSIS because ~RefCountedThreadSafe() guarantees we're
// the last ones to access this state (and ordered after all other accesses).
IOJankMonitoringWindow::~IOJankMonitoringWindow() NO_THREAD_SAFETY_ANALYSIS {}

void IOJankMonitoringWindow::OnBlockingCallCompleted(TimeTicks call_start,
                                                     TimeTicks call_end) {}

void IOJankMonitoringWindow::AddJank(int local_jank_start_index,
                                     int num_janky_intervals) {}

// static
Lock& IOJankMonitoringWindow::current_jank_window_lock() {}

// static
scoped_refptr<IOJankMonitoringWindow>&
IOJankMonitoringWindow::current_jank_window_storage() {}

// static
IOJankReportingCallback& IOJankMonitoringWindow::reporting_callback_storage() {}

UncheckedScopedBlockingCall::UncheckedScopedBlockingCall(
    BlockingType blocking_type,
    BlockingCallType blocking_call_type)
    :{}

UncheckedScopedBlockingCall::~UncheckedScopedBlockingCall() {}

}  // namespace internal

void EnableIOJankMonitoringForProcess(
    IOJankReportingCallback reporting_callback,
    OnlyObservedThreadsForTest only_observed_threads) {}

}  // namespace base