xref: /aosp_15_r20/external/cronet/base/profiler/frame.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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_FRAME_H_
6 #define BASE_PROFILER_FRAME_H_
7 
8 #include "base/base_export.h"
9 #include "base/memory/raw_ptr_exclusion.h"
10 #include "base/profiler/module_cache.h"
11 
12 namespace base {
13 
14 // Frame represents an individual sampled stack frame with full module
15 // information.
16 struct BASE_EXPORT Frame {
17   Frame(uintptr_t instruction_pointer, const ModuleCache::Module* module);
18 
19   // TODO(crbug.com/1371105): For prototype use by Android arm browser main
20   // thread profiling for tracing only. Update once we have a full design
21   // for function name upload.
22   Frame(uintptr_t instruction_pointer,
23         const ModuleCache::Module* module,
24         std::string function_name);
25   ~Frame();
26 
27   // The sampled instruction pointer within the function.
28   uintptr_t instruction_pointer;
29 
30   // The module information.
31   // `module` is not a raw_ptr<...> because it is used with gmock Field() that
32   // expects a raw pointer in V8UnwinderTest.UnwindThroughV8Frames.
33   RAW_PTR_EXCLUSION const ModuleCache::Module* module;
34 
35   // This serves as a temporary way to pass function names from libunwindstack
36   // unwinder to tracing profiler. Not used by any other unwinder.
37   // TODO(crbug.com/1371105): For prototype use by Android arm browser main
38   // thread profiling for tracing only. Update once we have a full design
39   // for function name upload.
40   std::string function_name;
41 };
42 
43 }  // namespace base
44 
45 #endif  // BASE_PROFILER_FRAME_H_
46