From 84c91abab33966f928497c24db4a39f436d2dca8 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Fri, 07 Jun 2019 09:50:11 +0000 Subject: [PATCH] Make SharedMemoryMapping move constructor noexcept As LayerTreeHostImpl::UIResourceData move constructor is declared noexcept with default implementation, the move constructor of its members should also be noexcept. GCC will fail to build otherwise for mismatching noexcept declaration. We also set the move assignment operator. Bug: 819294 Change-Id: Icd663da83b882e15f7d16780c9241972e09bc492 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1645297 Commit-Queue: José Dapena Paz Reviewed-by: Daniel Cheng Cr-Commit-Position: refs/heads/master@{#667064} --- diff --git a/base/memory/shared_memory_mapping.cc b/base/memory/shared_memory_mapping.cc index 2be2570..8426fa8 100644 --- a/base/memory/shared_memory_mapping.cc +++ b/base/memory/shared_memory_mapping.cc @@ -33,7 +33,7 @@ SharedMemoryMapping::SharedMemoryMapping() = default; -SharedMemoryMapping::SharedMemoryMapping(SharedMemoryMapping&& mapping) +SharedMemoryMapping::SharedMemoryMapping(SharedMemoryMapping&& mapping) noexcept : memory_(mapping.memory_), size_(mapping.size_), mapped_size_(mapping.mapped_size_), @@ -42,7 +42,7 @@ } SharedMemoryMapping& SharedMemoryMapping::operator=( - SharedMemoryMapping&& mapping) { + SharedMemoryMapping&& mapping) noexcept { Unmap(); memory_ = mapping.memory_; size_ = mapping.size_; @@ -90,9 +90,9 @@ ReadOnlySharedMemoryMapping::ReadOnlySharedMemoryMapping() = default; ReadOnlySharedMemoryMapping::ReadOnlySharedMemoryMapping( - ReadOnlySharedMemoryMapping&&) = default; + ReadOnlySharedMemoryMapping&&) noexcept = default; ReadOnlySharedMemoryMapping& ReadOnlySharedMemoryMapping::operator=( - ReadOnlySharedMemoryMapping&&) = default; + ReadOnlySharedMemoryMapping&&) noexcept = default; ReadOnlySharedMemoryMapping::ReadOnlySharedMemoryMapping( void* address, size_t size, @@ -102,9 +102,9 @@ WritableSharedMemoryMapping::WritableSharedMemoryMapping() = default; WritableSharedMemoryMapping::WritableSharedMemoryMapping( - WritableSharedMemoryMapping&&) = default; + WritableSharedMemoryMapping&&) noexcept = default; WritableSharedMemoryMapping& WritableSharedMemoryMapping::operator=( - WritableSharedMemoryMapping&&) = default; + WritableSharedMemoryMapping&&) noexcept = default; WritableSharedMemoryMapping::WritableSharedMemoryMapping( void* address, size_t size, diff --git a/base/memory/shared_memory_mapping.h b/base/memory/shared_memory_mapping.h index d9569af..2b8858e 100644 --- a/base/memory/shared_memory_mapping.h +++ b/base/memory/shared_memory_mapping.h @@ -32,8 +32,8 @@ SharedMemoryMapping(); // Move operations are allowed. - SharedMemoryMapping(SharedMemoryMapping&& mapping); - SharedMemoryMapping& operator=(SharedMemoryMapping&& mapping); + SharedMemoryMapping(SharedMemoryMapping&& mapping) noexcept; + SharedMemoryMapping& operator=(SharedMemoryMapping&& mapping) noexcept; // Unmaps the region if the mapping is valid. virtual ~SharedMemoryMapping(); @@ -93,8 +93,9 @@ ReadOnlySharedMemoryMapping(); // Move operations are allowed. - ReadOnlySharedMemoryMapping(ReadOnlySharedMemoryMapping&&); - ReadOnlySharedMemoryMapping& operator=(ReadOnlySharedMemoryMapping&&); + ReadOnlySharedMemoryMapping(ReadOnlySharedMemoryMapping&&) noexcept; + ReadOnlySharedMemoryMapping& operator=( + ReadOnlySharedMemoryMapping&&) noexcept; // Returns the base address of the mapping. This is read-only memory. This is // page-aligned. This is nullptr for invalid instances. @@ -171,8 +172,9 @@ WritableSharedMemoryMapping(); // Move operations are allowed. - WritableSharedMemoryMapping(WritableSharedMemoryMapping&&); - WritableSharedMemoryMapping& operator=(WritableSharedMemoryMapping&&); + WritableSharedMemoryMapping(WritableSharedMemoryMapping&&) noexcept; + WritableSharedMemoryMapping& operator=( + WritableSharedMemoryMapping&&) noexcept; // Returns the base address of the mapping. This is writable memory. This is // page-aligned. This is nullptr for invalid instances.