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. From bdc24128b75008743d819e298557a53205706e7c Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Sun, 09 Jun 2019 11:22:25 +0000 Subject: [PATCH] GCC: fix noexcept from move constructor and assign operators of AccountInfo AccountInfo declares them as noexcept and uses default implementation, so all its members (including AccountId) should be noexcept. But AccountId is not noexcept. To fix it we just need to make CoreAccountId move operator/assign operator noexcept. Bug: 819294 Change-Id: Ice38654ab7cf3b9eaa6f54aa36e1fec329264f98 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1645296 Reviewed-by: Roger Tawa Reviewed-by: Sylvain Defresne Commit-Queue: José Dapena Paz Cr-Commit-Position: refs/heads/master@{#667484} --- diff --git a/google_apis/gaia/core_account_id.cc b/google_apis/gaia/core_account_id.cc index d808082..12eefe3 100644 --- a/google_apis/gaia/core_account_id.cc +++ b/google_apis/gaia/core_account_id.cc @@ -6,8 +6,16 @@ CoreAccountId::CoreAccountId() = default; +CoreAccountId::CoreAccountId(const CoreAccountId&) = default; + +CoreAccountId::CoreAccountId(CoreAccountId&&) noexcept = default; + CoreAccountId::~CoreAccountId() = default; +CoreAccountId& CoreAccountId::operator=(const CoreAccountId&) = default; + +CoreAccountId& CoreAccountId::operator=(CoreAccountId&&) noexcept = default; + CoreAccountId::CoreAccountId(const char* id) : id(id) {} CoreAccountId::CoreAccountId(std::string&& id) : id(std::move(id)) {} diff --git a/google_apis/gaia/core_account_id.h b/google_apis/gaia/core_account_id.h index 5ea602a..c2d1911 100644 --- a/google_apis/gaia/core_account_id.h +++ b/google_apis/gaia/core_account_id.h @@ -14,8 +14,13 @@ // for design and tracking). struct CoreAccountId { CoreAccountId(); + CoreAccountId(const CoreAccountId&); + CoreAccountId(CoreAccountId&&) noexcept; ~CoreAccountId(); + CoreAccountId& operator=(const CoreAccountId&); + CoreAccountId& operator=(CoreAccountId&&) noexcept; + // Those implicit constructor and conversion operator allow to // progressively migrate the code to use this struct. Removing // them is tracked by https://crbug.com/959161 From 9aae68736bc7eb7172d0d0c978ecb6d1f75c7b30 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Tue, 11 Jun 2019 10:27:19 +0200 Subject: [PATCH] GCC: add noexcept move assignment in history::URLRow In GCC, build is failing because history::QueryURLResult declares its move assignment operator as noexcept using default implementation. That requires its members to provide a move assignment operator that is noexcept too. But URLRow was missing noexcept declaration in move assignment operator (even though it was providing noexcept to its move constructor). Bug: 819294 Change-Id: I726e3cf7a4a50c9206a5d0fba8a561d363483d4f --- diff --git a/components/history/core/browser/url_row.cc b/components/history/core/browser/url_row.cc index 44c22fd..aec0101 100644 --- a/components/history/core/browser/url_row.cc +++ b/components/history/core/browser/url_row.cc @@ -26,7 +26,7 @@ } URLRow& URLRow::operator=(const URLRow& other) = default; -URLRow& URLRow::operator=(URLRow&& other) = default; +URLRow& URLRow::operator=(URLRow&& other) noexcept = default; void URLRow::Swap(URLRow* other) { std::swap(id_, other->id_); diff --git a/components/history/core/browser/url_row.h b/components/history/core/browser/url_row.h index 8f6f9cf..31a1ef8 100644 --- a/components/history/core/browser/url_row.h +++ b/components/history/core/browser/url_row.h @@ -35,7 +35,7 @@ virtual ~URLRow(); URLRow& operator=(const URLRow& other); - URLRow& operator=(URLRow&& other); + URLRow& operator=(URLRow&& other) noexcept; URLID id() const { return id_; } From 41d954dec0669c9a85730c0bde7df7ba7a0ff43e Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Thu, 06 Jun 2019 15:30:49 +0000 Subject: [PATCH] Fix AutocompleteMatch move constructor/assign operator noexcept For AutocompleteMatch to declare noexcept them, all the contained properties need to be noexcept too. This is required at least for SuggestionAnswer, because base::string16 will make default calculated signature of the move operator noexcept(false). To avoid this issue we explicitely declare them on SuggestionAnswer, and its member classes TextField and ImageLine. Bug: 819294 Change-Id: I8714f2c6352a3292bdebdc3aed9790270e49c580 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1554669 Reviewed-by: Kevin Bailey Commit-Queue: José Dapena Paz Cr-Commit-Position: refs/heads/master@{#666714} --- diff --git a/components/omnibox/browser/suggestion_answer.cc b/components/omnibox/browser/suggestion_answer.cc index 151e55f..a0c9049 100644 --- a/components/omnibox/browser/suggestion_answer.cc +++ b/components/omnibox/browser/suggestion_answer.cc @@ -55,6 +55,12 @@ SuggestionAnswer::TextField::TextField() = default; SuggestionAnswer::TextField::~TextField() = default; +SuggestionAnswer::TextField::TextField(const TextField&) = default; +SuggestionAnswer::TextField::TextField(TextField&&) noexcept = default; +SuggestionAnswer::TextField& SuggestionAnswer::TextField::operator=( + const TextField&) = default; +SuggestionAnswer::TextField& SuggestionAnswer::TextField::operator=( + TextField&&) noexcept = default; // static bool SuggestionAnswer::TextField::ParseTextField(const base::Value& field_json, @@ -93,9 +99,12 @@ SuggestionAnswer::ImageLine::ImageLine() : num_text_lines_(1) {} SuggestionAnswer::ImageLine::ImageLine(const ImageLine& line) = default; +SuggestionAnswer::ImageLine::ImageLine(ImageLine&&) noexcept = default; SuggestionAnswer::ImageLine& SuggestionAnswer::ImageLine::operator=( const ImageLine& line) = default; +SuggestionAnswer::ImageLine& SuggestionAnswer::ImageLine::operator=( + ImageLine&&) noexcept = default; SuggestionAnswer::ImageLine::~ImageLine() {} @@ -251,9 +260,14 @@ SuggestionAnswer::SuggestionAnswer(const SuggestionAnswer& answer) = default; +SuggestionAnswer::SuggestionAnswer(SuggestionAnswer&&) noexcept = default; + SuggestionAnswer& SuggestionAnswer::operator=(const SuggestionAnswer& answer) = default; +SuggestionAnswer& SuggestionAnswer::operator=(SuggestionAnswer&&) noexcept = + default; + SuggestionAnswer::~SuggestionAnswer() = default; // static diff --git a/components/omnibox/browser/suggestion_answer.h b/components/omnibox/browser/suggestion_answer.h index 31be937..2840ace 100644 --- a/components/omnibox/browser/suggestion_answer.h +++ b/components/omnibox/browser/suggestion_answer.h @@ -125,6 +125,10 @@ public: TextField(); ~TextField(); + TextField(const TextField&); + TextField(TextField&&) noexcept; + TextField& operator=(const TextField&); + TextField& operator=(TextField&&) noexcept; // Parses |field_json| dictionary and populates |text_field| with the // contents. If any of the required elements is missing, returns false and @@ -162,7 +166,9 @@ public: ImageLine(); explicit ImageLine(const ImageLine& line); + ImageLine(ImageLine&&) noexcept; ImageLine& operator=(const ImageLine& line); + ImageLine& operator=(ImageLine&&) noexcept; ~ImageLine(); // Parses dictionary |line_json| and populates |image_line| with the @@ -213,7 +219,9 @@ SuggestionAnswer(); SuggestionAnswer(const SuggestionAnswer& answer); + SuggestionAnswer(SuggestionAnswer&&) noexcept; SuggestionAnswer& operator=(const SuggestionAnswer& answer); + SuggestionAnswer& operator=(SuggestionAnswer&&) noexcept; ~SuggestionAnswer(); // Parses dictionary |answer_json| and fills a SuggestionAnswer containing the From 9f99af41cae3cfff3bcdcc856c1539801c9b745b Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Fri, 07 Jun 2019 18:59:59 +0000 Subject: [PATCH] DisjoingRangeLockManager::Lock move constructor/assign operator cannot be noexcept They depend on LockRequest, that depends on WeakPtr, none of them noexcept. Bug: 819294 Change-Id: I04ec15901ca627358df727540597f21f135c129b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1646252 Reviewed-by: Joshua Bell Commit-Queue: José Dapena Paz Cr-Commit-Position: refs/heads/master@{#667260} --- diff --git a/content/browser/indexed_db/scopes/disjoint_range_lock_manager.cc b/content/browser/indexed_db/scopes/disjoint_range_lock_manager.cc index 478a5c9..a18c6cd 100644 --- a/content/browser/indexed_db/scopes/disjoint_range_lock_manager.cc +++ b/content/browser/indexed_db/scopes/disjoint_range_lock_manager.cc @@ -19,14 +19,13 @@ : requested_type(type), locks_holder(std::move(locks_holder)), acquired_callback(std::move(acquired_callback)) {} -DisjointRangeLockManager::LockRequest::LockRequest(LockRequest&&) noexcept = - default; +DisjointRangeLockManager::LockRequest::LockRequest(LockRequest&&) = default; DisjointRangeLockManager::LockRequest::~LockRequest() = default; DisjointRangeLockManager::Lock::Lock() = default; -DisjointRangeLockManager::Lock::Lock(Lock&&) noexcept = default; +DisjointRangeLockManager::Lock::Lock(Lock&&) = default; DisjointRangeLockManager::Lock::~Lock() = default; DisjointRangeLockManager::Lock& DisjointRangeLockManager::Lock::operator=( - DisjointRangeLockManager::Lock&&) noexcept = default; + DisjointRangeLockManager::Lock&&) = default; DisjointRangeLockManager::DisjointRangeLockManager(int level_count) : task_runner_(base::SequencedTaskRunnerHandle::Get()),