1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_PROFILER_THREAD_DELEGATE_POSIX_H_
6 #define BASE_PROFILER_THREAD_DELEGATE_POSIX_H_
11 #include "base/base_export.h"
12 #include "base/profiler/sampling_profiler_thread_token.h"
13 #include "base/profiler/thread_delegate.h"
14 #include "base/threading/platform_thread.h"
18 // Platform- and thread-specific implementation in support of stack sampling on
20 class BASE_EXPORT ThreadDelegatePosix : public ThreadDelegate {
22 static std::unique_ptr<ThreadDelegatePosix> Create(
23 SamplingProfilerThreadToken thread_token);
25 ~ThreadDelegatePosix() override;
27 ThreadDelegatePosix(const ThreadDelegatePosix&) = delete;
28 ThreadDelegatePosix& operator=(const ThreadDelegatePosix&) = delete;
31 PlatformThreadId GetThreadId() const override;
32 uintptr_t GetStackBaseAddress() const override;
33 std::vector<uintptr_t*> GetRegistersToRewrite(
34 RegisterContext* thread_context) override;
37 ThreadDelegatePosix(PlatformThreadId id, uintptr_t base_address);
39 const PlatformThreadId thread_id_;
40 const uintptr_t thread_stack_base_address_;
45 #endif // BASE_PROFILER_THREAD_DELEGATE_POSIX_H_