From 5d87695f37678f96492b258bbab36486c59866b4 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Fri, 24 May 2019 11:40:17 +0200 Subject: BASELINE: Update Chromium to 75.0.3770.56 Change-Id: I86d2007fd27a45d5797eee06f4c9369b8b50ac4f Reviewed-by: Alexandru Croitor --- chromium/media/base/unaligned_shared_memory.h | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'chromium/media/base/unaligned_shared_memory.h') diff --git a/chromium/media/base/unaligned_shared_memory.h b/chromium/media/base/unaligned_shared_memory.h index b86961803c6..7e3cbbaef62 100644 --- a/chromium/media/base/unaligned_shared_memory.h +++ b/chromium/media/base/unaligned_shared_memory.h @@ -8,6 +8,7 @@ #include #include "base/macros.h" +#include "base/memory/read_only_shared_memory_region.h" #include "base/memory/shared_memory.h" #include "base/memory/shared_memory_mapping.h" #include "base/memory/unsafe_shared_memory_region.h" @@ -87,6 +88,40 @@ class MEDIA_EXPORT WritableUnalignedMapping { DISALLOW_COPY_AND_ASSIGN(WritableUnalignedMapping); }; +// Wrapper over base::ReadOnlySharedMemoryMapping that is mapped at unaligned +// offsets. +class MEDIA_EXPORT ReadOnlyUnalignedMapping { + public: + // Creates an |WritableUnalignedMapping| instance from a + // |ReadOnlySharedMemoryRegion|. |size| sets the maximum size that may be + // mapped within |region| and |offset| is the offset that will be mapped. + // |region| is not retained and is used only in the constructor. + ReadOnlyUnalignedMapping(const base::ReadOnlySharedMemoryRegion& region, + size_t size, + off_t offset); + + ~ReadOnlyUnalignedMapping(); + + size_t size() const { return size_; } + const void* memory() const; + + // True if the mapping backing the memory is valid. + bool IsValid() const { return mapping_.IsValid(); } + + private: + base::ReadOnlySharedMemoryMapping mapping_; + + // The size of the region associated with |mapping_|. + size_t size_; + + // Difference between actual offset within |mapping_| where data has been + // mapped and requested offset; strictly less than + // base::SysInfo::VMAllocationGranularity(). + size_t misalignment_; + + DISALLOW_COPY_AND_ASSIGN(ReadOnlyUnalignedMapping); +}; + } // namespace media #endif // MEDIA_BASE_UNALIGNED_SHARED_MEMORY_H_ -- cgit v1.2.1