Skip to content

Commit

Permalink
net: Add out-of-line copy ctors for complex classes.
Browse files Browse the repository at this point in the history
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=agl@chromium.org, dcheng@chromium.org, thakis@chromium.org

Review URL: https://codereview.chromium.org/1728333003

Cr-Commit-Position: refs/heads/master@{#377976}
  • Loading branch information
vmpstr authored and Commit bot committed Feb 26, 2016
1 parent 780523e commit acd23b7
Show file tree
Hide file tree
Showing 94 changed files with 192 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/base/ip_address.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ IPAddress::IPAddress() {}

IPAddress::IPAddress(const IPAddressNumber& address) : ip_address_(address) {}

IPAddress::IPAddress(const IPAddress& other) = default;

IPAddress::IPAddress(const uint8_t* address, size_t address_len)
: ip_address_(address, address + address_len) {}

Expand Down
2 changes: 2 additions & 0 deletions net/base/ip_address.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ class NET_EXPORT IPAddress {
// Creates an IP address from a deprecated IPAddressNumber.
explicit IPAddress(const IPAddressNumber& address);

IPAddress(const IPAddress& other);

// Copies the input address to |ip_address_|. The input is expected to be in
// network byte order.
template <size_t N>
Expand Down
2 changes: 2 additions & 0 deletions net/base/load_timing_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ LoadTimingInfo::LoadTimingInfo() : socket_reused(false),
socket_log_id(NetLog::Source::kInvalidId) {
}

LoadTimingInfo::LoadTimingInfo(const LoadTimingInfo& other) = default;

LoadTimingInfo::~LoadTimingInfo() {}

} // namespace net
Expand Down
1 change: 1 addition & 0 deletions net/base/load_timing_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ struct NET_EXPORT LoadTimingInfo {
};

LoadTimingInfo();
LoadTimingInfo(const LoadTimingInfo& other);
~LoadTimingInfo();

// True if the socket was reused. When true, DNS, connect, and SSL times
Expand Down
2 changes: 2 additions & 0 deletions net/base/network_interfaces.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ NetworkInterface::NetworkInterface(const std::string& name,
ip_address_attributes(ip_address_attributes) {
}

NetworkInterface::NetworkInterface(const NetworkInterface& other) = default;

NetworkInterface::~NetworkInterface() {
}

Expand Down
1 change: 1 addition & 0 deletions net/base/network_interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ struct NET_EXPORT NetworkInterface {
const IPAddressNumber& address,
uint32_t prefix_length,
int ip_address_attributes);
NetworkInterface(const NetworkInterface& other);
~NetworkInterface();

std::string name;
Expand Down
2 changes: 2 additions & 0 deletions net/base/prioritized_dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ PrioritizedDispatcher::Limits::Limits(Priority num_priorities,
size_t total_jobs)
: total_jobs(total_jobs), reserved_slots(num_priorities) {}

PrioritizedDispatcher::Limits::Limits(const Limits& other) = default;

PrioritizedDispatcher::Limits::~Limits() {}

PrioritizedDispatcher::PrioritizedDispatcher(const Limits& limits)
Expand Down
1 change: 1 addition & 0 deletions net/base/prioritized_dispatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class NET_EXPORT_PRIVATE PrioritizedDispatcher {
// for priority 3 or above.
struct NET_EXPORT_PRIVATE Limits {
Limits(Priority num_priorities, size_t total_jobs);
Limits(const Limits& other);
~Limits();

// Total allowed running jobs.
Expand Down
2 changes: 2 additions & 0 deletions net/cert/cert_verify_result.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ CertVerifyResult::CertVerifyResult() {
Reset();
}

CertVerifyResult::CertVerifyResult(const CertVerifyResult& other) = default;

CertVerifyResult::~CertVerifyResult() {
}

Expand Down
1 change: 1 addition & 0 deletions net/cert/cert_verify_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class X509Certificate;
class NET_EXPORT CertVerifyResult {
public:
CertVerifyResult();
CertVerifyResult(const CertVerifyResult& other);
~CertVerifyResult();

void Reset();
Expand Down
2 changes: 2 additions & 0 deletions net/cert/ct_verify_result.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ CTVerifyResult::CTVerifyResult()
ct::CertPolicyCompliance::CERT_POLICY_COMPLIES_VIA_SCTS),
ev_policy_compliance(ct::EVPolicyCompliance::EV_POLICY_DOES_NOT_APPLY) {}

CTVerifyResult::CTVerifyResult(const CTVerifyResult& other) = default;

CTVerifyResult::~CTVerifyResult() {}

} // namespace ct
Expand Down
1 change: 1 addition & 0 deletions net/cert/ct_verify_result.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ typedef std::vector<scoped_refptr<SignedCertificateTimestamp> > SCTList;
// connection.
struct NET_EXPORT CTVerifyResult {
CTVerifyResult();
CTVerifyResult(const CTVerifyResult& other);
~CTVerifyResult();

// SCTs from known logs where the signature verified correctly.
Expand Down
3 changes: 3 additions & 0 deletions net/cert/multi_threaded_cert_verifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ MultiThreadedCertVerifier::RequestParams::RequestParams(
hash_values.push_back(additional_trust_anchors[i]->fingerprint());
}

MultiThreadedCertVerifier::RequestParams::RequestParams(
const RequestParams& other) = default;

MultiThreadedCertVerifier::RequestParams::~RequestParams() {}

bool MultiThreadedCertVerifier::RequestParams::operator<(
Expand Down
1 change: 1 addition & 0 deletions net/cert/multi_threaded_cert_verifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class NET_EXPORT_PRIVATE MultiThreadedCertVerifier
const std::string& ocsp_response_arg,
int flags_arg,
const CertificateList& additional_trust_anchors);
RequestParams(const RequestParams& other);
~RequestParams();

bool operator<(const RequestParams& other) const;
Expand Down
3 changes: 3 additions & 0 deletions net/cert/nss_cert_database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ NSSCertDatabase::ImportCertFailure::ImportCertFailure(
int err)
: certificate(cert), net_error(err) {}

NSSCertDatabase::ImportCertFailure::ImportCertFailure(
const ImportCertFailure& other) = default;

NSSCertDatabase::ImportCertFailure::~ImportCertFailure() {}

NSSCertDatabase::NSSCertDatabase(crypto::ScopedPK11Slot public_slot,
Expand Down
1 change: 1 addition & 0 deletions net/cert/nss_cert_database.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class NET_EXPORT NSSCertDatabase {
struct NET_EXPORT ImportCertFailure {
public:
ImportCertFailure(const scoped_refptr<X509Certificate>& cert, int err);
ImportCertFailure(const ImportCertFailure& other);
~ImportCertFailure();

scoped_refptr<X509Certificate> certificate;
Expand Down
2 changes: 2 additions & 0 deletions net/cookies/canonical_cookie.cc
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ CanonicalCookie::CanonicalCookie(const GURL& url, const ParsedCookie& pc)
domain_ = cookie_domain;
}

CanonicalCookie::CanonicalCookie(const CanonicalCookie& other) = default;

CanonicalCookie::~CanonicalCookie() {
}

Expand Down
2 changes: 2 additions & 0 deletions net/cookies/canonical_cookie.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class NET_EXPORT CanonicalCookie {
// in which pre-validation of the ParsedCookie has not been done.
CanonicalCookie(const GURL& url, const ParsedCookie& pc);

CanonicalCookie(const CanonicalCookie& other);

~CanonicalCookie();

// Supports the default copy constructor.
Expand Down
2 changes: 2 additions & 0 deletions net/disk_cache/blockfile/index_table_v3.cc
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ void EntryCell::Serialize(IndexCell* destination) const {
EntrySet::EntrySet() : evicted_count(0), current(0) {
}

EntrySet::EntrySet(const EntrySet& other) = default;

EntrySet::~EntrySet() {
}

Expand Down
1 change: 1 addition & 0 deletions net/disk_cache/blockfile/index_table_v3.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class NET_EXPORT_PRIVATE EntryCell {
// Keeps a collection of EntryCells in order to be processed.
struct NET_EXPORT_PRIVATE EntrySet {
EntrySet();
EntrySet(const EntrySet& other);
~EntrySet();

int evicted_count; // The numebr of evicted entries in this set.
Expand Down
2 changes: 2 additions & 0 deletions net/dns/dns_config_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ DnsConfig::DnsConfig()
edns0(false),
use_local_ipv6(false) {}

DnsConfig::DnsConfig(const DnsConfig& other) = default;

DnsConfig::~DnsConfig() {}

bool DnsConfig::Equals(const DnsConfig& d) const {
Expand Down
1 change: 1 addition & 0 deletions net/dns/dns_config_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class NET_EXPORT_PRIVATE NameServerClassifier {
// DnsConfig stores configuration of the system resolver.
struct NET_EXPORT_PRIVATE DnsConfig {
DnsConfig();
DnsConfig(const DnsConfig& other);
virtual ~DnsConfig();

bool Equals(const DnsConfig& d) const;
Expand Down
3 changes: 3 additions & 0 deletions net/dns/host_resolver_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1854,6 +1854,9 @@ HostResolverImpl::ProcTaskParams::ProcTaskParams(
max_retry_attempts = kDefaultMaxRetryAttempts;
}

HostResolverImpl::ProcTaskParams::ProcTaskParams(const ProcTaskParams& other) =
default;

HostResolverImpl::ProcTaskParams::~ProcTaskParams() {}

HostResolverImpl::HostResolverImpl(const Options& options, NetLog* net_log)
Expand Down
2 changes: 2 additions & 0 deletions net/dns/host_resolver_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class NET_EXPORT HostResolverImpl
// Sets up defaults.
ProcTaskParams(HostResolverProc* resolver_proc, size_t max_retry_attempts);

ProcTaskParams(const ProcTaskParams& other);

~ProcTaskParams();

// The procedure to use for resolving host names. This will be NULL, except
Expand Down
5 changes: 5 additions & 0 deletions net/ftp/ftp_ctrl_response_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const int FtpCtrlResponse::kInvalidStatusCode = -1;

FtpCtrlResponse::FtpCtrlResponse() : status_code(kInvalidStatusCode) {}

FtpCtrlResponse::FtpCtrlResponse(const FtpCtrlResponse& other) = default;

FtpCtrlResponse::~FtpCtrlResponse() {}

FtpCtrlResponseBuffer::FtpCtrlResponseBuffer(const BoundNetLog& net_log)
Expand Down Expand Up @@ -112,6 +114,9 @@ FtpCtrlResponseBuffer::ParsedLine::ParsedLine()
status_code(FtpCtrlResponse::kInvalidStatusCode) {
}

FtpCtrlResponseBuffer::ParsedLine::ParsedLine(const ParsedLine& other) =
default;

// static
FtpCtrlResponseBuffer::ParsedLine FtpCtrlResponseBuffer::ParseLine(
const std::string& line) {
Expand Down
2 changes: 2 additions & 0 deletions net/ftp/ftp_ctrl_response_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ struct NET_EXPORT_PRIVATE FtpCtrlResponse {
static const int kInvalidStatusCode;

FtpCtrlResponse();
FtpCtrlResponse(const FtpCtrlResponse& other);
~FtpCtrlResponse();

int status_code; // Three-digit status code.
Expand All @@ -44,6 +45,7 @@ class NET_EXPORT_PRIVATE FtpCtrlResponseBuffer {
private:
struct ParsedLine {
ParsedLine();
ParsedLine(const ParsedLine& other);

// Indicates that this line begins with a valid 3-digit status code.
bool has_status_code;
Expand Down
2 changes: 2 additions & 0 deletions net/http/http_auth_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@ HttpAuthCache::Entry* HttpAuthCache::Add(const GURL& origin,
return entry;
}

HttpAuthCache::Entry::Entry(const Entry& other) = default;

HttpAuthCache::Entry::~Entry() {
}

Expand Down
1 change: 1 addition & 0 deletions net/http/http_auth_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class NET_EXPORT_PRIVATE HttpAuthCache {
public:
class NET_EXPORT_PRIVATE Entry {
public:
Entry(const Entry& other);
~Entry();

const GURL& origin() const {
Expand Down
2 changes: 2 additions & 0 deletions net/http/http_network_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ HttpNetworkSession::Params::Params()
quic_supported_versions.push_back(QUIC_VERSION_27);
}

HttpNetworkSession::Params::Params(const Params& other) = default;

HttpNetworkSession::Params::~Params() {}

// TODO(mbelshe): Move the socket factories into HttpStreamFactory.
Expand Down
1 change: 1 addition & 0 deletions net/http/http_network_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class NET_EXPORT HttpNetworkSession
public:
struct NET_EXPORT Params {
Params();
Params(const Params& other);
~Params();

ClientSocketFactory* client_socket_factory;
Expand Down
2 changes: 2 additions & 0 deletions net/http/http_request_headers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ bool HttpRequestHeaders::Iterator::GetNext() {
}

HttpRequestHeaders::HttpRequestHeaders() {}
HttpRequestHeaders::HttpRequestHeaders(const HttpRequestHeaders& other) =
default;
HttpRequestHeaders::~HttpRequestHeaders() {}

bool HttpRequestHeaders::GetHeader(const base::StringPiece& key,
Expand Down
1 change: 1 addition & 0 deletions net/http/http_request_headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class NET_EXPORT HttpRequestHeaders {
static const char kUserAgent[];

HttpRequestHeaders();
HttpRequestHeaders(const HttpRequestHeaders& other);
~HttpRequestHeaders();

bool IsEmpty() const { return headers_.empty(); }
Expand Down
2 changes: 2 additions & 0 deletions net/http/http_request_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ HttpRequestInfo::HttpRequestInfo()
privacy_mode(PRIVACY_MODE_DISABLED) {
}

HttpRequestInfo::HttpRequestInfo(const HttpRequestInfo& other) = default;

HttpRequestInfo::~HttpRequestInfo() {}

} // namespace net
1 change: 1 addition & 0 deletions net/http/http_request_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ struct NET_EXPORT HttpRequestInfo {
};

HttpRequestInfo();
HttpRequestInfo(const HttpRequestInfo& other);
~HttpRequestInfo();

// The requested URL.
Expand Down
5 changes: 5 additions & 0 deletions net/http/http_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,8 @@ HttpUtil::ValuesIterator::ValuesIterator(
values_.set_quote_chars("\'\"");
}

HttpUtil::ValuesIterator::ValuesIterator(const ValuesIterator& other) = default;

HttpUtil::ValuesIterator::~ValuesIterator() {
}

Expand Down Expand Up @@ -903,6 +905,9 @@ HttpUtil::NameValuePairsIterator::NameValuePairsIterator(
char delimiter)
: NameValuePairsIterator(begin, end, delimiter, VALUES_NOT_OPTIONAL) {}

HttpUtil::NameValuePairsIterator::NameValuePairsIterator(
const NameValuePairsIterator& other) = default;

HttpUtil::NameValuePairsIterator::~NameValuePairsIterator() {}

// We expect properties to be formatted as one of:
Expand Down
3 changes: 3 additions & 0 deletions net/http/http_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ class NET_EXPORT HttpUtil {
ValuesIterator(std::string::const_iterator values_begin,
std::string::const_iterator values_end,
char delimiter);
ValuesIterator(const ValuesIterator& other);
~ValuesIterator();

// Advances the iterator to the next value, if any. Returns true if there
Expand Down Expand Up @@ -338,6 +339,8 @@ class NET_EXPORT HttpUtil {
std::string::const_iterator end,
char delimiter);

NameValuePairsIterator(const NameValuePairsIterator& other);

~NameValuePairsIterator();

// Advances the iterator to the next pair, if any. Returns true if there
Expand Down
3 changes: 3 additions & 0 deletions net/http/mock_gssapi_library_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ MockGSSAPILibrary::SecurityContextQuery::SecurityContextQuery(
}
}

MockGSSAPILibrary::SecurityContextQuery::SecurityContextQuery(
const SecurityContextQuery& other) = default;

MockGSSAPILibrary::SecurityContextQuery::~SecurityContextQuery() {}

MockGSSAPILibrary::MockGSSAPILibrary() {
Expand Down
1 change: 1 addition & 0 deletions net/http/mock_gssapi_library_posix.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class MockGSSAPILibrary : public GSSAPILibrary {
const test::GssContextMockImpl& context_info,
const char* expected_input_token,
const char* output_token);
SecurityContextQuery(const SecurityContextQuery& other);
~SecurityContextQuery();

std::string expected_package;
Expand Down
2 changes: 2 additions & 0 deletions net/http/transport_security_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1256,6 +1256,8 @@ TransportSecurityState::STSStateIterator::~STSStateIterator() {
TransportSecurityState::PKPState::PKPState() : include_subdomains(false) {
}

TransportSecurityState::PKPState::PKPState(const PKPState& other) = default;

TransportSecurityState::PKPState::~PKPState() {
}

Expand Down
1 change: 1 addition & 0 deletions net/http/transport_security_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class NET_EXPORT TransportSecurityState
class NET_EXPORT PKPState {
public:
PKPState();
PKPState(const PKPState& other);
~PKPState();

// The absolute time (UTC) when the |spki_hashes| (and other state) were
Expand Down
2 changes: 2 additions & 0 deletions net/proxy/proxy_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ ProxyConfig::ProxyRules::ProxyRules()
type(TYPE_NO_RULES) {
}

ProxyConfig::ProxyRules::ProxyRules(const ProxyRules& other) = default;

ProxyConfig::ProxyRules::~ProxyRules() {
}

Expand Down
Loading

0 comments on commit acd23b7

Please sign in to comment.