xref: /aosp_15_r20/external/cronet/base/memory/platform_shared_memory_mapper.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2022 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_MEMORY_PLATFORM_SHARED_MEMORY_MAPPER_H_
6 #define BASE_MEMORY_PLATFORM_SHARED_MEMORY_MAPPER_H_
7 
8 #include "base/base_export.h"
9 #include "base/memory/shared_memory_mapper.h"
10 
11 namespace base {
12 
13 // Default implementation of the SharedMemoryMapper interface. Implements the
14 // platform-specific logic for mapping shared memory regions into the virtual
15 // address space of the process.
16 class PlatformSharedMemoryMapper : public SharedMemoryMapper {
17  public:
18   std::optional<span<uint8_t>> Map(subtle::PlatformSharedMemoryHandle handle,
19                                    bool write_allowed,
20                                    uint64_t offset,
21                                    size_t size) override;
22 
23   void Unmap(span<uint8_t> mapping) override;
24 };
25 
26 }  // namespace base
27 
28 #endif  // BASE_MEMORY_PLATFORM_SHARED_MEMORY_MAPPER_H_
29