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