Commit 66971f5a authored by Denis Yaroshevskiy's avatar Denis Yaroshevskiy Committed by Commit Bot

Google C++ style guide recomends nothrow move constructors

and generally applying noexcept where it make sense.
https://google.github.io/styleguide/cppguide.html#noexcept

Noexcept until recently didn't work with out of line default declarations.
This CL tests that now it compiles on all platforms by applying noexcept for
a few default move operations.

Since this CL is useful not only to test but to merge too, I suggest we merge it.

Discussion on noexcept:
https://groups.google.com/a/chromium.org/forum/?utm_medium=email&utm_source=footer#!msg/cxx/ze4WJFg7RvU/6wU_9xltBgAJ

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel
Change-Id: If65a9da6dc803e4dbd03765656a6f122bcb8210e
Reviewed-on: https://chromium-review.googlesource.com/1046005Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarCait Phillips <caitkp@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Commit-Queue: Denis Yaroshevskiy <dyaroshev@yandex-team.ru>
Cr-Commit-Position: refs/heads/master@{#557813}
parent c0426bc1
...@@ -15,9 +15,8 @@ PolicyMap::Entry::Entry() = default; ...@@ -15,9 +15,8 @@ PolicyMap::Entry::Entry() = default;
PolicyMap::Entry::~Entry() = default; PolicyMap::Entry::~Entry() = default;
PolicyMap::Entry::Entry(Entry&&) = default; PolicyMap::Entry::Entry(Entry&&) noexcept = default;
PolicyMap::Entry& PolicyMap::Entry::operator=(Entry&&) noexcept = default;
PolicyMap::Entry& PolicyMap::Entry::operator=(Entry&&) = default;
PolicyMap::Entry PolicyMap::Entry::DeepCopy() const { PolicyMap::Entry PolicyMap::Entry::DeepCopy() const {
Entry copy; Entry copy;
......
...@@ -38,8 +38,8 @@ class POLICY_EXPORT PolicyMap { ...@@ -38,8 +38,8 @@ class POLICY_EXPORT PolicyMap {
Entry(); Entry();
~Entry(); ~Entry();
Entry(Entry&&); Entry(Entry&&) noexcept;
Entry& operator=(Entry&&); Entry& operator=(Entry&&) noexcept;
// Returns a copy of |this|. // Returns a copy of |this|.
Entry DeepCopy() const; Entry DeepCopy() const;
......
...@@ -17,10 +17,10 @@ PreviewsBlackListItem::OptOutRecord::OptOutRecord(base::Time entry_time, ...@@ -17,10 +17,10 @@ PreviewsBlackListItem::OptOutRecord::OptOutRecord(base::Time entry_time,
PreviewsBlackListItem::OptOutRecord::~OptOutRecord() {} PreviewsBlackListItem::OptOutRecord::~OptOutRecord() {}
PreviewsBlackListItem::OptOutRecord::OptOutRecord(OptOutRecord&&) = default; PreviewsBlackListItem::OptOutRecord::OptOutRecord(OptOutRecord&&) noexcept =
default;
PreviewsBlackListItem::OptOutRecord& PreviewsBlackListItem::OptOutRecord:: PreviewsBlackListItem::OptOutRecord& PreviewsBlackListItem::OptOutRecord::
operator=(OptOutRecord&&) = default; operator=(OptOutRecord&&) noexcept = default;
bool PreviewsBlackListItem::OptOutRecord::operator<( bool PreviewsBlackListItem::OptOutRecord::operator<(
const OptOutRecord& other) const { const OptOutRecord& other) const {
......
...@@ -53,8 +53,8 @@ class PreviewsBlackListItem { ...@@ -53,8 +53,8 @@ class PreviewsBlackListItem {
public: public:
OptOutRecord(base::Time entry_time, bool opt_out); OptOutRecord(base::Time entry_time, bool opt_out);
~OptOutRecord(); ~OptOutRecord();
OptOutRecord(OptOutRecord&&); OptOutRecord(OptOutRecord&&) noexcept;
OptOutRecord& operator=(OptOutRecord&&); OptOutRecord& operator=(OptOutRecord&&) noexcept;
// Used to determine eviction priority. // Used to determine eviction priority.
bool operator<(const OptOutRecord& other) const; bool operator<(const OptOutRecord& other) const;
......
...@@ -11,18 +11,25 @@ namespace search_provider_logos { ...@@ -11,18 +11,25 @@ namespace search_provider_logos {
const int64_t kMaxTimeToLiveMS = INT64_C(30 * 24 * 60 * 60 * 1000); // 30 days const int64_t kMaxTimeToLiveMS = INT64_C(30 * 24 * 60 * 60 * 1000); // 30 days
LogoMetadata::LogoMetadata() = default; LogoMetadata::LogoMetadata() = default;
LogoMetadata::LogoMetadata(const LogoMetadata& other) = default; LogoMetadata::LogoMetadata(const LogoMetadata&) = default;
LogoMetadata::LogoMetadata(LogoMetadata&&) noexcept = default;
LogoMetadata& LogoMetadata::operator=(const LogoMetadata&) = default;
LogoMetadata& LogoMetadata::operator=(LogoMetadata&&) noexcept = default;
LogoMetadata::~LogoMetadata() = default; LogoMetadata::~LogoMetadata() = default;
EncodedLogo::EncodedLogo() = default; EncodedLogo::EncodedLogo() = default;
EncodedLogo::EncodedLogo(const EncodedLogo& other) = default; EncodedLogo::EncodedLogo(const EncodedLogo&) = default;
EncodedLogo::EncodedLogo(EncodedLogo&&) noexcept = default;
EncodedLogo& EncodedLogo::operator=(const EncodedLogo&) = default;
EncodedLogo& EncodedLogo::operator=(EncodedLogo&&) noexcept = default;
EncodedLogo::~EncodedLogo() = default; EncodedLogo::~EncodedLogo() = default;
Logo::Logo() = default; Logo::Logo() = default;
Logo::~Logo() = default; Logo::~Logo() = default;
LogoCallbacks::LogoCallbacks() = default; LogoCallbacks::LogoCallbacks() = default;
LogoCallbacks::LogoCallbacks(LogoCallbacks&&) = default; LogoCallbacks::LogoCallbacks(LogoCallbacks&&) noexcept = default;
LogoCallbacks& LogoCallbacks::operator=(LogoCallbacks&&) noexcept = default;
LogoCallbacks::~LogoCallbacks() = default; LogoCallbacks::~LogoCallbacks() = default;
} // namespace search_provider_logos } // namespace search_provider_logos
...@@ -33,7 +33,10 @@ enum class LogoType { ...@@ -33,7 +33,10 @@ enum class LogoType {
// serialize and deserialize that field. // serialize and deserialize that field.
struct LogoMetadata { struct LogoMetadata {
LogoMetadata(); LogoMetadata();
LogoMetadata(const LogoMetadata& other); LogoMetadata(const LogoMetadata&);
LogoMetadata(LogoMetadata&&) noexcept;
LogoMetadata& operator=(const LogoMetadata&);
LogoMetadata& operator=(LogoMetadata&&) noexcept;
~LogoMetadata(); ~LogoMetadata();
// For use by the client ---------------------------------------------------- // For use by the client ----------------------------------------------------
...@@ -116,7 +119,10 @@ enum class LogoCallbackReason { ...@@ -116,7 +119,10 @@ enum class LogoCallbackReason {
struct EncodedLogo { struct EncodedLogo {
EncodedLogo(); EncodedLogo();
EncodedLogo(const EncodedLogo& other); EncodedLogo(const EncodedLogo&);
EncodedLogo(EncodedLogo&&) noexcept;
EncodedLogo& operator=(const EncodedLogo& other);
EncodedLogo& operator=(EncodedLogo&& other) noexcept;
~EncodedLogo(); ~EncodedLogo();
// The jpeg- or png-encoded image. // The jpeg- or png-encoded image.
...@@ -147,7 +153,8 @@ struct LogoCallbacks { ...@@ -147,7 +153,8 @@ struct LogoCallbacks {
LogoCallback on_fresh_decoded_logo_available; LogoCallback on_fresh_decoded_logo_available;
LogoCallbacks(); LogoCallbacks();
LogoCallbacks(LogoCallbacks&&); LogoCallbacks(LogoCallbacks&&) noexcept;
LogoCallbacks& operator=(LogoCallbacks&&) noexcept;
~LogoCallbacks(); ~LogoCallbacks();
}; };
......
...@@ -207,10 +207,10 @@ bool InterprocessFramePool::CanLogSharedMemoryFailure() { ...@@ -207,10 +207,10 @@ bool InterprocessFramePool::CanLogSharedMemoryFailure() {
} }
InterprocessFramePool::PooledBuffer::PooledBuffer() = default; InterprocessFramePool::PooledBuffer::PooledBuffer() = default;
InterprocessFramePool::PooledBuffer::PooledBuffer(PooledBuffer&& other) = InterprocessFramePool::PooledBuffer::PooledBuffer(
default; PooledBuffer&& other) noexcept = default;
InterprocessFramePool::PooledBuffer& InterprocessFramePool::PooledBuffer:: InterprocessFramePool::PooledBuffer& InterprocessFramePool::PooledBuffer::
operator=(PooledBuffer&& other) = default; operator=(PooledBuffer&& other) noexcept = default;
InterprocessFramePool::PooledBuffer::~PooledBuffer() = default; InterprocessFramePool::PooledBuffer::~PooledBuffer() = default;
} // namespace viz } // namespace viz
...@@ -72,8 +72,8 @@ class VIZ_SERVICE_EXPORT InterprocessFramePool { ...@@ -72,8 +72,8 @@ class VIZ_SERVICE_EXPORT InterprocessFramePool {
mojo::ScopedSharedBufferMapping mapping; mojo::ScopedSharedBufferMapping mapping;
PooledBuffer(); PooledBuffer();
PooledBuffer(PooledBuffer&&); PooledBuffer(PooledBuffer&&) noexcept;
PooledBuffer& operator=(PooledBuffer&&); PooledBuffer& operator=(PooledBuffer&&) noexcept;
~PooledBuffer(); ~PooledBuffer();
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment