stack_copier_suspend.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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_STACK_COPIER_SUSPEND_H_
  5. #define BASE_PROFILER_STACK_COPIER_SUSPEND_H_
  6. #include <memory>
  7. #include "base/base_export.h"
  8. #include "base/profiler/stack_copier.h"
  9. namespace base {
  10. class SuspendableThreadDelegate;
  11. // Supports stack copying on platforms where the profiled thread must be
  12. // explicitly suspended from the profiler thread and the stack is copied from
  13. // the profiler thread.
  14. class BASE_EXPORT StackCopierSuspend : public StackCopier {
  15. public:
  16. StackCopierSuspend(
  17. std::unique_ptr<SuspendableThreadDelegate> thread_delegate);
  18. ~StackCopierSuspend() override;
  19. // StackCopier:
  20. bool CopyStack(StackBuffer* stack_buffer,
  21. uintptr_t* stack_top,
  22. TimeTicks* timestamp,
  23. RegisterContext* thread_context,
  24. Delegate* delegate) override;
  25. private:
  26. std::unique_ptr<SuspendableThreadDelegate> thread_delegate_;
  27. };
  28. } // namespace base
  29. #endif // BASE_PROFILER_STACK_COPIER_SUSPEND_H_