chromium/base/profiler/stack_sampler.h

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

#ifndef BASE_PROFILER_STACK_SAMPLER_H_
#define BASE_PROFILER_STACK_SAMPLER_H_

#include <memory>
#include <vector>

#include "base/base_export.h"
#include "base/containers/circular_deque.h"
#include "base/functional/callback.h"
#include "base/gtest_prod_util.h"
#include "base/memory/raw_ptr.h"
#include "base/profiler/frame.h"
#include "base/profiler/register_context.h"
#include "base/profiler/sampling_profiler_thread_token.h"
#include "base/profiler/stack_copier.h"
#include "base/profiler/stack_unwind_data.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"

namespace base {

class ModuleCache;
class StackBuffer;
class StackSamplerTestDelegate;
class Unwinder;

// StackSampler is an implementation detail of StackSamplingProfiler. It
// abstracts the native implementation required to record a set of stack frames
// for a given thread. It delegates to StackCopier for the
// platform-specific stack copying implementation.
// This class is used on both the SamplingThread and a worker thread of the
// thread pool. Recording stack frames always occurs on the
// SamplingThread but unwinding the stack can occur on either the SamplingThread
// or a worker thread. Sampling can start before the thread pool is running so
// unwinding will occur on the SamplingThread until the thread pool is ready.
class BASE_EXPORT StackSampler {};

// StackSamplerTestDelegate provides seams for test code to execute during stack
// collection.
class BASE_EXPORT StackSamplerTestDelegate {};

}  // namespace base

#endif  // BASE_PROFILER_STACK_SAMPLER_H_