From bcdec0d2ad46b98de14815d3344041d8918149ad Mon Sep 17 00:00:00 2001 From: vmpstr Date: Wed, 13 Apr 2016 18:24:52 -0700 Subject: [PATCH] Add out-of-line copy ctors for complex classes. (new in win_clang) 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=dcheng@chromium.org, thakis@chromium.org TBR=jochen@chromium.org, sievers@chromium.org, mcasas@chromium.org, alekseys@chromium.org, cpu@chromium.org Review URL: https://codereview.chromium.org/1886923002 Cr-Commit-Position: refs/heads/master@{#387193} --- base/win/shortcut.cc | 3 +++ base/win/shortcut.h | 1 + .../media_galleries/win/mtp_device_delegate_impl_win.cc | 3 +++ .../media_galleries/win/mtp_device_delegate_impl_win.h | 1 + chrome/browser/media_galleries/win/snapshot_file_details.cc | 6 ++++++ chrome/browser/media_galleries/win/snapshot_file_details.h | 2 ++ chrome/browser/net/service_providers_win.cc | 3 +++ chrome/browser/net/service_providers_win.h | 1 + chrome/installer/util/shell_util.cc | 3 +++ chrome/installer/util/shell_util.h | 1 + components/os_crypt/ie7_password_win.cc | 2 ++ components/os_crypt/ie7_password_win.h | 1 + components/storage_monitor/portable_device_watcher_win.cc | 3 +++ components/storage_monitor/portable_device_watcher_win.h | 1 + .../common/gpu/media/dxva_video_decode_accelerator_win.cc | 3 +++ .../common/gpu/media/dxva_video_decode_accelerator_win.h | 1 + content/test/dwrite_font_fake_sender_win.cc | 2 ++ content/test/dwrite_font_fake_sender_win.h | 2 ++ media/capture/video/video_capture_device.cc | 2 ++ media/capture/video/video_capture_device.h | 1 + printing/backend/print_backend.cc | 3 +++ printing/backend/print_backend.h | 1 + sandbox/win/src/interception.cc | 3 +++ sandbox/win/src/interception.h | 1 + 24 files changed, 50 insertions(+) diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc index 5621b94a539ac1..f574809996498d 100644 --- a/base/win/shortcut.cc +++ b/base/win/shortcut.cc @@ -46,6 +46,9 @@ ShortcutProperties::ShortcutProperties() : icon_index(-1), dual_mode(false), options(0U) { } +ShortcutProperties::ShortcutProperties(const ShortcutProperties& other) = + default; + ShortcutProperties::~ShortcutProperties() { } diff --git a/base/win/shortcut.h b/base/win/shortcut.h index c592b28f87eed3..c48ec12fe17e3b 100644 --- a/base/win/shortcut.h +++ b/base/win/shortcut.h @@ -51,6 +51,7 @@ struct BASE_EXPORT ShortcutProperties { }; ShortcutProperties(); + ShortcutProperties(const ShortcutProperties& other); ~ShortcutProperties(); void set_target(const FilePath& target_in) { diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc index 3a4406416ebc47..cb688a93d448b0 100644 --- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc +++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.cc @@ -359,6 +359,9 @@ MTPDeviceDelegateImplWin::PendingTaskInfo::PendingTaskInfo( reply(reply) { } +MTPDeviceDelegateImplWin::PendingTaskInfo::PendingTaskInfo( + const PendingTaskInfo& other) = default; + MTPDeviceDelegateImplWin::PendingTaskInfo::~PendingTaskInfo() { } diff --git a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h index c1df0f446a1975..38d498057d4865 100644 --- a/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h +++ b/chrome/browser/media_galleries/win/mtp_device_delegate_impl_win.h @@ -77,6 +77,7 @@ class MTPDeviceDelegateImplWin : public MTPDeviceAsyncDelegate { PendingTaskInfo(const tracked_objects::Location& location, const base::Callback& task, const base::Callback& reply); + PendingTaskInfo(const PendingTaskInfo& other); ~PendingTaskInfo(); const tracked_objects::Location location; diff --git a/chrome/browser/media_galleries/win/snapshot_file_details.cc b/chrome/browser/media_galleries/win/snapshot_file_details.cc index 57a67143e8023b..d57df4a76db12f 100644 --- a/chrome/browser/media_galleries/win/snapshot_file_details.cc +++ b/chrome/browser/media_galleries/win/snapshot_file_details.cc @@ -24,6 +24,9 @@ SnapshotRequestInfo::SnapshotRequestInfo( error_callback(error_callback) { } +SnapshotRequestInfo::SnapshotRequestInfo(const SnapshotRequestInfo& other) = + default; + SnapshotRequestInfo::~SnapshotRequestInfo() { } @@ -38,6 +41,9 @@ SnapshotFileDetails::SnapshotFileDetails( bytes_written_(0) { } +SnapshotFileDetails::SnapshotFileDetails(const SnapshotFileDetails& other) = + default; + SnapshotFileDetails::~SnapshotFileDetails() { file_stream_.Release(); } diff --git a/chrome/browser/media_galleries/win/snapshot_file_details.h b/chrome/browser/media_galleries/win/snapshot_file_details.h index 573cd00be570a5..a46d0b6183ac79 100644 --- a/chrome/browser/media_galleries/win/snapshot_file_details.h +++ b/chrome/browser/media_galleries/win/snapshot_file_details.h @@ -18,6 +18,7 @@ struct SnapshotRequestInfo { const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback& success_callback, const MTPDeviceAsyncDelegate::ErrorCallback& error_callback); + SnapshotRequestInfo(const SnapshotRequestInfo& other); ~SnapshotRequestInfo(); // Device file path. @@ -38,6 +39,7 @@ struct SnapshotRequestInfo { class SnapshotFileDetails { public: explicit SnapshotFileDetails(const SnapshotRequestInfo& request_info); + SnapshotFileDetails(const SnapshotFileDetails& other); ~SnapshotFileDetails(); void set_file_info(const base::File::Info& file_info); diff --git a/chrome/browser/net/service_providers_win.cc b/chrome/browser/net/service_providers_win.cc index 27a68c936bea10..66fb715f991b84 100644 --- a/chrome/browser/net/service_providers_win.cc +++ b/chrome/browser/net/service_providers_win.cc @@ -16,6 +16,9 @@ WinsockLayeredServiceProvider::WinsockLayeredServiceProvider() { } +WinsockLayeredServiceProvider::WinsockLayeredServiceProvider( + const WinsockLayeredServiceProvider& other) = default; + WinsockLayeredServiceProvider::~WinsockLayeredServiceProvider() { } diff --git a/chrome/browser/net/service_providers_win.h b/chrome/browser/net/service_providers_win.h index 7ca1a8ca60fc9b..49994655315f99 100644 --- a/chrome/browser/net/service_providers_win.h +++ b/chrome/browser/net/service_providers_win.h @@ -19,6 +19,7 @@ typedef std::vector WinsockNamespaceProviderList; struct WinsockLayeredServiceProvider { WinsockLayeredServiceProvider(); + WinsockLayeredServiceProvider(const WinsockLayeredServiceProvider& other); ~WinsockLayeredServiceProvider(); base::string16 name; diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 202d8716381ad6..6a00618bac830d 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -1391,6 +1391,9 @@ ShellUtil::ShortcutProperties::ShortcutProperties(ShellChange level_in) pin_to_taskbar(false), options(0U) {} +ShellUtil::ShortcutProperties::ShortcutProperties( + const ShortcutProperties& other) = default; + ShellUtil::ShortcutProperties::~ShortcutProperties() { } diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h index c169018f9ad111..ccdb1d142cc548 100644 --- a/chrome/installer/util/shell_util.h +++ b/chrome/installer/util/shell_util.h @@ -97,6 +97,7 @@ class ShellUtil { }; explicit ShortcutProperties(ShellChange level_in); + ShortcutProperties(const ShortcutProperties& other); ~ShortcutProperties(); // Sets the target executable to launch from this shortcut. diff --git a/components/os_crypt/ie7_password_win.cc b/components/os_crypt/ie7_password_win.cc index 662b35e16e67ea..f5e9ac1ce2030c 100644 --- a/components/os_crypt/ie7_password_win.cc +++ b/components/os_crypt/ie7_password_win.cc @@ -55,6 +55,8 @@ struct PasswordEntry { IE7PasswordInfo::IE7PasswordInfo() { } +IE7PasswordInfo::IE7PasswordInfo(const IE7PasswordInfo& other) = default; + IE7PasswordInfo::~IE7PasswordInfo() { } diff --git a/components/os_crypt/ie7_password_win.h b/components/os_crypt/ie7_password_win.h index 5757714a6c0102..07e2f2e45193ce 100644 --- a/components/os_crypt/ie7_password_win.h +++ b/components/os_crypt/ie7_password_win.h @@ -14,6 +14,7 @@ // Contains the information read from the IE7/IE8 Storage2 key in the registry. struct IE7PasswordInfo { IE7PasswordInfo(); + IE7PasswordInfo(const IE7PasswordInfo& other); ~IE7PasswordInfo(); // Hash of the url. diff --git a/components/storage_monitor/portable_device_watcher_win.cc b/components/storage_monitor/portable_device_watcher_win.cc index bd94d8d5f88003..421e112602c307 100644 --- a/components/storage_monitor/portable_device_watcher_win.cc +++ b/components/storage_monitor/portable_device_watcher_win.cc @@ -481,6 +481,9 @@ PortableDeviceWatcherWin::DeviceStorageObject::DeviceStorageObject( PortableDeviceWatcherWin::DeviceDetails::DeviceDetails() { } +PortableDeviceWatcherWin::DeviceDetails::DeviceDetails( + const DeviceDetails& other) = default; + PortableDeviceWatcherWin::DeviceDetails::~DeviceDetails() { } diff --git a/components/storage_monitor/portable_device_watcher_win.h b/components/storage_monitor/portable_device_watcher_win.h index becb7eaa1083f0..b991471799d136 100644 --- a/components/storage_monitor/portable_device_watcher_win.h +++ b/components/storage_monitor/portable_device_watcher_win.h @@ -53,6 +53,7 @@ class PortableDeviceWatcherWin { // Struct to store attached MTP device details. struct DeviceDetails { DeviceDetails(); + DeviceDetails(const DeviceDetails& other); ~DeviceDetails(); // Device name. diff --git a/content/common/gpu/media/dxva_video_decode_accelerator_win.cc b/content/common/gpu/media/dxva_video_decode_accelerator_win.cc index 2e376f245256c8..111193febecfbf 100644 --- a/content/common/gpu/media/dxva_video_decode_accelerator_win.cc +++ b/content/common/gpu/media/dxva_video_decode_accelerator_win.cc @@ -891,6 +891,9 @@ DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo( output_sample.Attach(sample); } +DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo( + const PendingSampleInfo& other) = default; + DXVAVideoDecodeAccelerator::PendingSampleInfo::~PendingSampleInfo() {} DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( diff --git a/content/common/gpu/media/dxva_video_decode_accelerator_win.h b/content/common/gpu/media/dxva_video_decode_accelerator_win.h index 7f0c0136e79ee4..2d936ac99f928f 100644 --- a/content/common/gpu/media/dxva_video_decode_accelerator_win.h +++ b/content/common/gpu/media/dxva_video_decode_accelerator_win.h @@ -374,6 +374,7 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator // Contains information about a decoded sample. struct PendingSampleInfo { PendingSampleInfo(int32_t buffer_id, IMFSample* sample); + PendingSampleInfo(const PendingSampleInfo& other); ~PendingSampleInfo(); int32_t input_buffer_id; diff --git a/content/test/dwrite_font_fake_sender_win.cc b/content/test/dwrite_font_fake_sender_win.cc index 62f5fed40817a6..201454d071a088 100644 --- a/content/test/dwrite_font_fake_sender_win.cc +++ b/content/test/dwrite_font_fake_sender_win.cc @@ -38,6 +38,8 @@ IPC::Sender* CreateFakeCollectionSender() { FakeFont::FakeFont(const base::string16& name) : font_name_(name) {} +FakeFont::FakeFont(const FakeFont& other) = default; + FakeFont::~FakeFont() = default; FakeFontCollection::FakeFontCollection() = default; diff --git a/content/test/dwrite_font_fake_sender_win.h b/content/test/dwrite_font_fake_sender_win.h index aa0e0a0a108b80..d2929a23c56771 100644 --- a/content/test/dwrite_font_fake_sender_win.h +++ b/content/test/dwrite_font_fake_sender_win.h @@ -32,6 +32,8 @@ class FakeFont { public: explicit FakeFont(const base::string16& name); + FakeFont(const FakeFont& other); + ~FakeFont(); FakeFont& AddFilePath(const base::string16& file_path) { diff --git a/media/capture/video/video_capture_device.cc b/media/capture/video/video_capture_device.cc index 61a752f7ca8c5c..f56b241c1fab54 100644 --- a/media/capture/video/video_capture_device.cc +++ b/media/capture/video/video_capture_device.cc @@ -75,6 +75,8 @@ VideoCaptureDevice::Name::Name(const std::string& name, } #endif +VideoCaptureDevice::Name::Name(const Name& other) = default; + VideoCaptureDevice::Name::~Name() { } diff --git a/media/capture/video/video_capture_device.h b/media/capture/video/video_capture_device.h index 6983865b6802fc..2b2f39ad049dca 100644 --- a/media/capture/video/video_capture_device.h +++ b/media/capture/video/video_capture_device.h @@ -93,6 +93,7 @@ class MEDIA_EXPORT VideoCaptureDevice { const CaptureApiType api_type, const TransportType transport_type); #endif + Name(const Name& other); ~Name(); // Friendly name of a device diff --git a/printing/backend/print_backend.cc b/printing/backend/print_backend.cc index 6c43b648f8777b..f17983778d76a8 100644 --- a/printing/backend/print_backend.cc +++ b/printing/backend/print_backend.cc @@ -26,6 +26,9 @@ PrinterSemanticCapsAndDefaults::PrinterSemanticCapsAndDefaults() bw_model(UNKNOWN_COLOR_MODEL) {} +PrinterSemanticCapsAndDefaults::PrinterSemanticCapsAndDefaults( + const PrinterSemanticCapsAndDefaults& other) = default; + PrinterSemanticCapsAndDefaults::~PrinterSemanticCapsAndDefaults() {} PrinterCapsAndDefaults::PrinterCapsAndDefaults() {} diff --git a/printing/backend/print_backend.h b/printing/backend/print_backend.h index 621278bfc68bc0..56e35754246930 100644 --- a/printing/backend/print_backend.h +++ b/printing/backend/print_backend.h @@ -37,6 +37,7 @@ typedef std::vector PrinterList; struct PRINTING_EXPORT PrinterSemanticCapsAndDefaults { PrinterSemanticCapsAndDefaults(); + PrinterSemanticCapsAndDefaults(const PrinterSemanticCapsAndDefaults& other); ~PrinterSemanticCapsAndDefaults(); bool collate_capable; diff --git a/sandbox/win/src/interception.cc b/sandbox/win/src/interception.cc index feb5d8966daa86..f68cecf1c57459 100644 --- a/sandbox/win/src/interception.cc +++ b/sandbox/win/src/interception.cc @@ -67,6 +67,9 @@ const char kUnloadDLLDummyFunction[] = "@"; InterceptionManager::InterceptionData::InterceptionData() { } +InterceptionManager::InterceptionData::InterceptionData( + const InterceptionData& other) = default; + InterceptionManager::InterceptionData::~InterceptionData() { } diff --git a/sandbox/win/src/interception.h b/sandbox/win/src/interception.h index 4d1ee82ba39948..1116cfeee249fb 100644 --- a/sandbox/win/src/interception.h +++ b/sandbox/win/src/interception.h @@ -137,6 +137,7 @@ class InterceptionManager { // Used to store the interception information until the actual set-up. struct InterceptionData { InterceptionData(); + InterceptionData(const InterceptionData& other); ~InterceptionData(); InterceptionType type; // Interception type.