1 // Copyright 2023 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_NATIVE_UNWINDER_ANDROID_MEMORY_REGIONS_MAP_IMPL_H_
6 #define BASE_PROFILER_NATIVE_UNWINDER_ANDROID_MEMORY_REGIONS_MAP_IMPL_H_
8 #include "base/profiler/native_unwinder_android_memory_regions_map.h"
10 #include "third_party/libunwindstack/src/libunwindstack/include/unwindstack/Maps.h"
11 #include "third_party/libunwindstack/src/libunwindstack/include/unwindstack/Memory.h"
15 class NativeUnwinderAndroidMemoryRegionsMapImpl
16 : public NativeUnwinderAndroidMemoryRegionsMap {
18 NativeUnwinderAndroidMemoryRegionsMapImpl(
19 std::unique_ptr<unwindstack::Maps> maps,
20 std::unique_ptr<unwindstack::Memory> memory);
22 ~NativeUnwinderAndroidMemoryRegionsMapImpl() override;
24 unwindstack::Maps* maps() { return maps_.get(); }
25 // We use a non-const reference here because some functions in libunwindstack
27 std::shared_ptr<unwindstack::Memory>& memory() { return memory_; }
29 void SetMapsForTesting(std::unique_ptr<unwindstack::Maps> maps) {
30 maps_ = std::move(maps);
34 std::unique_ptr<unwindstack::Maps> maps_;
35 std::shared_ptr<unwindstack::Memory> memory_;
40 #endif // BASE_PROFILER_NATIVE_UNWINDER_ANDROID_MEMORY_REGIONS_MAP_IMPL_H_