diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-24 11:40:17 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-24 12:42:11 +0000 |
commit | 5d87695f37678f96492b258bbab36486c59866b4 (patch) | |
tree | be9783bbaf04fb930c4d74ca9c00b5e7954c8bc6 /chromium/media/base/unaligned_shared_memory.h | |
parent | 6c11fb357ec39bf087b8b632e2b1e375aef1b38b (diff) | |
download | qtwebengine-chromium-5d87695f37678f96492b258bbab36486c59866b4.tar.gz |
BASELINE: Update Chromium to 75.0.3770.56
Change-Id: I86d2007fd27a45d5797eee06f4c9369b8b50ac4f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/media/base/unaligned_shared_memory.h')
-rw-r--r-- | chromium/media/base/unaligned_shared_memory.h | 35 |
1 files changed, 35 insertions, 0 deletions
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 <stdint.h> #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_ |