From 718d68bed07d2fcf9b6c7ab7e051860bdbf1547f Mon Sep 17 00:00:00 2001 From: vmpstr Date: Thu, 25 Feb 2016 16:47:18 -0800 Subject: sync: Add out-of-line copy ctors for complex classes. This patch adds out of line copy constructors for classes that our clang-plugin considers heavy. This is an effort to enable copy constructor checks by default. BUG=436357 R=pavely@chromium.org, dcheng@chromium.org, thakis@chromium.org Review URL: https://codereview.chromium.org/1727833003 Cr-Commit-Position: refs/heads/master@{#377734} --- sync/api/attachments/attachment.cc | 2 ++ sync/api/attachments/attachment.h | 1 + sync/api/attachments/attachment_id.cc | 2 ++ sync/api/attachments/attachment_id.h | 1 + sync/api/entity_change.cc | 2 ++ sync/api/entity_change.h | 1 + sync/api/sync_data.cc | 2 ++ sync/api/sync_data.h | 1 + sync/api/sync_merge_result.cc | 2 ++ sync/api/sync_merge_result.h | 1 + 10 files changed, 15 insertions(+) (limited to 'sync/api') diff --git a/sync/api/attachments/attachment.cc b/sync/api/attachments/attachment.cc index 28e4e08..c9ef927 100644 --- a/sync/api/attachments/attachment.cc +++ b/sync/api/attachments/attachment.cc @@ -11,6 +11,8 @@ namespace syncer { +Attachment::Attachment(const Attachment& other) = default; + Attachment::~Attachment() {} // Static. diff --git a/sync/api/attachments/attachment.h b/sync/api/attachments/attachment.h index 2f2bde0..711bc76 100644 --- a/sync/api/attachments/attachment.h +++ b/sync/api/attachments/attachment.h @@ -26,6 +26,7 @@ namespace syncer { // It is cheap to copy Attachments. Feel free to store and return by value. class SYNC_EXPORT Attachment { public: + Attachment(const Attachment& other); ~Attachment(); // Default copy and assignment are welcome. diff --git a/sync/api/attachments/attachment_id.cc b/sync/api/attachments/attachment_id.cc index 7ebaeaf..6c8fb51 100644 --- a/sync/api/attachments/attachment_id.cc +++ b/sync/api/attachments/attachment_id.cc @@ -74,6 +74,8 @@ const sync_pb::AttachmentIdProto& AttachmentId::GetProto() const { AttachmentId::AttachmentId(sync_pb::AttachmentIdProto* proto) : proto_(proto) {} +AttachmentId::AttachmentId(const AttachmentId& other) = default; + size_t AttachmentId::GetSize() const { return proto_.Get().size_bytes(); } diff --git a/sync/api/attachments/attachment_id.h b/sync/api/attachments/attachment_id.h index 3d2242c..b90bd4a 100644 --- a/sync/api/attachments/attachment_id.h +++ b/sync/api/attachments/attachment_id.h @@ -27,6 +27,7 @@ namespace syncer { // equivalent. class SYNC_EXPORT AttachmentId { public: + AttachmentId(const AttachmentId& other); ~AttachmentId(); // Default copy and assignment are welcome. diff --git a/sync/api/entity_change.cc b/sync/api/entity_change.cc index 70f5add..ef0871e 100644 --- a/sync/api/entity_change.cc +++ b/sync/api/entity_change.cc @@ -28,6 +28,8 @@ EntityChange::EntityChange(std::string client_tag, EntityDataPtr data) : client_tag_(client_tag), type_(type), data_(data) {} +EntityChange::EntityChange(const EntityChange& other) = default; + EntityChange::~EntityChange() {} } // namespace syncer_v2 diff --git a/sync/api/entity_change.h b/sync/api/entity_change.h index db1a9a0..60e512c 100644 --- a/sync/api/entity_change.h +++ b/sync/api/entity_change.h @@ -25,6 +25,7 @@ class SYNC_EXPORT EntityChange { static EntityChange CreateUpdate(std::string client_tag, EntityDataPtr data); static EntityChange CreateDelete(std::string client_tag); + EntityChange(const EntityChange& other); virtual ~EntityChange(); std::string client_tag() const { return client_tag_; } diff --git a/sync/api/sync_data.cc b/sync/api/sync_data.cc index e40e7c3..8559b4c 100644 --- a/sync/api/sync_data.cc +++ b/sync/api/sync_data.cc @@ -77,6 +77,8 @@ SyncData::SyncData(int64_t id, attachment_service_(attachment_service), is_valid_(true) {} +SyncData::SyncData(const SyncData& other) = default; + SyncData::~SyncData() {} // Static. diff --git a/sync/api/sync_data.h b/sync/api/sync_data.h index a516eab..0463e32 100644 --- a/sync/api/sync_data.h +++ b/sync/api/sync_data.h @@ -39,6 +39,7 @@ class SYNC_EXPORT SyncData { public: // Creates an empty and invalid SyncData. SyncData(); + SyncData(const SyncData& other); ~SyncData(); // Default copy and assign welcome. diff --git a/sync/api/sync_merge_result.cc b/sync/api/sync_merge_result.cc index 0231acb0..f5607c7 100644 --- a/sync/api/sync_merge_result.cc +++ b/sync/api/sync_merge_result.cc @@ -18,6 +18,8 @@ SyncMergeResult::SyncMergeResult(ModelType type) pre_association_version_(0) { } +SyncMergeResult::SyncMergeResult(const SyncMergeResult& other) = default; + SyncMergeResult::~SyncMergeResult() { } diff --git a/sync/api/sync_merge_result.h b/sync/api/sync_merge_result.h index f164a4f..bcc2e5b 100644 --- a/sync/api/sync_merge_result.h +++ b/sync/api/sync_merge_result.h @@ -24,6 +24,7 @@ class SYNC_EXPORT SyncMergeResult { public: // Initialize an empty merge result for model type |type|. explicit SyncMergeResult(ModelType type); + SyncMergeResult(const SyncMergeResult& other); ~SyncMergeResult(); // Default copy and assign welcome. -- cgit v1.1