thread_delegate_posix.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_PROFILER_THREAD_DELEGATE_POSIX_H_
  5. #define BASE_PROFILER_THREAD_DELEGATE_POSIX_H_
  6. #include "base/base_export.h"
  7. #include "base/profiler/sampling_profiler_thread_token.h"
  8. #include "base/profiler/thread_delegate.h"
  9. #include "base/threading/platform_thread.h"
  10. namespace base {
  11. // Platform- and thread-specific implementation in support of stack sampling on
  12. // POSIX.
  13. class BASE_EXPORT ThreadDelegatePosix : public ThreadDelegate {
  14. public:
  15. ThreadDelegatePosix(SamplingProfilerThreadToken thread_token);
  16. ThreadDelegatePosix(const ThreadDelegatePosix&) = delete;
  17. ThreadDelegatePosix& operator=(const ThreadDelegatePosix&) = delete;
  18. // ThreadDelegate
  19. PlatformThreadId GetThreadId() const override;
  20. uintptr_t GetStackBaseAddress() const override;
  21. std::vector<uintptr_t*> GetRegistersToRewrite(
  22. RegisterContext* thread_context) override;
  23. private:
  24. const PlatformThreadId thread_id_;
  25. const uintptr_t thread_stack_base_address_;
  26. };
  27. } // namespace base
  28. #endif // BASE_PROFILER_THREAD_DELEGATE_POSIX_H_