[net/reporting,server,socket] default member initializers
This change was partially automated with run-clang-tidy.py.
This should cause no functional changes.
Bug: 1334056
Change-Id: I525077205ed3cc640a42a286238f73c203d72c35
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3694548
Commit-Queue: Tsuyoshi Horo <[email protected]>
Reviewed-by: Kenichi Ishibashi <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1012271}
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc
index ae102ac..c5dded33 100644
--- a/net/socket/client_socket_pool_base_unittest.cc
+++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -148,10 +148,7 @@
class MockClientSocket : public StreamSocket {
public:
explicit MockClientSocket(net::NetLog* net_log)
- : connected_(false),
- has_unread_data_(false),
- net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::SOCKET)),
- was_used_to_convey_data_(false) {}
+ : net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::SOCKET)) {}
MockClientSocket(const MockClientSocket&) = delete;
MockClientSocket& operator=(const MockClientSocket&) = delete;
@@ -218,17 +215,17 @@
void ApplySocketTag(const SocketTag& tag) override {}
private:
- bool connected_;
- bool has_unread_data_;
+ bool connected_ = false;
+ bool has_unread_data_ = false;
NetLogWithSource net_log_;
- bool was_used_to_convey_data_;
+ bool was_used_to_convey_data_ = false;
};
class TestConnectJob;
class MockClientSocketFactory : public ClientSocketFactory {
public:
- MockClientSocketFactory() : allocation_count_(0) {}
+ MockClientSocketFactory() = default;
std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket(
DatagramSocket::BindType bind_type,
@@ -273,7 +270,7 @@
int allocation_count() const { return allocation_count_; }
private:
- int allocation_count_;
+ int allocation_count_ = 0;
std::vector<TestConnectJob*> waiting_jobs_;
};
@@ -320,10 +317,7 @@
NetLogSourceType::TRANSPORT_CONNECT_JOB,
NetLogEventType::TRANSPORT_CONNECT_JOB_CONNECT),
job_type_(job_type),
- client_socket_factory_(client_socket_factory),
- load_state_(LOAD_STATE_IDLE),
- has_established_connection_(false),
- store_additional_error_state_(false) {}
+ client_socket_factory_(client_socket_factory) {}
TestConnectJob(const TestConnectJob&) = delete;
TestConnectJob& operator=(const TestConnectJob&) = delete;
@@ -517,9 +511,9 @@
bool waiting_success_;
const JobType job_type_;
const raw_ptr<MockClientSocketFactory> client_socket_factory_;
- LoadState load_state_;
- bool has_established_connection_;
- bool store_additional_error_state_;
+ LoadState load_state_ = LOAD_STATE_IDLE;
+ bool has_established_connection_ = false;
+ bool store_additional_error_state_ = false;
base::WeakPtrFactory<TestConnectJob> weak_factory_{this};
};
@@ -4860,7 +4854,7 @@
public:
MockLayeredPool(TransportClientSocketPool* pool,
const ClientSocketPool::GroupId& group_id)
- : pool_(pool), group_id_(group_id), can_release_connection_(true) {
+ : pool_(pool), group_id_(group_id) {
pool_->AddHigherLayeredPool(this);
}
@@ -4902,7 +4896,7 @@
ClientSocketHandle handle_;
TestCompletionCallback callback_;
const ClientSocketPool::GroupId group_id_;
- bool can_release_connection_;
+ bool can_release_connection_ = true;
};
// Tests the basic case of closing an idle socket in a higher layered pool when