[net/] default member initializers manual fix
This CL is created manually by checking the files which match the
regular expressions "^ +:? +[a-z][A-Za-z_]+\([A-Za-z_:]+\)(,$| \{)",
"^ +[a-z][A-Za-z_]+\(base::[A-Za-z_]+\(\d+\)\)".
This CL fixes default member initializers for raw_ptr<> and some enum
types. And also removes unnecessary null initialization of unique_ptr<>
and scoped_refptr<>.
This should cause no functional changes.
Bug: 1334056
Change-Id: Ia434e79be1f8c9a6d4b01a1a215f7ff7e13302ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3695879
Reviewed-by: Kenichi Ishibashi <[email protected]>
Commit-Queue: Tsuyoshi Horo <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1012413}
diff --git a/net/android/network_change_notifier_android.cc b/net/android/network_change_notifier_android.cc
index d5d84aa..0ae446df 100644
--- a/net/android/network_change_notifier_android.cc
+++ b/net/android/network_change_notifier_android.cc
@@ -214,8 +214,7 @@
NetworkChangeNotifierDelegateAndroid* delegate)
: NetworkChangeNotifier(NetworkChangeCalculatorParamsAndroid()),
delegate_(delegate),
- blocking_thread_objects_(nullptr, base::OnTaskRunnerDeleter(nullptr)),
- force_network_handles_supported_for_testing_(false) {
+ blocking_thread_objects_(nullptr, base::OnTaskRunnerDeleter(nullptr)) {
CHECK_EQ(NetId::INVALID, NetworkChangeNotifier::kInvalidNetworkHandle)
<< "kInvalidNetworkHandle doesn't match NetId::INVALID";
delegate_->RegisterObserver(this);
diff --git a/net/android/network_change_notifier_android.h b/net/android/network_change_notifier_android.h
index 8cf8c1e4..1911af3 100644
--- a/net/android/network_change_notifier_android.h
+++ b/net/android/network_change_notifier_android.h
@@ -117,7 +117,7 @@
// Also used for DnsConfigService which also must live on blocking sequences.
std::unique_ptr<BlockingThreadObjects, base::OnTaskRunnerDeleter>
blocking_thread_objects_;
- bool force_network_handles_supported_for_testing_;
+ bool force_network_handles_supported_for_testing_ = false;
};
} // namespace net
diff --git a/net/android/network_change_notifier_android_unittest.cc b/net/android/network_change_notifier_android_unittest.cc
index 087a258..b3c5a8e0 100644
--- a/net/android/network_change_notifier_android_unittest.cc
+++ b/net/android/network_change_notifier_android_unittest.cc
@@ -40,11 +40,7 @@
typedef NetworkChangeNotifier::NetworkHandle NetworkHandle;
typedef NetworkChangeNotifier::NetworkList NetworkList;
- NetworkChangeNotifierDelegateAndroidObserver()
- : type_notifications_count_(0),
- cost_notifications_count_(0),
- max_bandwidth_notifications_count_(0),
- default_network_active_notifications_count_(0) {}
+ NetworkChangeNotifierDelegateAndroidObserver() = default;
// NetworkChangeNotifierDelegateAndroid::Observer:
void OnConnectionTypeChanged() override { type_notifications_count_++; }
@@ -79,16 +75,16 @@
}
private:
- int type_notifications_count_;
- int cost_notifications_count_;
- int max_bandwidth_notifications_count_;
- int default_network_active_notifications_count_;
+ int type_notifications_count_ = 0;
+ int cost_notifications_count_ = 0;
+ int max_bandwidth_notifications_count_ = 0;
+ int default_network_active_notifications_count_ = 0;
};
class NetworkChangeNotifierObserver
: public NetworkChangeNotifier::ConnectionTypeObserver {
public:
- NetworkChangeNotifierObserver() : notifications_count_(0) {}
+ NetworkChangeNotifierObserver() = default;
// NetworkChangeNotifier::ConnectionTypeObserver:
void OnConnectionTypeChanged(
@@ -101,7 +97,7 @@
}
private:
- int notifications_count_;
+ int notifications_count_ = 0;
};
class NetworkChangeNotifierConnectionCostObserver
diff --git a/net/android/network_change_notifier_delegate_android.cc b/net/android/network_change_notifier_delegate_android.cc
index 00925d0b..f971b575 100644
--- a/net/android/network_change_notifier_delegate_android.cc
+++ b/net/android/network_change_notifier_delegate_android.cc
@@ -94,8 +94,7 @@
// TODO(crbug.com/1042122): Remove once Cronet drops Kitkat support.
is_default_network_active_api_supported_(
base::android::BuildInfo::GetInstance()->sdk_int() >=
- base::android::SDK_VERSION_LOLLIPOP),
- default_network_active_observers_(0) {
+ base::android::SDK_VERSION_LOLLIPOP) {
JNIEnv* env = base::android::AttachCurrentThread();
Java_NetworkChangeNotifier_addNativeObserver(
env, java_network_change_notifier_, reinterpret_cast<intptr_t>(this));
diff --git a/net/android/network_change_notifier_delegate_android.h b/net/android/network_change_notifier_delegate_android.h
index b03763b..228db92 100644
--- a/net/android/network_change_notifier_delegate_android.h
+++ b/net/android/network_change_notifier_delegate_android.h
@@ -228,7 +228,7 @@
// Used to enable/disable default network active notifications on the Java
// side.
- std::atomic_int default_network_active_observers_;
+ std::atomic_int default_network_active_observers_ = 0;
};
} // namespace net
diff --git a/net/base/address_tracker_linux.cc b/net/base/address_tracker_linux.cc
index 44336cae..2b8d6fd 100644
--- a/net/base/address_tracker_linux.cc
+++ b/net/base/address_tracker_linux.cc
@@ -155,11 +155,8 @@
link_callback_(base::DoNothing()),
tunnel_callback_(base::DoNothing()),
ignored_interfaces_(),
- connection_type_initialized_(false),
connection_type_initialized_cv_(&connection_type_lock_),
- current_connection_type_(NetworkChangeNotifier::CONNECTION_NONE),
- tracking_(false),
- threads_waiting_for_connection_type_initialization_(0) {}
+ tracking_(false) {}
AddressTrackerLinux::AddressTrackerLinux(
const base::RepeatingClosure& address_callback,
@@ -171,11 +168,8 @@
link_callback_(link_callback),
tunnel_callback_(tunnel_callback),
ignored_interfaces_(ignored_interfaces),
- connection_type_initialized_(false),
connection_type_initialized_cv_(&connection_type_lock_),
- current_connection_type_(NetworkChangeNotifier::CONNECTION_NONE),
- tracking_(true),
- threads_waiting_for_connection_type_initialization_(0) {
+ tracking_(true) {
DCHECK(!address_callback.is_null());
DCHECK(!link_callback.is_null());
}
diff --git a/net/base/address_tracker_linux.h b/net/base/address_tracker_linux.h
index c993318..db564af 100644
--- a/net/base/address_tracker_linux.h
+++ b/net/base/address_tracker_linux.h
@@ -180,11 +180,12 @@
const std::unordered_set<std::string> ignored_interfaces_;
base::Lock connection_type_lock_;
- bool connection_type_initialized_;
+ bool connection_type_initialized_ = false;
base::ConditionVariable connection_type_initialized_cv_;
- NetworkChangeNotifier::ConnectionType current_connection_type_;
+ NetworkChangeNotifier::ConnectionType current_connection_type_ =
+ NetworkChangeNotifier::CONNECTION_NONE;
bool tracking_;
- int threads_waiting_for_connection_type_initialization_;
+ int threads_waiting_for_connection_type_initialization_ = 0;
// Used to verify single-threaded access in non-tracking mode.
base::ThreadChecker thread_checker_;
diff --git a/net/base/datagram_buffer.cc b/net/base/datagram_buffer.cc
index 7c4c2cfd..7f3798e 100644
--- a/net/base/datagram_buffer.cc
+++ b/net/base/datagram_buffer.cc
@@ -38,7 +38,7 @@
}
DatagramBuffer::DatagramBuffer(size_t max_buffer_size)
- : data_(new char[max_buffer_size]), length_(0) {}
+ : data_(new char[max_buffer_size]) {}
DatagramBuffer::~DatagramBuffer() {}
diff --git a/net/base/datagram_buffer.h b/net/base/datagram_buffer.h
index a7622b8..bb45dd1 100644
--- a/net/base/datagram_buffer.h
+++ b/net/base/datagram_buffer.h
@@ -94,7 +94,7 @@
void Set(const char* buffer, size_t buf_len);
std::unique_ptr<char[]> data_;
- size_t length_;
+ size_t length_ = 0;
};
} // namespace net
diff --git a/net/base/directory_lister_unittest.cc b/net/base/directory_lister_unittest.cc
index 3b6ac1c..d97dd7c 100644
--- a/net/base/directory_lister_unittest.cc
+++ b/net/base/directory_lister_unittest.cc
@@ -35,8 +35,7 @@
class ListerDelegate : public DirectoryLister::DirectoryListerDelegate {
public:
- explicit ListerDelegate(DirectoryLister::ListingType type)
- : lister_(nullptr), type_(type) {}
+ explicit ListerDelegate(DirectoryLister::ListingType type) : type_(type) {}
// When set to true, this signals that the directory list operation should be
// cancelled (And the run loop quit) in the first call to OnListFile.
@@ -113,7 +112,7 @@
bool cancel_lister_on_list_done_ = false;
// This is owned by the individual tests, rather than the ListerDelegate.
- raw_ptr<DirectoryLister> lister_;
+ raw_ptr<DirectoryLister> lister_ = nullptr;
base::RunLoop run_loop;
diff --git a/net/base/io_buffer.cc b/net/base/io_buffer.cc
index 78d4cf4..26e0e02 100644
--- a/net/base/io_buffer.cc
+++ b/net/base/io_buffer.cc
@@ -68,12 +68,12 @@
}
DrainableIOBuffer::DrainableIOBuffer(scoped_refptr<IOBuffer> base, int size)
- : IOBuffer(base->data()), base_(std::move(base)), size_(size), used_(0) {
+ : IOBuffer(base->data()), base_(std::move(base)), size_(size) {
AssertValidBufferSize(size);
}
DrainableIOBuffer::DrainableIOBuffer(scoped_refptr<IOBuffer> base, size_t size)
- : IOBuffer(base->data()), base_(std::move(base)), size_(size), used_(0) {
+ : IOBuffer(base->data()), base_(std::move(base)), size_(size) {
AssertValidBufferSize(size);
}
diff --git a/net/base/io_buffer.h b/net/base/io_buffer.h
index 2de7d9e..b8f9a8a 100644
--- a/net/base/io_buffer.h
+++ b/net/base/io_buffer.h
@@ -176,7 +176,7 @@
scoped_refptr<IOBuffer> base_;
int size_;
- int used_;
+ int used_ = 0;
};
// This version provides a resizable buffer and a changeable offset.
diff --git a/net/base/mock_file_stream.cc b/net/base/mock_file_stream.cc
index 4027a29c..97b1e519 100644
--- a/net/base/mock_file_stream.cc
+++ b/net/base/mock_file_stream.cc
@@ -17,18 +17,12 @@
MockFileStream::MockFileStream(
const scoped_refptr<base::TaskRunner>& task_runner)
- : FileStream(task_runner),
- forced_error_(OK),
- async_error_(false),
- throttled_(false) {}
+ : FileStream(task_runner) {}
MockFileStream::MockFileStream(
base::File file,
const scoped_refptr<base::TaskRunner>& task_runner)
- : FileStream(std::move(file), task_runner),
- forced_error_(OK),
- async_error_(false),
- throttled_(false) {}
+ : FileStream(std::move(file), task_runner) {}
MockFileStream::~MockFileStream() = default;
diff --git a/net/base/mock_file_stream.h b/net/base/mock_file_stream.h
index fba7843..2811810 100644
--- a/net/base/mock_file_stream.h
+++ b/net/base/mock_file_stream.h
@@ -92,9 +92,9 @@
int ErrorCallback(CompletionOnceCallback callback);
int64_t ErrorCallback64(Int64CompletionOnceCallback callback);
- int forced_error_;
- bool async_error_;
- bool throttled_;
+ int forced_error_ = OK;
+ bool async_error_ = false;
+ bool throttled_ = false;
base::OnceClosure throttled_task_;
base::FilePath path_;
diff --git a/net/base/net_error_details.h b/net/base/net_error_details.h
index 728770c..0406760 100644
--- a/net/base/net_error_details.h
+++ b/net/base/net_error_details.h
@@ -15,16 +15,11 @@
// net stack.
struct NET_EXPORT NetErrorDetails {
NetErrorDetails()
- : quic_broken(false),
- quic_connection_error(quic::QUIC_NO_ERROR),
- connection_info(HttpResponseInfo::CONNECTION_INFO_UNKNOWN),
- quic_port_migration_detected(false) {}
+ : quic_broken(false), quic_connection_error(quic::QUIC_NO_ERROR) {}
NetErrorDetails(bool quic_broken, quic::QuicErrorCode quic_connection_error)
: quic_broken(quic_broken),
- quic_connection_error(quic_connection_error),
- connection_info(HttpResponseInfo::CONNECTION_INFO_UNKNOWN),
- quic_port_migration_detected(false) {}
+ quic_connection_error(quic_connection_error) {}
// True if all QUIC alternative services are marked broken for the origin.
bool quic_broken;
@@ -33,10 +28,11 @@
// Early prediction of the connection type that this request attempts to use.
// Will be discarded by upper layers if the connection type can be fetched
// from response header from the server.
- HttpResponseInfo::ConnectionInfo connection_info;
+ HttpResponseInfo::ConnectionInfo connection_info =
+ HttpResponseInfo::CONNECTION_INFO_UNKNOWN;
// True if receives a GoAway frame from the server due to connection
// migration with port change.
- bool quic_port_migration_detected;
+ bool quic_port_migration_detected = false;
};
} // namespace net
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc
index 1dd4055..387c8343 100644
--- a/net/base/network_change_notifier.cc
+++ b/net/base/network_change_notifier.cc
@@ -219,8 +219,7 @@
base::ObserverListPolicy::EXISTING_ONLY)),
default_network_active_observer_list_(
new base::ObserverListThreadSafe<DefaultNetworkActiveObserver>(
- base::ObserverListPolicy::EXISTING_ONLY)),
- connection_cost_observers_added_(false) {}
+ base::ObserverListPolicy::EXISTING_ONLY)) {}
ObserverList(const ObserverList&) = delete;
ObserverList& operator=(const ObserverList&) = delete;
@@ -254,7 +253,7 @@
// Indicates if connection cost observer was added before
// network_change_notifier was initialized, if so ConnectionCostObserverAdded
// is invoked from constructor.
- std::atomic_bool connection_cost_observers_added_;
+ std::atomic_bool connection_cost_observers_added_ = false;
};
class NetworkChangeNotifier::SystemDnsConfigObserver
diff --git a/net/base/network_change_notifier_mac.h b/net/base/network_change_notifier_mac.h
index e76bf881..117f771 100644
--- a/net/base/network_change_notifier_mac.h
+++ b/net/base/network_change_notifier_mac.h
@@ -68,8 +68,8 @@
// These must be constructed before config_watcher_ to ensure
// the lock is in a valid state when Forwarder::Init is called.
- ConnectionType connection_type_;
- bool connection_type_initialized_;
+ ConnectionType connection_type_ = CONNECTION_UNKNOWN;
+ bool connection_type_initialized_ = false;
mutable base::Lock connection_type_lock_;
mutable base::ConditionVariable initial_connection_type_cv_;
base::ScopedCFTypeRef<SCNetworkReachabilityRef> reachability_;
diff --git a/net/base/network_change_notifier_mac.mm b/net/base/network_change_notifier_mac.mm
index 0acd8008..20baff33f 100644
--- a/net/base/network_change_notifier_mac.mm
+++ b/net/base/network_change_notifier_mac.mm
@@ -35,8 +35,6 @@
NetworkChangeNotifierMac::NetworkChangeNotifierMac()
: NetworkChangeNotifier(NetworkChangeCalculatorParamsMac()),
- connection_type_(CONNECTION_UNKNOWN),
- connection_type_initialized_(false),
initial_connection_type_cv_(&connection_type_lock_),
forwarder_(this) {
// Must be initialized after the rest of this object, as it may call back into
diff --git a/net/base/network_change_notifier_win.cc b/net/base/network_change_notifier_win.cc
index b6eab1f..d84e6e1d 100644
--- a/net/base/network_change_notifier_win.cc
+++ b/net/base/network_change_notifier_win.cc
@@ -119,7 +119,6 @@
blocking_task_runner_(
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()})),
last_computed_connection_type_(RecomputeCurrentConnectionType()),
- last_computed_connection_cost_(ConnectionCost::CONNECTION_COST_UNKNOWN),
last_announced_offline_(last_computed_connection_type_ ==
CONNECTION_NONE),
sequence_runner_for_registration_(
diff --git a/net/base/network_change_notifier_win.h b/net/base/network_change_notifier_win.h
index e3fced1d..f1989cb7 100644
--- a/net/base/network_change_notifier_win.h
+++ b/net/base/network_change_notifier_win.h
@@ -141,7 +141,8 @@
mutable base::Lock last_computed_connection_type_lock_;
ConnectionType last_computed_connection_type_;
- std::atomic<ConnectionCost> last_computed_connection_cost_;
+ std::atomic<ConnectionCost> last_computed_connection_cost_ =
+ ConnectionCost::CONNECTION_COST_UNKNOWN;
// Result of IsOffline() when NotifyObserversOfConnectionTypeChange()
// was last called.
diff --git a/net/base/network_config_watcher_mac.cc b/net/base/network_config_watcher_mac.cc
index 06fbb27d9..fbaf0eda 100644
--- a/net/base/network_config_watcher_mac.cc
+++ b/net/base/network_config_watcher_mac.cc
@@ -142,7 +142,7 @@
base::ScopedCFTypeRef<CFRunLoopSourceRef> run_loop_source_;
NetworkConfigWatcherMac::Delegate* const delegate_;
#if !BUILDFLAG(IS_IOS)
- int num_retry_;
+ int num_retry_ = 0;
#endif // !BUILDFLAG(IS_IOS)
base::WeakPtrFactory<NetworkConfigWatcherMacThread> weak_factory_;
};
@@ -151,11 +151,7 @@
NetworkConfigWatcherMac::Delegate* delegate)
: base::Thread("NetworkConfigWatcher"),
delegate_(delegate),
-#if !BUILDFLAG(IS_IOS)
- num_retry_(0),
-#endif // !BUILDFLAG(IS_IOS)
- weak_factory_(this) {
-}
+ weak_factory_(this) {}
NetworkConfigWatcherMacThread::~NetworkConfigWatcherMacThread() {
// This is expected to be invoked during shutdown.
diff --git a/net/base/upload_file_element_reader.cc b/net/base/upload_file_element_reader.cc
index e26398c..b7a9400 100644
--- a/net/base/upload_file_element_reader.cc
+++ b/net/base/upload_file_element_reader.cc
@@ -36,11 +36,7 @@
path_(path),
range_offset_(range_offset),
range_length_(range_length),
- expected_modification_time_(expected_modification_time),
- content_length_(0),
- bytes_remaining_(0),
- next_state_(State::IDLE),
- init_called_while_operation_pending_(false) {
+ expected_modification_time_(expected_modification_time) {
DCHECK(file.IsValid());
DCHECK(task_runner_.get());
file_stream_ = std::make_unique<FileStream>(std::move(file), task_runner);
@@ -56,11 +52,7 @@
path_(path),
range_offset_(range_offset),
range_length_(range_length),
- expected_modification_time_(expected_modification_time),
- content_length_(0),
- bytes_remaining_(0),
- next_state_(State::IDLE),
- init_called_while_operation_pending_(false) {
+ expected_modification_time_(expected_modification_time) {
DCHECK(task_runner_.get());
}
diff --git a/net/base/upload_file_element_reader.h b/net/base/upload_file_element_reader.h
index cfb2b94..89e108a 100644
--- a/net/base/upload_file_element_reader.h
+++ b/net/base/upload_file_element_reader.h
@@ -119,16 +119,16 @@
const uint64_t range_length_;
const base::Time expected_modification_time_;
std::unique_ptr<FileStream> file_stream_;
- uint64_t content_length_;
- uint64_t bytes_remaining_;
+ uint64_t content_length_ = 0;
+ uint64_t bytes_remaining_ = 0;
// File information. Only valid during GET_FILE_INFO_COMPLETE state.
base::File::Info file_info_;
- State next_state_;
+ State next_state_ = State::IDLE;
CompletionOnceCallback pending_callback_;
// True if Init() was called while an async operation was in progress.
- bool init_called_while_operation_pending_;
+ bool init_called_while_operation_pending_ = false;
base::WeakPtrFactory<UploadFileElementReader> weak_ptr_factory_{this};
};
diff --git a/net/cert/cert_database_mac.cc b/net/cert/cert_database_mac.cc
index 7ca7e08..1cd7809c 100644
--- a/net/cert/cert_database_mac.cc
+++ b/net/cert/cert_database_mac.cc
@@ -31,10 +31,7 @@
// TYPE_UI thread. Events will be dispatched from this message loop.
Notifier(CertDatabase* cert_db,
scoped_refptr<base::SingleThreadTaskRunner> task_runner)
- : cert_db_(cert_db),
- task_runner_(std::move(task_runner)),
- registered_(false),
- called_shutdown_(false) {
+ : cert_db_(cert_db), task_runner_(std::move(task_runner)) {
// Ensure an associated CFRunLoop.
DCHECK(base::CurrentUIThread::IsSet());
DCHECK(task_runner_->BelongsToCurrentThread());
@@ -79,8 +76,8 @@
CertDatabase* const cert_db_;
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
- bool registered_;
- bool called_shutdown_;
+ bool registered_ = false;
+ bool called_shutdown_ = false;
};
// static
diff --git a/net/cert/cert_verify_proc_builtin_unittest.cc b/net/cert/cert_verify_proc_builtin_unittest.cc
index e09dbe1..c864606 100644
--- a/net/cert/cert_verify_proc_builtin_unittest.cc
+++ b/net/cert/cert_verify_proc_builtin_unittest.cc
@@ -189,7 +189,7 @@
CertVerifier::Config config_;
std::unique_ptr<net::URLRequestContext> context_;
- raw_ptr<MockSystemTrustStore> mock_system_trust_store_;
+ raw_ptr<MockSystemTrustStore> mock_system_trust_store_ = nullptr;
scoped_refptr<CertVerifyProc> verify_proc_;
scoped_refptr<CertNetFetcherURLRequest> cert_net_fetcher_;
};
diff --git a/net/cert/ct_log_verifier.cc b/net/cert/ct_log_verifier.cc
index 56b41a54..7d6fcca 100644
--- a/net/cert/ct_log_verifier.cc
+++ b/net/cert/ct_log_verifier.cc
@@ -67,7 +67,7 @@
}
CTLogVerifier::CTLogVerifier(std::string description)
- : description_(std::move(description)), public_key_(nullptr) {}
+ : description_(std::move(description)) {}
bool CTLogVerifier::Verify(const ct::SignedEntryData& entry,
const ct::SignedCertificateTimestamp& sct) const {
diff --git a/net/cert/ct_log_verifier.h b/net/cert/ct_log_verifier.h
index 69ea252..09a69a90 100644
--- a/net/cert/ct_log_verifier.h
+++ b/net/cert/ct_log_verifier.h
@@ -96,7 +96,7 @@
ct::DigitallySigned::SignatureAlgorithm signature_algorithm_ =
ct::DigitallySigned::SIG_ALGO_ANONYMOUS;
- raw_ptr<EVP_PKEY> public_key_;
+ raw_ptr<EVP_PKEY> public_key_ = nullptr;
};
} // namespace net
diff --git a/net/cert/nss_cert_database_chromeos_unittest.cc b/net/cert/nss_cert_database_chromeos_unittest.cc
index e7891f8b..2ecd13b 100644
--- a/net/cert/nss_cert_database_chromeos_unittest.cc
+++ b/net/cert/nss_cert_database_chromeos_unittest.cc
@@ -53,11 +53,7 @@
class NSSCertDatabaseChromeOSTest : public TestWithTaskEnvironment,
public CertDatabase::Observer {
public:
- NSSCertDatabaseChromeOSTest()
- : observer_added_(false),
- db_changed_count_(0),
- user_1_("user1"),
- user_2_("user2") {}
+ NSSCertDatabaseChromeOSTest() : user_1_("user1"), user_2_("user2") {}
void SetUp() override {
// Initialize nss_util slots.
@@ -95,8 +91,8 @@
void OnCertDBChanged() override { db_changed_count_++; }
protected:
- bool observer_added_;
- int db_changed_count_;
+ bool observer_added_ = false;
+ int db_changed_count_ = 0;
crypto::ScopedTestNSSChromeOSUser user_1_;
crypto::ScopedTestNSSChromeOSUser user_2_;
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc
index c9b6a7a..4a85634 100644
--- a/net/cookies/cookie_monster.cc
+++ b/net/cookies/cookie_monster.cc
@@ -364,18 +364,11 @@
base::TimeDelta last_access_threshold,
NetLog* net_log,
bool first_party_sets_enabled)
- : num_keys_(0u),
- num_partitioned_cookies_(0u),
- change_dispatcher_(this, first_party_sets_enabled),
- initialized_(false),
- started_fetching_all_cookies_(false),
- finished_fetching_all_cookies_(false),
- seen_global_task_(false),
+ : change_dispatcher_(this, first_party_sets_enabled),
net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::COOKIE_STORE)),
store_(std::move(store)),
last_access_threshold_(last_access_threshold),
last_statistic_record_time_(base::Time::Now()),
- persist_session_cookies_(false),
first_party_sets_enabled_(first_party_sets_enabled) {
cookieable_schemes_.insert(
cookieable_schemes_.begin(), kDefaultCookieableSchemes,
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h
index 659a346d..d2cfebf 100644
--- a/net/cookies/cookie_monster.h
+++ b/net/cookies/cookie_monster.h
@@ -730,7 +730,7 @@
// The number of distinct keys (eTLD+1's) currently present in the |cookies_|
// multimap. This is histogrammed periodically.
- size_t num_keys_;
+ size_t num_keys_ = 0u;
CookieMap cookies_;
@@ -738,17 +738,17 @@
// Number of distinct partitioned cookies globally. This is used to enforce a
// global maximum on the number of partitioned cookies.
- size_t num_partitioned_cookies_;
+ size_t num_partitioned_cookies_ = 0u;
CookieMonsterChangeDispatcher change_dispatcher_;
// Indicates whether the cookie store has been initialized.
- bool initialized_;
+ bool initialized_ = false;
// Indicates whether the cookie store has started fetching all cookies.
- bool started_fetching_all_cookies_;
+ bool started_fetching_all_cookies_ = false;
// Indicates whether the cookie store has finished fetching all cookies.
- bool finished_fetching_all_cookies_;
+ bool finished_fetching_all_cookies_ = false;
// List of domain keys that have been loaded from the DB.
std::set<std::string> keys_loaded_;
@@ -768,7 +768,7 @@
// view of the cookie store. This is more to ensure fancy cookie export/import
// code has a consistent view of the CookieStore, rather than out of concern
// for typical use.
- bool seen_global_task_;
+ bool seen_global_task_ = false;
NetLogWithSource net_log_;
@@ -793,7 +793,7 @@
base::Time last_statistic_record_time_;
- bool persist_session_cookies_;
+ bool persist_session_cookies_ = false;
bool first_party_sets_enabled_;
diff --git a/net/cookies/cookie_store_test_callbacks.cc b/net/cookies/cookie_store_test_callbacks.cc
index af88e4da..1a8465a 100644
--- a/net/cookies/cookie_store_test_callbacks.cc
+++ b/net/cookies/cookie_store_test_callbacks.cc
@@ -14,12 +14,11 @@
namespace net {
CookieCallback::CookieCallback(base::Thread* run_in_thread)
- : run_in_thread_(run_in_thread), was_run_(false) {}
+ : run_in_thread_(run_in_thread) {}
CookieCallback::CookieCallback()
: run_in_thread_(nullptr),
- run_in_task_runner_(base::ThreadTaskRunnerHandle::Get()),
- was_run_(false) {}
+ run_in_task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
CookieCallback::~CookieCallback() = default;
diff --git a/net/cookies/cookie_store_test_callbacks.h b/net/cookies/cookie_store_test_callbacks.h
index e1dcf6b1..ee319423 100644
--- a/net/cookies/cookie_store_test_callbacks.h
+++ b/net/cookies/cookie_store_test_callbacks.h
@@ -54,7 +54,7 @@
raw_ptr<base::Thread> run_in_thread_;
scoped_refptr<base::SingleThreadTaskRunner> run_in_task_runner_;
base::RunLoop loop_to_quit_;
- bool was_run_;
+ bool was_run_ = false;
};
// Callback implementations for the asynchronous CookieStore methods.
diff --git a/net/der/parse_values.h b/net/der/parse_values.h
index a80a4d7d..51307c8 100644
--- a/net/der/parse_values.h
+++ b/net/der/parse_values.h
@@ -53,7 +53,7 @@
// * There may be at most 7 unused bits.
class NET_EXPORT BitString {
public:
- BitString() : unused_bits_(0) {}
+ BitString() = default;
// |unused_bits| represents the number of bits in the last octet of |bytes|,
// starting from the least significant bit, that are unused. It MUST be < 8.
@@ -73,7 +73,7 @@
private:
Input bytes_;
- uint8_t unused_bits_;
+ uint8_t unused_bits_ = 0;
// Default assignment and copy constructor are OK.
};
diff --git a/net/der/parser.cc b/net/der/parser.cc
index c59eaa95f..94c36000 100644
--- a/net/der/parser.cc
+++ b/net/der/parser.cc
@@ -11,11 +11,11 @@
namespace der {
-Parser::Parser() : advance_len_(0) {
+Parser::Parser() {
CBS_init(&cbs_, nullptr, 0);
}
-Parser::Parser(const Input& input) : advance_len_(0) {
+Parser::Parser(const Input& input) {
CBS_init(&cbs_, input.UnsafeData(), input.Length());
}
diff --git a/net/der/parser.h b/net/der/parser.h
index 09ea1eb..c5deaa6eee 100644
--- a/net/der/parser.h
+++ b/net/der/parser.h
@@ -205,7 +205,7 @@
private:
CBS cbs_;
- size_t advance_len_;
+ size_t advance_len_ = 0;
};
} // namespace der
diff --git a/net/disk_cache/blockfile/eviction.cc b/net/disk_cache/blockfile/eviction.cc
index e3236dc..3e16efe 100644
--- a/net/disk_cache/blockfile/eviction.cc
+++ b/net/disk_cache/blockfile/eviction.cc
@@ -79,7 +79,7 @@
// The real initialization happens during Init(), init_ is the only member that
// has to be initialized here.
-Eviction::Eviction() : backend_(nullptr) {}
+Eviction::Eviction() = default;
Eviction::~Eviction() = default;
diff --git a/net/disk_cache/blockfile/eviction.h b/net/disk_cache/blockfile/eviction.h
index 92e60c6..8946b6f 100644
--- a/net/disk_cache/blockfile/eviction.h
+++ b/net/disk_cache/blockfile/eviction.h
@@ -73,7 +73,7 @@
int SelectListByLength(Rankings::ScopedRankingsBlock* next);
void ReportListStats();
- raw_ptr<BackendImpl> backend_;
+ raw_ptr<BackendImpl> backend_ = nullptr;
raw_ptr<Rankings> rankings_;
raw_ptr<IndexHeader> header_;
int max_size_;
diff --git a/net/disk_cache/blockfile/in_flight_backend_io.cc b/net/disk_cache/blockfile/in_flight_backend_io.cc
index c9371bb..0f18911 100644
--- a/net/disk_cache/blockfile/in_flight_backend_io.cc
+++ b/net/disk_cache/blockfile/in_flight_backend_io.cc
@@ -57,18 +57,7 @@
}
BackendIO::BackendIO(InFlightIO* controller, BackendImpl* backend)
- : BackgroundIO(controller),
- backend_(backend),
- operation_(OP_NONE),
- out_entry_(nullptr),
- out_entry_opened_(false),
- iterator_(nullptr),
- entry_(nullptr),
- index_(0),
- offset_(0),
- buf_len_(0),
- truncate_(false),
- offset64_(0) {
+ : BackgroundIO(controller), backend_(backend) {
start_time_ = base::TimeTicks::Now();
}
diff --git a/net/disk_cache/blockfile/in_flight_backend_io.h b/net/disk_cache/blockfile/in_flight_backend_io.h
index c5abe9e..7c67dc98 100644
--- a/net/disk_cache/blockfile/in_flight_backend_io.h
+++ b/net/disk_cache/blockfile/in_flight_backend_io.h
@@ -156,12 +156,13 @@
raw_ptr<BackendImpl> backend_;
net::CompletionOnceCallback callback_;
- Operation operation_;
+ Operation operation_ = OP_NONE;
// Used for ops that open or create entries.
EntryResultCallback entry_result_callback_;
- raw_ptr<Entry> out_entry_; // if set, already has the user's ref added.
- bool out_entry_opened_;
+ // if set, already has the user's ref added.
+ raw_ptr<Entry> out_entry_ = nullptr;
+ bool out_entry_opened_ = false;
// For GetAvailableRange
RangeResultCallback range_result_callback_;
@@ -171,15 +172,15 @@
std::string key_;
base::Time initial_time_;
base::Time end_time_;
- raw_ptr<Rankings::Iterator> iterator_;
+ raw_ptr<Rankings::Iterator> iterator_ = nullptr;
std::unique_ptr<Rankings::Iterator> scoped_iterator_;
- raw_ptr<EntryImpl> entry_;
- int index_;
- int offset_;
+ raw_ptr<EntryImpl> entry_ = nullptr;
+ int index_ = 0;
+ int offset_ = 0;
scoped_refptr<net::IOBuffer> buf_;
- int buf_len_;
- bool truncate_;
- int64_t offset64_;
+ int buf_len_ = 0;
+ bool truncate_ = false;
+ int64_t offset64_ = 0;
base::TimeTicks start_time_;
base::OnceClosure task_;
};
diff --git a/net/disk_cache/blockfile/sparse_control.cc b/net/disk_cache/blockfile/sparse_control.cc
index f797e63..96cb03c 100644
--- a/net/disk_cache/blockfile/sparse_control.cc
+++ b/net/disk_cache/blockfile/sparse_control.cc
@@ -202,7 +202,6 @@
SparseControl::SparseControl(EntryImpl* entry)
: entry_(entry),
- child_(nullptr),
child_map_(child_data_.bitmap, kNumSparseBits, kNumSparseBits / 32) {
memset(&sparse_header_, 0, sizeof(sparse_header_));
memset(&child_data_, 0, sizeof(child_data_));
diff --git a/net/disk_cache/blockfile/storage_block-inl.h b/net/disk_cache/blockfile/storage_block-inl.h
index bb1ba39..b1c0a89 100644
--- a/net/disk_cache/blockfile/storage_block-inl.h
+++ b/net/disk_cache/blockfile/storage_block-inl.h
@@ -18,7 +18,7 @@
template <typename T>
StorageBlock<T>::StorageBlock(MappedFile* file, Addr address)
- : data_(nullptr), file_(file), address_(address) {
+ : file_(file), address_(address) {
if (address.num_blocks() > 1)
extended_ = true;
DCHECK(!address.is_initialized() || sizeof(*data_) == address.BlockSize())
diff --git a/net/disk_cache/blockfile/storage_block.h b/net/disk_cache/blockfile/storage_block.h
index e1e3acf..f0bb68c 100644
--- a/net/disk_cache/blockfile/storage_block.h
+++ b/net/disk_cache/blockfile/storage_block.h
@@ -94,12 +94,12 @@
void DeleteData();
uint32_t CalculateHash() const;
- raw_ptr<T> data_;
+ raw_ptr<T> data_ = nullptr;
raw_ptr<MappedFile> file_;
Addr address_;
bool modified_ = false;
- bool own_data_ =
- false; // Is data_ owned by this object or shared with someone else.
+ // Is data_ owned by this object or shared with someone else.
+ bool own_data_ = false;
bool extended_ = false; // Used to store an entry of more than one block.
};
diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc
index 9d18ab21..792e751 100644
--- a/net/disk_cache/disk_cache_test_base.cc
+++ b/net/disk_cache/disk_cache_test_base.cc
@@ -80,8 +80,7 @@
return rv;
}
-DiskCacheTestWithCache::DiskCacheTestWithCache()
- : cache_impl_(nullptr), simple_cache_impl_(nullptr), mem_cache_(nullptr) {}
+DiskCacheTestWithCache::DiskCacheTestWithCache() = default;
DiskCacheTestWithCache::~DiskCacheTestWithCache() = default;
diff --git a/net/disk_cache/disk_cache_test_base.h b/net/disk_cache/disk_cache_test_base.h
index 1b8ec71c..3659a1a 100644
--- a/net/disk_cache/disk_cache_test_base.h
+++ b/net/disk_cache/disk_cache_test_base.h
@@ -197,10 +197,10 @@
// cache_ will always have a valid object, regardless of how the cache was
// initialized. The implementation pointers can be NULL.
std::unique_ptr<disk_cache::Backend> cache_;
- raw_ptr<disk_cache::BackendImpl> cache_impl_;
+ raw_ptr<disk_cache::BackendImpl> cache_impl_ = nullptr;
std::unique_ptr<disk_cache::SimpleFileTracker> simple_file_tracker_;
- raw_ptr<disk_cache::SimpleBackendImpl> simple_cache_impl_;
- raw_ptr<disk_cache::MemBackendImpl> mem_cache_;
+ raw_ptr<disk_cache::SimpleBackendImpl> simple_cache_impl_ = nullptr;
+ raw_ptr<disk_cache::MemBackendImpl> mem_cache_ = nullptr;
uint32_t mask_ = 0;
int64_t size_ = 0;
diff --git a/net/disk_cache/memory/mem_backend_impl.cc b/net/disk_cache/memory/mem_backend_impl.cc
index f59f772..993792e4 100644
--- a/net/disk_cache/memory/mem_backend_impl.cc
+++ b/net/disk_cache/memory/mem_backend_impl.cc
@@ -44,7 +44,6 @@
MemBackendImpl::MemBackendImpl(net::NetLog* net_log)
: Backend(net::MEMORY_CACHE),
- custom_clock_for_testing_(nullptr),
net_log_(net_log),
memory_pressure_listener_(
FROM_HERE,
diff --git a/net/disk_cache/memory/mem_backend_impl.h b/net/disk_cache/memory/mem_backend_impl.h
index b0cebfb3..b3994ed 100644
--- a/net/disk_cache/memory/mem_backend_impl.h
+++ b/net/disk_cache/memory/mem_backend_impl.h
@@ -140,7 +140,7 @@
void OnMemoryPressure(
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
- raw_ptr<base::Clock> custom_clock_for_testing_; // usually nullptr.
+ raw_ptr<base::Clock> custom_clock_for_testing_ = nullptr; // usually nullptr.
EntryMap entries_;
diff --git a/net/disk_cache/memory/mem_entry_impl.cc b/net/disk_cache/memory/mem_entry_impl.cc
index 6193646..a045f72 100644
--- a/net/disk_cache/memory/mem_entry_impl.cc
+++ b/net/disk_cache/memory/mem_entry_impl.cc
@@ -289,14 +289,11 @@
MemEntryImpl* parent,
net::NetLog* net_log)
: key_(key),
- ref_count_(0),
child_id_(child_id),
- child_first_pos_(0),
parent_(parent),
last_modified_(MemBackendImpl::Now(backend)),
last_used_(last_modified_),
- backend_(backend),
- doomed_(false) {
+ backend_(backend) {
backend_->OnEntryInserted(this);
net_log_ = net::NetLogWithSource::Make(
net_log, net::NetLogSourceType::MEMORY_CACHE_ENTRY);
diff --git a/net/disk_cache/memory/mem_entry_impl.h b/net/disk_cache/memory/mem_entry_impl.h
index 0f68062b..4dcf339 100644
--- a/net/disk_cache/memory/mem_entry_impl.h
+++ b/net/disk_cache/memory/mem_entry_impl.h
@@ -182,12 +182,12 @@
std::string key_;
std::vector<char> data_[kNumStreams]; // User data.
- uint32_t ref_count_;
+ uint32_t ref_count_ = 0;
int64_t child_id_; // The ID of a child entry.
- int child_first_pos_; // The position of the first byte in a child
- // entry. 0 here is beginning of child, not of
- // the entire file.
+ int child_first_pos_ = 0; // The position of the first byte in a child
+ // entry. 0 here is beginning of child, not of
+ // the entire file.
// Pointer to the parent entry, or nullptr if this entry is a parent entry.
raw_ptr<MemEntryImpl> parent_;
std::unique_ptr<EntryMap> children_;
@@ -195,7 +195,7 @@
base::Time last_modified_;
base::Time last_used_;
base::WeakPtr<MemBackendImpl> backend_; // Back pointer to the cache.
- bool doomed_; // True if this entry was removed from the cache.
+ bool doomed_ = false; // True if this entry was removed from the cache.
net::NetLogWithSource net_log_;
};
diff --git a/net/dns/address_sorter_win.cc b/net/dns/address_sorter_win.cc
index 5220047..1f3fdc7f 100644
--- a/net/dns/address_sorter_win.cc
+++ b/net/dns/address_sorter_win.cc
@@ -71,8 +71,7 @@
input_buffer_(
reinterpret_cast<SOCKET_ADDRESS_LIST*>(malloc(buffer_size_))),
output_buffer_(
- reinterpret_cast<SOCKET_ADDRESS_LIST*>(malloc(buffer_size_))),
- success_(false) {
+ reinterpret_cast<SOCKET_ADDRESS_LIST*>(malloc(buffer_size_))) {
input_buffer_->iAddressCount = base::checked_cast<INT>(endpoints.size());
SOCKADDR_STORAGE* storage = reinterpret_cast<SOCKADDR_STORAGE*>(
input_buffer_->Address + input_buffer_->iAddressCount);
@@ -140,7 +139,7 @@
const DWORD buffer_size_;
std::unique_ptr<SOCKET_ADDRESS_LIST, base::FreeDeleter> input_buffer_;
std::unique_ptr<SOCKET_ADDRESS_LIST, base::FreeDeleter> output_buffer_;
- bool success_;
+ bool success_ = false;
};
};
diff --git a/net/dns/dns_config.cc b/net/dns/dns_config.cc
index 2d0cea2..2a24a13 100644
--- a/net/dns/dns_config.cc
+++ b/net/dns/dns_config.cc
@@ -21,18 +21,7 @@
DnsConfig::DnsConfig(DnsConfig&& other) = default;
DnsConfig::DnsConfig(std::vector<IPEndPoint> nameservers)
- : nameservers(std::move(nameservers)),
- dns_over_tls_active(false),
- unhandled_options(false),
- append_to_multi_label_name(true),
- ndots(1),
- fallback_period(kDnsDefaultFallbackPeriod),
- attempts(2),
- doh_attempts(1),
- rotate(false),
- use_local_ipv6(false),
- secure_dns_mode(SecureDnsMode::kOff),
- allow_dns_over_https_upgrade(false) {}
+ : nameservers(std::move(nameservers)) {}
DnsConfig::~DnsConfig() = default;
diff --git a/net/dns/dns_config.h b/net/dns/dns_config.h
index 601ddc3..19fbd97 100644
--- a/net/dns/dns_config.h
+++ b/net/dns/dns_config.h
@@ -55,7 +55,7 @@
std::vector<IPEndPoint> nameservers;
// Status of system DNS-over-TLS (DoT).
- bool dns_over_tls_active;
+ bool dns_over_tls_active = false;
std::string dns_over_tls_hostname;
// Suffix search list; used on first lookup when number of dots in given name
@@ -66,33 +66,33 @@
// True if there are options set in the system configuration that are not yet
// supported by DnsClient.
- bool unhandled_options;
+ bool unhandled_options = false;
// AppendToMultiLabelName: is suffix search performed for multi-label names?
// True, except on Windows where it can be configured.
- bool append_to_multi_label_name;
+ bool append_to_multi_label_name = true;
// Resolver options; see man resolv.conf.
// Minimum number of dots before global resolution precedes |search|.
- int ndots;
+ int ndots = 1;
// Time between retransmissions, see res_state.retrans.
// Used by Chrome as the initial transaction attempt fallback period (before
// exponential backoff and dynamic period determination based on previous
// attempts.)
- base::TimeDelta fallback_period;
+ base::TimeDelta fallback_period = kDnsDefaultFallbackPeriod;
// Maximum number of attempts, see res_state.retry.
- int attempts;
+ int attempts = 2;
// Maximum number of times a DoH server is attempted per attempted per DNS
// transaction. This is separate from the global failure limit.
- int doh_attempts;
+ int doh_attempts = 1;
// Round robin entries in |nameservers| for subsequent requests.
- bool rotate;
+ bool rotate = false;
// Indicates system configuration uses local IPv6 connectivity, e.g.,
// DirectAccess. This is exposed for HostResolver to skip IPv6 probes,
// as it may cause them to return incorrect results.
- bool use_local_ipv6;
+ bool use_local_ipv6 = false;
// DNS over HTTPS server configuration.
DnsOverHttpsConfig doh_config;
@@ -101,12 +101,12 @@
// overridden for individual requests (such as requests to resolve a DoH
// server hostname) using |HostResolver::ResolveHostParameters::
// secure_dns_mode_override|.
- SecureDnsMode secure_dns_mode;
+ SecureDnsMode secure_dns_mode = SecureDnsMode::kOff;
// If set to |true|, we will attempt to upgrade the user's DNS configuration
// to use DoH server(s) operated by the same provider(s) when the user is
// in AUTOMATIC mode and has not pre-specified DoH servers.
- bool allow_dns_over_https_upgrade;
+ bool allow_dns_over_https_upgrade = false;
};
} // namespace net
diff --git a/net/dns/dns_config_watcher_mac.cc b/net/dns/dns_config_watcher_mac.cc
index f48dc70..9d5398a 100644
--- a/net/dns/dns_config_watcher_mac.cc
+++ b/net/dns/dns_config_watcher_mac.cc
@@ -20,10 +20,7 @@
typedef dns_config_t* (*dns_configuration_copy_t)();
typedef void (*dns_configuration_free_t)(dns_config_t*);
- DnsInfoApi()
- : dns_configuration_notify_key(NULL),
- dns_configuration_copy(NULL),
- dns_configuration_free(NULL) {
+ DnsInfoApi() {
handle_ = dlopen("/usr/lib/libSystem.dylib",
RTLD_LAZY | RTLD_NOLOAD);
if (!handle_)
@@ -44,9 +41,9 @@
dlclose(handle_);
}
- dns_configuration_notify_key_t dns_configuration_notify_key;
- dns_configuration_copy_t dns_configuration_copy;
- dns_configuration_free_t dns_configuration_free;
+ dns_configuration_notify_key_t dns_configuration_notify_key = nullptr;
+ dns_configuration_copy_t dns_configuration_copy = nullptr;
+ dns_configuration_free_t dns_configuration_free = nullptr;
private:
void* handle_;
diff --git a/net/dns/dns_test_util.cc b/net/dns/dns_test_util.cc
index 0f07bb3..4827aab 100644
--- a/net/dns/dns_test_util.cc
+++ b/net/dns/dns_test_util.cc
@@ -410,9 +410,7 @@
SecureDnsMode secure_dns_mode,
ResolveContext* resolve_context,
bool fast_timeout)
- : result_(MockDnsClientRule::ResultType::kFail),
- hostname_(std::move(hostname)),
- qtype_(qtype) {
+ : hostname_(std::move(hostname)), qtype_(qtype) {
// Do not allow matching any rules if transaction is secure and no DoH
// servers are available.
if (!secure || force_doh_server_available ||
@@ -581,7 +579,7 @@
void SetRequestPriority(RequestPriority priority) override {}
- MockDnsClientRule::Result result_;
+ MockDnsClientRule::Result result_{MockDnsClientRule::ResultType::kFail};
const std::string hostname_;
const uint16_t qtype_;
ResponseCallback callback_;
diff --git a/net/dns/host_cache.cc b/net/dns/host_cache.cc
index 3c4ca83..4e8d6ee 100644
--- a/net/dns/host_cache.cc
+++ b/net/dns/host_cache.cc
@@ -630,7 +630,6 @@
HostCache::HostCache(size_t max_entries)
: max_entries_(max_entries),
- delegate_(nullptr),
tick_clock_(base::DefaultTickClock::GetInstance()) {}
HostCache::~HostCache() {
diff --git a/net/dns/host_cache.h b/net/dns/host_cache.h
index 70d453ef..bcbc1654 100644
--- a/net/dns/host_cache.h
+++ b/net/dns/host_cache.h
@@ -531,7 +531,7 @@
// RestoreFromListValue(). Used in histograms.
size_t restore_size_ = 0;
- raw_ptr<PersistenceDelegate> delegate_;
+ raw_ptr<PersistenceDelegate> delegate_ = nullptr;
// Shared tick clock, overridden for testing.
raw_ptr<const base::TickClock> tick_clock_;
diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc
index 95aec2d..9f6b33a 100644
--- a/net/dns/host_resolver_manager.cc
+++ b/net/dns/host_resolver_manager.cc
@@ -3120,17 +3120,12 @@
SystemDnsConfigChangeNotifier* system_dns_config_notifier,
NetworkChangeNotifier::NetworkHandle target_network,
NetLog* net_log)
- : max_queued_jobs_(0),
- proc_params_(nullptr, options.max_system_retry_attempts),
+ : proc_params_(nullptr, options.max_system_retry_attempts),
net_log_(net_log),
system_dns_config_notifier_(system_dns_config_notifier),
target_network_(target_network),
check_ipv6_on_wifi_(options.check_ipv6_on_wifi),
- last_ipv6_probe_result_(true),
- additional_resolver_flags_(0),
- allow_fallback_to_proctask_(true),
- tick_clock_(base::DefaultTickClock::GetInstance()),
- invalidation_in_progress_(false) {
+ tick_clock_(base::DefaultTickClock::GetInstance()) {
PrioritizedDispatcher::Limits job_limits = GetDispatcherLimits(options);
dispatcher_ = std::make_unique<PrioritizedDispatcher>(job_limits);
max_queued_jobs_ = job_limits.total_jobs * 100u;
diff --git a/net/dns/host_resolver_manager.h b/net/dns/host_resolver_manager.h
index 9a20bf8..602a18b2 100644
--- a/net/dns/host_resolver_manager.h
+++ b/net/dns/host_resolver_manager.h
@@ -498,7 +498,7 @@
std::unique_ptr<PrioritizedDispatcher> dispatcher_;
// Limit on the maximum number of jobs queued in |dispatcher_|.
- size_t max_queued_jobs_;
+ size_t max_queued_jobs_ = 0;
// Parameters for ProcTask.
ProcTaskParams proc_params_;
@@ -517,13 +517,13 @@
bool check_ipv6_on_wifi_;
base::TimeTicks last_ipv6_probe_time_;
- bool last_ipv6_probe_result_;
+ bool last_ipv6_probe_result_ = true;
// Any resolver flags that should be added to a request by default.
- HostResolverFlags additional_resolver_flags_;
+ HostResolverFlags additional_resolver_flags_ = 0;
// Allow fallback to ProcTask if DnsTask fails.
- bool allow_fallback_to_proctask_;
+ bool allow_fallback_to_proctask_ = true;
// Task runner used for DNS lookups using the system resolver. Normally a
// ThreadPool task runner, but can be overridden for tests.
@@ -540,7 +540,7 @@
true /* check_empty */,
false /* allow_reentrancy */>
registered_contexts_;
- bool invalidation_in_progress_;
+ bool invalidation_in_progress_ = false;
// Helper for metrics associated with `features::kDnsHttpssvc`.
HttpssvcExperimentDomainCache httpssvc_domain_cache_;
diff --git a/net/dns/host_resolver_manager_unittest.cc b/net/dns/host_resolver_manager_unittest.cc
index de7c47e..9b62694 100644
--- a/net/dns/host_resolver_manager_unittest.cc
+++ b/net/dns/host_resolver_manager_unittest.cc
@@ -4183,8 +4183,7 @@
base::test::TaskEnvironment::TimeSource::MOCK_TIME)
: HostResolverManagerTest(time_source),
notifier_task_runner_(
- base::MakeRefCounted<base::TestMockTimeTaskRunner>()),
- dns_client_(nullptr) {
+ base::MakeRefCounted<base::TestMockTimeTaskRunner>()) {
auto config_service = std::make_unique<TestDnsConfigService>();
config_service_ = config_service.get();
notifier_ = std::make_unique<SystemDnsConfigChangeNotifier>(
@@ -4467,7 +4466,7 @@
std::unique_ptr<SystemDnsConfigChangeNotifier> notifier_;
// Owned by |resolver_|.
- raw_ptr<MockDnsClient> dns_client_;
+ raw_ptr<MockDnsClient> dns_client_ = nullptr;
};
TEST_F(HostResolverManagerDnsTest, FlushCacheOnDnsConfigChange) {
diff --git a/net/dns/host_resolver_proc.cc b/net/dns/host_resolver_proc.cc
index a98cbf2..d43d82ef 100644
--- a/net/dns/host_resolver_proc.cc
+++ b/net/dns/host_resolver_proc.cc
@@ -251,9 +251,6 @@
SystemHostResolverProc::~SystemHostResolverProc() = default;
-const base::TimeDelta ProcTaskParams::kDnsDefaultUnresponsiveDelay =
- base::Seconds(6);
-
ProcTaskParams::ProcTaskParams(HostResolverProc* resolver_proc,
size_t in_max_retry_attempts)
: resolver_proc(resolver_proc),
diff --git a/net/dns/host_resolver_proc.h b/net/dns/host_resolver_proc.h
index 2d7fd449..9d33547 100644
--- a/net/dns/host_resolver_proc.h
+++ b/net/dns/host_resolver_proc.h
@@ -154,7 +154,8 @@
struct NET_EXPORT_PRIVATE ProcTaskParams {
// Default delay between calls to the system resolver for the same hostname.
// (Can be overridden by field trial.)
- static const base::TimeDelta kDnsDefaultUnresponsiveDelay;
+ static constexpr base::TimeDelta kDnsDefaultUnresponsiveDelay =
+ base::Seconds(6);
// Sets up defaults.
ProcTaskParams(HostResolverProc* resolver_proc, size_t max_retry_attempts);
@@ -174,7 +175,7 @@
// This is the limit after which we make another attempt to resolve the host
// if the worker thread has not responded yet.
- base::TimeDelta unresponsive_delay;
+ base::TimeDelta unresponsive_delay = kDnsDefaultUnresponsiveDelay;
// Factor to grow |unresponsive_delay| when we re-re-try.
uint32_t retry_factor = 2;
diff --git a/net/dns/mock_host_resolver.cc b/net/dns/mock_host_resolver.cc
index 6d33a9c..03500cf 100644
--- a/net/dns/mock_host_resolver.cc
+++ b/net/dns/mock_host_resolver.cc
@@ -421,10 +421,7 @@
MdnsListenerImpl(const HostPortPair& host,
DnsQueryType query_type,
base::WeakPtr<MockHostResolverBase> resolver)
- : host_(host),
- query_type_(query_type),
- delegate_(nullptr),
- resolver_(resolver) {
+ : host_(host), query_type_(query_type), resolver_(resolver) {
DCHECK_NE(DnsQueryType::UNSPECIFIED, query_type_);
DCHECK(resolver_);
}
@@ -471,7 +468,7 @@
const HostPortPair host_;
const DnsQueryType query_type_;
- raw_ptr<Delegate> delegate_;
+ raw_ptr<Delegate> delegate_ = nullptr;
// Use a WeakPtr as the resolver may be destroyed while there are still
// outstanding listener objects.
diff --git a/net/filter/fuzzed_source_stream.cc b/net/filter/fuzzed_source_stream.cc
index 81e5cc5..67e61f4 100644
--- a/net/filter/fuzzed_source_stream.cc
+++ b/net/filter/fuzzed_source_stream.cc
@@ -25,10 +25,7 @@
} // namespace
FuzzedSourceStream::FuzzedSourceStream(FuzzedDataProvider* data_provider)
- : SourceStream(SourceStream::TYPE_NONE),
- data_provider_(data_provider),
- read_pending_(false),
- end_returned_(false) {}
+ : SourceStream(SourceStream::TYPE_NONE), data_provider_(data_provider) {}
FuzzedSourceStream::~FuzzedSourceStream() {
DCHECK(!read_pending_);
diff --git a/net/filter/fuzzed_source_stream.h b/net/filter/fuzzed_source_stream.h
index 5e57520..c12cf4fa 100644
--- a/net/filter/fuzzed_source_stream.h
+++ b/net/filter/fuzzed_source_stream.h
@@ -46,10 +46,10 @@
FuzzedDataProvider* data_provider_;
// Whether there is a pending Read().
- bool read_pending_;
+ bool read_pending_ = false;
// Last result returned by Read() is an error or 0.
- bool end_returned_;
+ bool end_returned_ = false;
};
} // namespace net
diff --git a/net/http/bidirectional_stream.cc b/net/http/bidirectional_stream.cc
index 3d7f3b5..13faebf 100644
--- a/net/http/bidirectional_stream.cc
+++ b/net/http/bidirectional_stream.cc
@@ -85,7 +85,6 @@
NetLogSourceType::BIDIRECTIONAL_STREAM)),
session_(session),
send_request_headers_automatically_(send_request_headers_automatically),
- request_headers_sent_(false),
delegate_(delegate),
timer_(std::move(timer)) {
DCHECK(delegate_);
diff --git a/net/http/bidirectional_stream.h b/net/http/bidirectional_stream.h
index 1741344..debf81b 100644
--- a/net/http/bidirectional_stream.h
+++ b/net/http/bidirectional_stream.h
@@ -234,7 +234,7 @@
bool send_request_headers_automatically_;
// Whether request headers have been sent, as indicated in OnStreamReady()
// callback.
- bool request_headers_sent_;
+ bool request_headers_sent_ = false;
const raw_ptr<Delegate> delegate_;
diff --git a/net/http/bidirectional_stream_unittest.cc b/net/http/bidirectional_stream_unittest.cc
index 60c45dd4..d39ee35 100644
--- a/net/http/bidirectional_stream_unittest.cc
+++ b/net/http/bidirectional_stream_unittest.cc
@@ -104,16 +104,7 @@
std::unique_ptr<base::OneShotTimer> timer)
: read_buf_(read_buf),
read_buf_len_(read_buf_len),
- timer_(std::move(timer)),
- loop_(nullptr),
- received_bytes_(0),
- sent_bytes_(0),
- error_(OK),
- on_data_read_count_(0),
- on_data_sent_count_(0),
- do_not_start_read_(false),
- run_until_completion_(false),
- not_expect_callback_(false) {}
+ timer_(std::move(timer)) {}
TestDelegateBase(const TestDelegateBase&) = delete;
TestDelegateBase& operator=(const TestDelegateBase&) = delete;
@@ -298,17 +289,17 @@
spdy::Http2HeaderBlock response_headers_;
spdy::Http2HeaderBlock trailers_;
NextProto next_proto_;
- int64_t received_bytes_;
- int64_t sent_bytes_;
+ int64_t received_bytes_ = 0;
+ int64_t sent_bytes_ = 0;
LoadTimingInfo load_timing_info_;
- int error_;
- int on_data_read_count_;
- int on_data_sent_count_;
- bool do_not_start_read_;
- bool run_until_completion_;
+ int error_ = OK;
+ int on_data_read_count_ = 0;
+ int on_data_sent_count_ = 0;
+ bool do_not_start_read_ = false;
+ bool run_until_completion_ = false;
// This is to ensure that delegate callback is not invoked synchronously when
// calling into |stream_|.
- bool not_expect_callback_;
+ bool not_expect_callback_ = false;
CompletionOnceCallback callback_;
};
diff --git a/net/http/http_auth_handler_factory.h b/net/http/http_auth_handler_factory.h
index 683b63f..d9b9138 100644
--- a/net/http/http_auth_handler_factory.h
+++ b/net/http/http_auth_handler_factory.h
@@ -45,7 +45,7 @@
CREATE_PREEMPTIVE, // Create a handler preemptively.
};
- HttpAuthHandlerFactory() : http_auth_preferences_(nullptr) {}
+ HttpAuthHandlerFactory() = default;
HttpAuthHandlerFactory(const HttpAuthHandlerFactory&) = delete;
HttpAuthHandlerFactory& operator=(const HttpAuthHandlerFactory&) = delete;
@@ -163,7 +163,7 @@
private:
// The preferences for HTTP authentication.
- raw_ptr<const HttpAuthPreferences> http_auth_preferences_;
+ raw_ptr<const HttpAuthPreferences> http_auth_preferences_ = nullptr;
};
// The HttpAuthHandlerRegistryFactory dispatches create requests out
diff --git a/net/http/http_auth_handler_negotiate.cc b/net/http/http_auth_handler_negotiate.cc
index df30c4f0..bab8b1b 100644
--- a/net/http/http_auth_handler_negotiate.cc
+++ b/net/http/http_auth_handler_negotiate.cc
@@ -150,7 +150,6 @@
HostResolver* resolver)
: auth_system_(std::move(auth_system)),
resolver_(resolver),
- auth_token_(nullptr),
http_auth_preferences_(prefs) {}
HttpAuthHandlerNegotiate::~HttpAuthHandlerNegotiate() = default;
diff --git a/net/http/http_auth_handler_negotiate.h b/net/http/http_auth_handler_negotiate.h
index 687f4c97..73f2c22 100644
--- a/net/http/http_auth_handler_negotiate.h
+++ b/net/http/http_auth_handler_negotiate.h
@@ -149,7 +149,7 @@
// Things which vary each round.
CompletionOnceCallback callback_;
- raw_ptr<std::string> auth_token_;
+ raw_ptr<std::string> auth_token_ = nullptr;
State next_state_ = STATE_NONE;
diff --git a/net/http/http_cache_lookup_manager.cc b/net/http/http_cache_lookup_manager.cc
index 3f71c65..6ed9cd0 100644
--- a/net/http/http_cache_lookup_manager.cc
+++ b/net/http/http_cache_lookup_manager.cc
@@ -30,7 +30,6 @@
NetLog* net_log)
: push_helper_(std::move(server_push_helper)),
request_(new HttpRequestInfo()),
- transaction_(nullptr),
net_log_(NetLogWithSource::Make(
net_log,
NetLogSourceType::SERVER_PUSH_LOOKUP_TRANSACTION)) {}
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index f5a72b8d..764fd4d6 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -161,13 +161,7 @@
//-----------------------------------------------------------------------------
HttpCache::Transaction::Transaction(RequestPriority priority, HttpCache* cache)
- : initial_request_(nullptr),
- request_(nullptr),
- priority_(priority),
- cache_(cache->GetWeakPtr()),
- entry_(nullptr),
- new_response_(nullptr),
- websocket_handshake_stream_base_create_helper_(nullptr) {
+ : priority_(priority), cache_(cache->GetWeakPtr()) {
TRACE_EVENT1("net", "HttpCacheTransaction::Transaction", "priority",
RequestPriorityToString(priority));
static_assert(HttpCache::Transaction::kNumValidationHeaders ==
diff --git a/net/http/http_cache_transaction.h b/net/http/http_cache_transaction.h
index 647f265..88ed8087 100644
--- a/net/http/http_cache_transaction.h
+++ b/net/http/http_cache_transaction.h
@@ -611,9 +611,9 @@
State next_state_{STATE_NONE};
// Initial request with which Start() was invoked.
- raw_ptr<const HttpRequestInfo> initial_request_;
+ raw_ptr<const HttpRequestInfo> initial_request_ = nullptr;
- raw_ptr<const HttpRequestInfo> request_;
+ raw_ptr<const HttpRequestInfo> request_ = nullptr;
std::string method_;
RequestPriority priority_;
@@ -624,7 +624,7 @@
// |external_validation_| contains the value of those headers.
ValidationHeaders external_validation_;
base::WeakPtr<HttpCache> cache_;
- raw_ptr<HttpCache::ActiveEntry> entry_;
+ raw_ptr<HttpCache::ActiveEntry> entry_ = nullptr;
HttpCache::ActiveEntry* new_entry_ = nullptr;
std::unique_ptr<HttpTransaction> network_trans_;
CompletionOnceCallback callback_; // Consumer's callback.
@@ -640,7 +640,7 @@
// WriteResponseInfoToEntry() resets this to absl::nullopt.
std::unique_ptr<HttpResponseInfo> updated_prefetch_response_;
- raw_ptr<const HttpResponseInfo> new_response_;
+ raw_ptr<const HttpResponseInfo> new_response_ = nullptr;
std::string cache_key_;
Mode mode_ = NONE;
bool reading_ = false; // We are already reading. Never reverts to
@@ -715,7 +715,7 @@
// This is passed to the underlying network transaction. It is stored here in
// case the transaction does not exist yet.
raw_ptr<WebSocketHandshakeStreamBase::CreateHelper>
- websocket_handshake_stream_base_create_helper_;
+ websocket_handshake_stream_base_create_helper_ = nullptr;
// Set if we are currently calculating a checksum of the resource to validate
// it against the expected checksum for the single-keyed cache. Accumulates a
diff --git a/net/http/http_network_session.cc b/net/http/http_network_session.cc
index 6eb6d36..457bb67 100644
--- a/net/http/http_network_session.cc
+++ b/net/http/http_network_session.cc
@@ -142,7 +142,6 @@
context.ct_policy_enforcer,
&ssl_client_session_cache_,
context.sct_auditing_delegate),
- push_delegate_(nullptr),
quic_stream_factory_(context.net_log,
context.host_resolver,
context.ssl_config_service,
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index edd979a2..5f530c8 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -116,7 +116,6 @@
: io_callback_(base::BindRepeating(&HttpNetworkTransaction::OnIOComplete,
base::Unretained(this))),
session_(session),
- request_(nullptr),
priority_(priority) {}
HttpNetworkTransaction::~HttpNetworkTransaction() {
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index e10a7d7..525a4b1 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -328,7 +328,7 @@
NetLogWithSource net_log_;
// Reset to null at the start of the Read state machine.
- raw_ptr<const HttpRequestInfo> request_;
+ raw_ptr<const HttpRequestInfo> request_ = nullptr;
// The requested URL.
GURL url_;
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc
index e048ecb..7a0e8f0e4 100644
--- a/net/http/http_stream_parser.cc
+++ b/net/http/http_stream_parser.cc
@@ -181,11 +181,8 @@
GrowableIOBuffer* read_buffer,
const NetLogWithSource& net_log)
: request_(request),
- request_headers_(nullptr),
read_buf_(read_buffer),
response_header_start_offset_(std::string::npos),
- response_(nullptr),
- user_read_buf_(nullptr),
stream_socket_(stream_socket),
connection_is_reused_(connection_is_reused),
net_log_(net_log) {
diff --git a/net/http/http_stream_parser.h b/net/http/http_stream_parser.h
index 84df5c1..73a4bc56 100644
--- a/net/http/http_stream_parser.h
+++ b/net/http/http_stream_parser.h
@@ -246,7 +246,7 @@
// cannot be safely accessed after reading the final set of headers, as the
// caller of SendRequest may have been destroyed - this happens in the case an
// HttpResponseBodyDrainer is used.
- raw_ptr<HttpResponseInfo> response_;
+ raw_ptr<HttpResponseInfo> response_ = nullptr;
// Time at which the first bytes of the first header response including
// informational responses (1xx) are about to be parsed. This corresponds to
diff --git a/net/http/http_transaction_test_util.cc b/net/http/http_transaction_test_util.cc
index 1053681..254263ab 100644
--- a/net/http/http_transaction_test_util.cc
+++ b/net/http/http_transaction_test_util.cc
@@ -32,7 +32,6 @@
#include "net/http/http_transaction.h"
#include "net/log/net_log.h"
#include "net/log/net_log_source.h"
-#include "net/log/net_log_with_source.h"
#include "net/ssl/ssl_private_key.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -285,9 +284,7 @@
MockNetworkTransaction::MockNetworkTransaction(RequestPriority priority,
MockNetworkLayer* factory)
- : priority_(priority),
- transaction_factory_(factory->AsWeakPtr()),
- socket_log_id_(NetLogSource::kInvalidId) {}
+ : priority_(priority), transaction_factory_(factory->AsWeakPtr()) {}
MockNetworkTransaction::~MockNetworkTransaction() {
// Use request_ as in ~HttpNetworkTransaction to make sure its valid and not
diff --git a/net/http/http_transaction_test_util.h b/net/http/http_transaction_test_util.h
index 67f57e2..71541b55 100644
--- a/net/http/http_transaction_test_util.h
+++ b/net/http/http_transaction_test_util.h
@@ -33,6 +33,7 @@
#include "net/http/http_request_info.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_response_info.h"
+#include "net/log/net_log_source.h"
#include "net/socket/connection_attempts.h"
namespace net {
@@ -295,7 +296,7 @@
// connection. Requires Start() be passed a NetLogWithSource with a real
// NetLog to
// be initialized.
- unsigned int socket_log_id_;
+ unsigned int socket_log_id_ = NetLogSource::kInvalidId;
bool done_reading_called_ = false;
bool reading_ = false;
diff --git a/net/http/http_util.cc b/net/http/http_util.cc
index 3029855..96a6e29 100644
--- a/net/http/http_util.cc
+++ b/net/http/http_util.cc
@@ -917,12 +917,10 @@
Values optional_values,
Quotes strict_quotes)
: props_(begin, end, delimiter),
- valid_(true),
name_begin_(end),
name_end_(end),
value_begin_(end),
value_end_(end),
- value_is_quoted_(false),
values_optional_(optional_values == Values::NOT_REQUIRED),
strict_quotes_(strict_quotes == Quotes::STRICT_QUOTES) {}
diff --git a/net/http/http_util.h b/net/http/http_util.h
index 65f64279..7733270 100644
--- a/net/http/http_util.h
+++ b/net/http/http_util.h
@@ -450,7 +450,7 @@
private:
HttpUtil::ValuesIterator props_;
- bool valid_;
+ bool valid_ = true;
std::string::const_iterator name_begin_;
std::string::const_iterator name_end_;
@@ -463,7 +463,7 @@
// into the original's unquoted_value_ member.
std::string unquoted_value_;
- bool value_is_quoted_;
+ bool value_is_quoted_ = false;
// True if values are required for each name/value pair; false if a
// name is permitted to appear without a corresponding value.
diff --git a/net/http/transport_security_state.cc b/net/http/transport_security_state.cc
index f5217b3..25c3764df 100644
--- a/net/http/transport_security_state.cc
+++ b/net/http/transport_security_state.cc
@@ -404,10 +404,7 @@
TransportSecurityState::TransportSecurityState(
std::vector<std::string> hsts_host_bypass_list)
- : enable_static_pins_(true),
- enable_static_expect_ct_(true),
- enable_pkp_bypass_for_local_trust_anchors_(true),
- sent_hpkp_reports_cache_(kMaxReportCacheEntries),
+ : sent_hpkp_reports_cache_(kMaxReportCacheEntries),
sent_expect_ct_reports_cache_(kMaxReportCacheEntries),
key_expect_ct_by_nik_(base::FeatureList::IsEnabled(
features::kPartitionExpectCTStateByNetworkIsolationKey)) {
diff --git a/net/http/transport_security_state.h b/net/http/transport_security_state.h
index 0e003911..f8b6882 100644
--- a/net/http/transport_security_state.h
+++ b/net/http/transport_security_state.h
@@ -779,13 +779,13 @@
raw_ptr<ReportSenderInterface> report_sender_ = nullptr;
// True if static pins should be used.
- bool enable_static_pins_;
+ bool enable_static_pins_ = true;
// True if static expect-CT state should be used.
- bool enable_static_expect_ct_;
+ bool enable_static_expect_ct_ = true;
// True if public key pinning bypass is enabled for local trust anchors.
- bool enable_pkp_bypass_for_local_trust_anchors_;
+ bool enable_pkp_bypass_for_local_trust_anchors_ = true;
raw_ptr<ExpectCTReporter> expect_ct_reporter_ = nullptr;
diff --git a/net/log/net_log.cc b/net/log/net_log.cc
index 2bb696e..6ea2341 100644
--- a/net/log/net_log.cc
+++ b/net/log/net_log.cc
@@ -14,7 +14,7 @@
namespace net {
-NetLog::ThreadSafeObserver::ThreadSafeObserver() : net_log_(nullptr) {}
+NetLog::ThreadSafeObserver::ThreadSafeObserver() = default;
NetLog::ThreadSafeObserver::~ThreadSafeObserver() {
// Make sure we aren't watching a NetLog on destruction. Because the NetLog
diff --git a/net/log/net_log.h b/net/log/net_log.h
index a89dbc56..d041ab8 100644
--- a/net/log/net_log.h
+++ b/net/log/net_log.h
@@ -137,7 +137,7 @@
// Both of these values are only modified by the NetLog.
NetLogCaptureMode capture_mode_ = NetLogCaptureMode::kDefault;
- raw_ptr<NetLog> net_log_;
+ raw_ptr<NetLog> net_log_ = nullptr;
};
// An observer that is notified of changes in the capture mode set, and has
diff --git a/net/log/net_log_unittest.cc b/net/log/net_log_unittest.cc
index b0de08e..5083cf6 100644
--- a/net/log/net_log_unittest.cc
+++ b/net/log/net_log_unittest.cc
@@ -235,10 +235,7 @@
// RunTestThread.
class NetLogTestThread : public base::SimpleThread {
public:
- NetLogTestThread()
- : base::SimpleThread("NetLogTest"),
- net_log_(nullptr),
- start_event_(nullptr) {}
+ NetLogTestThread() : base::SimpleThread("NetLogTest") {}
NetLogTestThread(const NetLogTestThread&) = delete;
NetLogTestThread& operator=(const NetLogTestThread&) = delete;
@@ -260,12 +257,12 @@
virtual void RunTestThread() = 0;
protected:
- raw_ptr<NetLog> net_log_;
+ raw_ptr<NetLog> net_log_ = nullptr;
private:
// Only triggered once all threads have been created, to make it less likely
// each thread completes before the next one starts.
- raw_ptr<base::WaitableEvent> start_event_;
+ raw_ptr<base::WaitableEvent> start_event_ = nullptr;
};
// A thread that adds a bunch of events to the NetLog.
diff --git a/net/log/trace_net_log_observer.cc b/net/log/trace_net_log_observer.cc
index b2998b25..77c3d25 100644
--- a/net/log/trace_net_log_observer.cc
+++ b/net/log/trace_net_log_observer.cc
@@ -47,7 +47,7 @@
} // namespace
-TraceNetLogObserver::TraceNetLogObserver() : net_log_to_watch_(nullptr) {}
+TraceNetLogObserver::TraceNetLogObserver() = default;
TraceNetLogObserver::~TraceNetLogObserver() {
DCHECK(!net_log_to_watch_);
diff --git a/net/log/trace_net_log_observer.h b/net/log/trace_net_log_observer.h
index 2c5dde4..568f533 100644
--- a/net/log/trace_net_log_observer.h
+++ b/net/log/trace_net_log_observer.h
@@ -44,7 +44,7 @@
void OnTraceLogDisabled() override;
private:
- raw_ptr<NetLog> net_log_to_watch_;
+ raw_ptr<NetLog> net_log_to_watch_ = nullptr;
base::WeakPtrFactory<TraceNetLogObserver> weak_factory_{this};
};
diff --git a/net/network_error_logging/network_error_logging_service.cc b/net/network_error_logging/network_error_logging_service.cc
index 37b4dee..bedaca3e 100644
--- a/net/network_error_logging/network_error_logging_service.cc
+++ b/net/network_error_logging/network_error_logging_service.cc
@@ -1043,6 +1043,6 @@
}
NetworkErrorLoggingService::NetworkErrorLoggingService()
- : clock_(base::DefaultClock::GetInstance()), reporting_service_(nullptr) {}
+ : clock_(base::DefaultClock::GetInstance()) {}
} // namespace net
diff --git a/net/network_error_logging/network_error_logging_service.h b/net/network_error_logging/network_error_logging_service.h
index fa56764..90fd2a8 100644
--- a/net/network_error_logging/network_error_logging_service.h
+++ b/net/network_error_logging/network_error_logging_service.h
@@ -292,7 +292,7 @@
// Unowned:
raw_ptr<const base::Clock> clock_;
- raw_ptr<ReportingService> reporting_service_;
+ raw_ptr<ReportingService> reporting_service_ = nullptr;
bool shut_down_ = false;
};
diff --git a/net/nqe/network_qualities_prefs_manager.cc b/net/nqe/network_qualities_prefs_manager.cc
index 59f41a6..1bf9bb5 100644
--- a/net/nqe/network_qualities_prefs_manager.cc
+++ b/net/nqe/network_qualities_prefs_manager.cc
@@ -57,8 +57,7 @@
NetworkQualitiesPrefsManager::NetworkQualitiesPrefsManager(
std::unique_ptr<PrefDelegate> pref_delegate)
: pref_delegate_(std::move(pref_delegate)),
- prefs_(pref_delegate_->GetDictionaryValue()),
- network_quality_estimator_(nullptr) {
+ prefs_(pref_delegate_->GetDictionaryValue()) {
DCHECK(pref_delegate_);
DCHECK_GE(kMaxCacheSize, prefs_.size());
}
diff --git a/net/nqe/network_qualities_prefs_manager.h b/net/nqe/network_qualities_prefs_manager.h
index 7dbd0ef8..aceab05d 100644
--- a/net/nqe/network_qualities_prefs_manager.h
+++ b/net/nqe/network_qualities_prefs_manager.h
@@ -81,7 +81,7 @@
const nqe::internal::CachedNetworkQuality& cached_network_quality)
override;
- raw_ptr<NetworkQualityEstimator> network_quality_estimator_;
+ raw_ptr<NetworkQualityEstimator> network_quality_estimator_ = nullptr;
// Network quality prefs read from the disk at the time of startup.
ParsedPrefs read_prefs_startup_;
diff --git a/net/nqe/network_quality_estimator.cc b/net/nqe/network_quality_estimator.cc
index 376fccd..2895c5b 100644
--- a/net/nqe/network_quality_estimator.cc
+++ b/net/nqe/network_quality_estimator.cc
@@ -120,7 +120,6 @@
tick_clock_,
params_->weight_multiplier_per_second(),
1.0 /*params_->weight_multiplier_per_signal_strength_level()*/)},
- effective_connection_type_recomputation_interval_(base::Seconds(10)),
net_log_(NetLogWithSource::Make(
net_log,
net::NetLogSourceType::NETWORK_QUALITY_ESTIMATOR)),
diff --git a/net/nqe/network_quality_estimator.h b/net/nqe/network_quality_estimator.h
index d0f263c..cda6fac5 100644
--- a/net/nqe/network_quality_estimator.h
+++ b/net/nqe/network_quality_estimator.h
@@ -593,7 +593,8 @@
// Minimum duration between two consecutive computations of effective
// connection type. Set to non-zero value as a performance optimization.
- const base::TimeDelta effective_connection_type_recomputation_interval_;
+ const base::TimeDelta effective_connection_type_recomputation_interval_ =
+ base::Seconds(10);
// Time when the effective connection type was last computed.
base::TimeTicks last_effective_connection_type_computation_;
diff --git a/net/nqe/network_quality_estimator_params.cc b/net/nqe/network_quality_estimator_params.cc
index 2cb3bfa..0b81b9f 100644
--- a/net/nqe/network_quality_estimator_params.cc
+++ b/net/nqe/network_quality_estimator_params.cc
@@ -446,7 +446,6 @@
params_,
"hanging_request_http_rtt_upper_bound_http_rtt_multiplier",
6)),
- hanging_request_upper_bound_min_http_rtt_(base::Milliseconds(500)),
http_rtt_transport_rtt_min_count_(
GetValueForVariationParam(params_,
"http_rtt_transport_rtt_min_count",
@@ -470,7 +469,6 @@
params_,
"hanging_request_duration_http_rtt_multiplier",
5)),
- hanging_request_min_duration_(base::Milliseconds(3000)),
add_default_platform_observations_(
GetStringValueForVariationParamWithDefaultValue(
params_,
diff --git a/net/nqe/network_quality_estimator_params.h b/net/nqe/network_quality_estimator_params.h
index 3a34c0b..b71ccc72 100644
--- a/net/nqe/network_quality_estimator_params.h
+++ b/net/nqe/network_quality_estimator_params.h
@@ -276,13 +276,15 @@
const double upper_bound_http_rtt_endtoend_rtt_multiplier_;
const int hanging_request_http_rtt_upper_bound_transport_rtt_multiplier_;
const int hanging_request_http_rtt_upper_bound_http_rtt_multiplier_;
- const base::TimeDelta hanging_request_upper_bound_min_http_rtt_;
+ const base::TimeDelta hanging_request_upper_bound_min_http_rtt_ =
+ base::Milliseconds(500);
const size_t http_rtt_transport_rtt_min_count_;
const base::TimeDelta increase_in_transport_rtt_logging_interval_;
const base::TimeDelta recent_time_threshold_;
const base::TimeDelta historical_time_threshold_;
const int hanging_request_duration_http_rtt_multiplier_;
- const base::TimeDelta hanging_request_min_duration_;
+ const base::TimeDelta hanging_request_min_duration_ =
+ base::Milliseconds(3000);
const bool add_default_platform_observations_;
const base::TimeDelta socket_watchers_min_notification_interval_;
const bool use_end_to_end_rtt_ = true;
diff --git a/net/nqe/network_quality_estimator_test_util.cc b/net/nqe/network_quality_estimator_test_util.cc
index fb387206..92b9964 100644
--- a/net/nqe/network_quality_estimator_test_util.cc
+++ b/net/nqe/network_quality_estimator_test_util.cc
@@ -51,7 +51,6 @@
: NetworkQualityEstimator(
std::make_unique<NetworkQualityEstimatorParams>(variation_params),
NetLog::Get()),
- current_network_type_(NetworkChangeNotifier::CONNECTION_UNKNOWN),
embedded_test_server_(base::FilePath(kTestFilePath)),
suppress_notifications_for_testing_(suppress_notifications_for_testing) {
SetUseLocalHostRequestsForTesting(allow_local_host_requests_for_tests);
@@ -61,7 +60,6 @@
TestNetworkQualityEstimator::TestNetworkQualityEstimator(
std::unique_ptr<NetworkQualityEstimatorParams> params)
: NetworkQualityEstimator(std::move(params), NetLog::Get()),
- current_network_type_(NetworkChangeNotifier::CONNECTION_UNKNOWN),
embedded_test_server_(base::FilePath(kTestFilePath)),
suppress_notifications_for_testing_(false) {}
diff --git a/net/nqe/network_quality_estimator_test_util.h b/net/nqe/network_quality_estimator_test_util.h
index 283b4b90..5a1b9aa 100644
--- a/net/nqe/network_quality_estimator_test_util.h
+++ b/net/nqe/network_quality_estimator_test_util.h
@@ -247,7 +247,8 @@
absl::optional<EffectiveConnectionType> effective_connection_type_;
absl::optional<EffectiveConnectionType> recent_effective_connection_type_;
- NetworkChangeNotifier::ConnectionType current_network_type_;
+ NetworkChangeNotifier::ConnectionType current_network_type_ =
+ NetworkChangeNotifier::CONNECTION_UNKNOWN;
std::string current_network_id_;
// If set, GetRecentHttpRTT() would return one of the set values.
diff --git a/net/proxy_resolution/configured_proxy_resolution_request.cc b/net/proxy_resolution/configured_proxy_resolution_request.cc
index 88b06c4..c2c8975 100644
--- a/net/proxy_resolution/configured_proxy_resolution_request.cc
+++ b/net/proxy_resolution/configured_proxy_resolution_request.cc
@@ -29,7 +29,6 @@
url_(url),
method_(method),
network_isolation_key_(network_isolation_key),
- resolve_job_(nullptr),
net_log_(net_log),
creation_time_(base::TimeTicks::Now()) {
DCHECK(!user_callback_.is_null());
diff --git a/net/proxy_resolution/configured_proxy_resolution_service.cc b/net/proxy_resolution/configured_proxy_resolution_service.cc
index f1cab35..30072447 100644
--- a/net/proxy_resolution/configured_proxy_resolution_service.cc
+++ b/net/proxy_resolution/configured_proxy_resolution_service.cc
@@ -418,8 +418,7 @@
class ConfiguredProxyResolutionService::InitProxyResolver {
public:
- InitProxyResolver()
- : proxy_resolver_factory_(nullptr), proxy_resolver_(nullptr) {}
+ InitProxyResolver() = default;
InitProxyResolver(const InitProxyResolver&) = delete;
InitProxyResolver& operator=(const InitProxyResolver&) = delete;
@@ -600,9 +599,9 @@
PacFileDataWithSource script_data_;
base::TimeDelta wait_delay_;
std::unique_ptr<PacFileDecider> decider_;
- raw_ptr<ProxyResolverFactory> proxy_resolver_factory_;
+ raw_ptr<ProxyResolverFactory> proxy_resolver_factory_ = nullptr;
std::unique_ptr<ProxyResolverFactory::Request> create_resolver_request_;
- raw_ptr<std::unique_ptr<ProxyResolver>> proxy_resolver_;
+ raw_ptr<std::unique_ptr<ProxyResolver>> proxy_resolver_ = nullptr;
CompletionOnceCallback callback_;
State next_state_ = State::kNone;
bool quick_check_enabled_ = true;
diff --git a/net/proxy_resolution/configured_proxy_resolution_service_unittest.cc b/net/proxy_resolution/configured_proxy_resolution_service_unittest.cc
index fe1e4d7..cdd6bc8b 100644
--- a/net/proxy_resolution/configured_proxy_resolution_service_unittest.cc
+++ b/net/proxy_resolution/configured_proxy_resolution_service_unittest.cc
@@ -161,13 +161,11 @@
class MockProxyConfigService : public ProxyConfigService {
public:
explicit MockProxyConfigService(const ProxyConfig& config)
- : availability_(CONFIG_VALID),
- config_(
+ : config_(
ProxyConfigWithAnnotation(config, TRAFFIC_ANNOTATION_FOR_TESTS)) {}
explicit MockProxyConfigService(const std::string& pac_url)
- : availability_(CONFIG_VALID),
- config_(ProxyConfig::CreateFromCustomPacURL(GURL(pac_url)),
+ : config_(ProxyConfig::CreateFromCustomPacURL(GURL(pac_url)),
TRAFFIC_ANNOTATION_FOR_TESTS) {}
void AddObserver(Observer* observer) override {
@@ -199,7 +197,7 @@
}
private:
- ConfigAvailability availability_;
+ ConfigAvailability availability_ = CONFIG_VALID;
ProxyConfigWithAnnotation config_;
base::ObserverList<Observer, true>::Unchecked observers_;
};
diff --git a/net/proxy_resolution/mock_pac_file_fetcher.cc b/net/proxy_resolution/mock_pac_file_fetcher.cc
index 3aebe8bb..aa950804 100644
--- a/net/proxy_resolution/mock_pac_file_fetcher.cc
+++ b/net/proxy_resolution/mock_pac_file_fetcher.cc
@@ -14,7 +14,7 @@
namespace net {
-MockPacFileFetcher::MockPacFileFetcher() : pending_request_text_(nullptr) {}
+MockPacFileFetcher::MockPacFileFetcher() = default;
MockPacFileFetcher::~MockPacFileFetcher() = default;
diff --git a/net/proxy_resolution/mock_pac_file_fetcher.h b/net/proxy_resolution/mock_pac_file_fetcher.h
index c3142a187..2947259 100644
--- a/net/proxy_resolution/mock_pac_file_fetcher.h
+++ b/net/proxy_resolution/mock_pac_file_fetcher.h
@@ -44,7 +44,7 @@
private:
GURL pending_request_url_;
CompletionOnceCallback pending_request_callback_;
- raw_ptr<std::u16string> pending_request_text_;
+ raw_ptr<std::u16string> pending_request_text_ = nullptr;
base::OnceClosure on_fetch_complete_;
bool is_shutdown_ = false;
};
diff --git a/net/proxy_resolution/multi_threaded_proxy_resolver.cc b/net/proxy_resolution/multi_threaded_proxy_resolver.cc
index 8ff6ab4..7a587a0 100644
--- a/net/proxy_resolution/multi_threaded_proxy_resolver.cc
+++ b/net/proxy_resolution/multi_threaded_proxy_resolver.cc
@@ -162,7 +162,7 @@
class Job : public base::RefCountedThreadSafe<Job> {
public:
- Job() : executor_(nullptr) {}
+ Job() = default;
void set_executor(Executor* executor) {
executor_ = executor;
@@ -208,7 +208,7 @@
virtual ~Job() = default;
private:
- raw_ptr<Executor> executor_;
+ raw_ptr<Executor> executor_ = nullptr;
bool was_cancelled_ = false;
};
diff --git a/net/proxy_resolution/pac_file_decider_unittest.cc b/net/proxy_resolution/pac_file_decider_unittest.cc
index 6e568b8..fa086e0 100644
--- a/net/proxy_resolution/pac_file_decider_unittest.cc
+++ b/net/proxy_resolution/pac_file_decider_unittest.cc
@@ -103,8 +103,7 @@
class RuleBasedPacFileFetcher : public PacFileFetcher {
public:
- explicit RuleBasedPacFileFetcher(const Rules* rules)
- : rules_(rules), request_context_(nullptr) {}
+ explicit RuleBasedPacFileFetcher(const Rules* rules) : rules_(rules) {}
virtual void SetRequestContext(URLRequestContext* context) {
request_context_ = context;
@@ -133,7 +132,7 @@
private:
raw_ptr<const Rules> rules_;
- raw_ptr<URLRequestContext> request_context_;
+ raw_ptr<URLRequestContext> request_context_ = nullptr;
};
// A mock retriever, returns asynchronously when CompleteRequests() is called.
diff --git a/net/proxy_resolution/pac_file_fetcher_impl.cc b/net/proxy_resolution/pac_file_fetcher_impl.cc
index e2a9114f..313f686 100644
--- a/net/proxy_resolution/pac_file_fetcher_impl.cc
+++ b/net/proxy_resolution/pac_file_fetcher_impl.cc
@@ -318,7 +318,6 @@
PacFileFetcherImpl::PacFileFetcherImpl(URLRequestContext* url_request_context)
: url_request_context_(url_request_context),
buf_(base::MakeRefCounted<IOBuffer>(kBufSize)),
- result_text_(nullptr),
max_response_bytes_(kDefaultMaxResponseBytes),
max_duration_(kDefaultMaxDuration) {
DCHECK(url_request_context);
diff --git a/net/proxy_resolution/pac_file_fetcher_impl.h b/net/proxy_resolution/pac_file_fetcher_impl.h
index 32ef8e61..185554dc 100644
--- a/net/proxy_resolution/pac_file_fetcher_impl.h
+++ b/net/proxy_resolution/pac_file_fetcher_impl.h
@@ -137,7 +137,7 @@
// This buffer is owned by the owner of |callback|, and will be filled with
// UTF16 response on completion.
- raw_ptr<std::u16string> result_text_;
+ raw_ptr<std::u16string> result_text_ = nullptr;
// The maximum number of bytes to allow in responses.
size_t max_response_bytes_;
diff --git a/net/proxy_resolution/proxy_config_service_android.cc b/net/proxy_resolution/proxy_config_service_android.cc
index 3287205e9..9dc7a7b3 100644
--- a/net/proxy_resolution/proxy_config_service_android.cc
+++ b/net/proxy_resolution/proxy_config_service_android.cc
@@ -282,9 +282,7 @@
: jni_delegate_(this),
main_task_runner_(main_task_runner),
jni_task_runner_(jni_task_runner),
- get_property_callback_(get_property_callback),
- exclude_pac_url_(false),
- has_proxy_override_(false) {}
+ get_property_callback_(get_property_callback) {}
Delegate(const Delegate&) = delete;
Delegate& operator=(const Delegate&) = delete;
@@ -489,9 +487,9 @@
scoped_refptr<base::SequencedTaskRunner> jni_task_runner_;
GetPropertyCallback get_property_callback_;
ProxyConfigWithAnnotation proxy_config_;
- bool exclude_pac_url_;
+ bool exclude_pac_url_ = false;
// This may only be accessed or modified on the JNI thread
- bool has_proxy_override_;
+ bool has_proxy_override_ = false;
};
ProxyConfigServiceAndroid::ProxyConfigServiceAndroid(
diff --git a/net/proxy_resolution/proxy_config_service_android_unittest.cc b/net/proxy_resolution/proxy_config_service_android_unittest.cc
index 7e6a2a0..8e47290 100644
--- a/net/proxy_resolution/proxy_config_service_android_unittest.cc
+++ b/net/proxy_resolution/proxy_config_service_android_unittest.cc
@@ -214,13 +214,12 @@
struct ProxyCallback {
ProxyCallback()
- : called(false),
- callback(base::BindOnce(&ProxyCallback::Call, base::Unretained(this))) {
+ : callback(base::BindOnce(&ProxyCallback::Call, base::Unretained(this))) {
}
void Call() { called = true; }
- bool called;
+ bool called = false;
base::OnceClosure callback;
};
diff --git a/net/proxy_resolution/proxy_config_service_linux.cc b/net/proxy_resolution/proxy_config_service_linux.cc
index e2448a7..0ec473e 100644
--- a/net/proxy_resolution/proxy_config_service_linux.cc
+++ b/net/proxy_resolution/proxy_config_service_linux.cc
@@ -516,8 +516,7 @@
public:
explicit SettingGetterImplKDE(base::Environment* env_var_getter)
: debounce_timer_(new base::OneShotTimer()),
- env_var_getter_(env_var_getter),
- file_task_runner_(nullptr) {
+ env_var_getter_(env_var_getter) {
// This has to be called on the UI thread (http://crbug.com/69057).
base::ThreadRestrictions::ScopedAllowIO allow_io;
diff --git a/net/proxy_resolution/proxy_config_service_mac.cc b/net/proxy_resolution/proxy_config_service_mac.cc
index a7d7037..645b2cfa 100644
--- a/net/proxy_resolution/proxy_config_service_mac.cc
+++ b/net/proxy_resolution/proxy_config_service_mac.cc
@@ -199,7 +199,6 @@
const scoped_refptr<base::SequencedTaskRunner>& sequenced_task_runner,
const NetworkTrafficAnnotationTag& traffic_annotation)
: forwarder_(this),
- has_fetched_config_(false),
helper_(new Helper(this)),
sequenced_task_runner_(sequenced_task_runner),
traffic_annotation_(traffic_annotation) {
diff --git a/net/proxy_resolution/proxy_config_service_mac.h b/net/proxy_resolution/proxy_config_service_mac.h
index e8d5a0b0..3773e53 100644
--- a/net/proxy_resolution/proxy_config_service_mac.h
+++ b/net/proxy_resolution/proxy_config_service_mac.h
@@ -76,7 +76,7 @@
base::ObserverList<Observer>::Unchecked observers_;
// Holds the last system proxy settings that we fetched.
- bool has_fetched_config_;
+ bool has_fetched_config_ = false;
ProxyConfigWithAnnotation last_config_fetched_;
scoped_refptr<Helper> helper_;
diff --git a/net/proxy_resolution/proxy_resolver_mac.cc b/net/proxy_resolution/proxy_resolver_mac.cc
index 3fc3f65..50bebc0a 100644
--- a/net/proxy_resolution/proxy_resolver_mac.cc
+++ b/net/proxy_resolution/proxy_resolver_mac.cc
@@ -124,7 +124,7 @@
base::Lock& lock_;
// Indicates whether the current observer holds the lock. It is used to
// avoid double locking and releasing.
- bool lock_acquired_;
+ bool lock_acquired_ = false;
// The underlying CFRunLoopObserverRef structure wrapped by this instance.
base::ScopedCFTypeRef<CFRunLoopObserverRef> observer_;
// Validates that all methods of this class are executed on the same thread.
@@ -132,7 +132,7 @@
};
SynchronizedRunLoopObserver::SynchronizedRunLoopObserver(base::Lock& lock)
- : lock_(lock), lock_acquired_(false) {
+ : lock_(lock) {
CFRunLoopObserverContext observer_context = {0, this, NULL, NULL, NULL};
observer_.reset(CFRunLoopObserverCreate(
kCFAllocatorDefault,
diff --git a/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win.cc b/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win.cc
index b95e619..52041a0 100644
--- a/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win.cc
+++ b/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win.cc
@@ -14,7 +14,6 @@
#include "base/task/task_runner.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/time/time.h"
-#include "net/base/net_errors.h"
#include "net/proxy_resolution/pac_file_fetcher_impl.h"
#include "net/proxy_resolution/win/dhcpcsvc_init_win.h"
#include "net/url_request/url_request_context.h"
@@ -35,10 +34,7 @@
DhcpPacFileAdapterFetcher::DhcpPacFileAdapterFetcher(
URLRequestContext* url_request_context,
scoped_refptr<base::TaskRunner> task_runner)
- : task_runner_(task_runner),
- state_(STATE_START),
- result_(ERR_IO_PENDING),
- url_request_context_(url_request_context) {
+ : task_runner_(task_runner), url_request_context_(url_request_context) {
DCHECK(url_request_context_);
}
diff --git a/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win.h b/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win.h
index e87dd26c..2ecf2250 100644
--- a/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win.h
+++ b/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win.h
@@ -16,6 +16,7 @@
#include "base/threading/thread_checker.h"
#include "base/timer/timer.h"
#include "net/base/completion_once_callback.h"
+#include "net/base/net_errors.h"
#include "net/base/net_export.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "url/gurl.h"
@@ -171,10 +172,10 @@
scoped_refptr<base::TaskRunner> task_runner_;
// Current state of this state machine.
- State state_;
+ State state_ = STATE_START;
// A network error indicating result of operation.
- int result_;
+ int result_ = ERR_IO_PENDING;
// Empty string or the PAC script downloaded.
std::u16string pac_script_;
diff --git a/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win_unittest.cc b/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win_unittest.cc
index afd1d6a6..b6d642f 100644
--- a/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win_unittest.cc
+++ b/net/proxy_resolution/win/dhcp_pac_file_adapter_fetcher_win_unittest.cc
@@ -52,11 +52,7 @@
URLRequestContext* context,
scoped_refptr<base::TaskRunner> task_runner)
: DhcpPacFileAdapterFetcher(context, task_runner),
- dhcp_delay_(base::Milliseconds(1)),
timeout_(TestTimeouts::action_timeout()),
- configured_url_(kPacUrl),
- fetcher_delay_ms_(1),
- fetcher_result_(OK),
pac_script_("bingo") {}
void Cancel() override {
@@ -139,11 +135,11 @@
dhcp_query_->test_finished_event_.Signal();
}
- base::TimeDelta dhcp_delay_;
+ base::TimeDelta dhcp_delay_ = base::Milliseconds(1);
base::TimeDelta timeout_;
- std::string configured_url_;
- int fetcher_delay_ms_;
- int fetcher_result_;
+ std::string configured_url_{kPacUrl};
+ int fetcher_delay_ms_ = 1;
+ int fetcher_result_ = OK;
std::string pac_script_;
raw_ptr<MockPacFileFetcher> fetcher_;
base::OneShotTimer fetcher_timer_;
diff --git a/net/proxy_resolution/win/dhcp_pac_file_fetcher_win.cc b/net/proxy_resolution/win/dhcp_pac_file_fetcher_win.cc
index af1d3ad5..b5b6803d 100644
--- a/net/proxy_resolution/win/dhcp_pac_file_fetcher_win.cc
+++ b/net/proxy_resolution/win/dhcp_pac_file_fetcher_win.cc
@@ -255,10 +255,7 @@
DhcpPacFileFetcherWin::DhcpPacFileFetcherWin(
URLRequestContext* url_request_context)
- : state_(STATE_START),
- num_pending_fetchers_(0),
- destination_string_(nullptr),
- url_request_context_(url_request_context),
+ : url_request_context_(url_request_context),
task_runner_(base::MakeRefCounted<TaskRunnerWithCap>()) {
DCHECK(url_request_context_);
}
diff --git a/net/proxy_resolution/win/dhcp_pac_file_fetcher_win.h b/net/proxy_resolution/win/dhcp_pac_file_fetcher_win.h
index 1a8e9a6..b25285d7 100644
--- a/net/proxy_resolution/win/dhcp_pac_file_fetcher_win.h
+++ b/net/proxy_resolution/win/dhcp_pac_file_fetcher_win.h
@@ -167,12 +167,12 @@
FetcherVector fetchers_;
// Current state of this state machine.
- State state_;
+ State state_ = STATE_START;
// The following members are associated with the latest call to Fetch().
// Number of fetchers we are waiting for.
- int num_pending_fetchers_;
+ int num_pending_fetchers_ = 0;
// Lets our client know we're done. Not valid in states START or DONE.
CompletionOnceCallback callback_;
@@ -182,7 +182,7 @@
// Pointer to string we will write results to. Not valid in states
// START and DONE.
- raw_ptr<std::u16string> destination_string_;
+ raw_ptr<std::u16string> destination_string_ = nullptr;
// PAC URL retrieved from DHCP, if any. Valid only in state STATE_DONE.
GURL pac_url_;
diff --git a/net/proxy_resolution/win/dhcp_pac_file_fetcher_win_unittest.cc b/net/proxy_resolution/win/dhcp_pac_file_fetcher_win_unittest.cc
index 9657fe1..a4bb2d82 100644
--- a/net/proxy_resolution/win/dhcp_pac_file_fetcher_win_unittest.cc
+++ b/net/proxy_resolution/win/dhcp_pac_file_fetcher_win_unittest.cc
@@ -53,9 +53,7 @@
public:
RealFetchTester()
: context_(CreateTestURLRequestContextBuilder()->Build()),
- fetcher_(new DhcpPacFileFetcherWin(context_.get())),
- finished_(false),
- on_completion_is_error_(false) {
+ fetcher_(new DhcpPacFileFetcherWin(context_.get())) {
// Make sure the test ends.
timeout_.Start(FROM_HERE, base::Seconds(5), this,
&RealFetchTester::OnTimeout);
@@ -119,11 +117,11 @@
std::unique_ptr<URLRequestContext> context_;
std::unique_ptr<DhcpPacFileFetcherWin> fetcher_;
- bool finished_;
+ bool finished_ = false;
std::u16string pac_text_;
base::OneShotTimer timeout_;
base::OneShotTimer cancel_timer_;
- bool on_completion_is_error_;
+ bool on_completion_is_error_ = false;
};
TEST(DhcpPacFileFetcherWin, RealFetch) {
@@ -218,11 +216,7 @@
public:
DummyDhcpPacFileAdapterFetcher(URLRequestContext* context,
scoped_refptr<base::TaskRunner> runner)
- : DhcpPacFileAdapterFetcher(context, runner),
- did_finish_(false),
- result_(OK),
- pac_script_(u"bingo"),
- fetch_delay_ms_(1) {}
+ : DhcpPacFileAdapterFetcher(context, runner), pac_script_(u"bingo") {}
void Fetch(const std::string& adapter_name,
CompletionOnceCallback callback,
@@ -259,10 +253,10 @@
}
private:
- bool did_finish_;
- int result_;
+ bool did_finish_ = false;
+ int result_ = OK;
std::u16string pac_script_;
- int fetch_delay_ms_;
+ int fetch_delay_ms_ = 1;
CompletionOnceCallback callback_;
base::OneShotTimer timer_;
};
@@ -290,7 +284,6 @@
MockDhcpPacFileFetcherWin(URLRequestContext* context)
: DhcpPacFileFetcherWin(context),
- num_fetchers_created_(0),
worker_finished_event_(
base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED) {
@@ -372,7 +365,7 @@
scoped_refptr<MockAdapterQuery> adapter_query_;
base::TimeDelta max_wait_;
- int num_fetchers_created_;
+ int num_fetchers_created_ = 0;
base::WaitableEvent worker_finished_event_;
};
@@ -380,9 +373,7 @@
public:
FetcherClient()
: context_(CreateTestURLRequestContextBuilder()->Build()),
- fetcher_(context_.get()),
- finished_(false),
- result_(ERR_UNEXPECTED) {}
+ fetcher_(context_.get()) {}
void RunTest() {
int result = fetcher_.Fetch(
@@ -434,8 +425,8 @@
std::unique_ptr<URLRequestContext> context_;
MockDhcpPacFileFetcherWin fetcher_;
- bool finished_;
- int result_;
+ bool finished_ = false;
+ int result_ = ERR_UNEXPECTED;
std::u16string pac_text_;
};
diff --git a/net/proxy_resolution/win/proxy_resolver_winhttp.cc b/net/proxy_resolution/win/proxy_resolver_winhttp.cc
index 2fed37a..ae5fa94 100644
--- a/net/proxy_resolution/win/proxy_resolver_winhttp.cc
+++ b/net/proxy_resolution/win/proxy_resolver_winhttp.cc
@@ -72,15 +72,14 @@
void CloseWinHttpSession();
// Proxy configuration is cached on the session handle.
- HINTERNET session_handle_;
+ HINTERNET session_handle_ = nullptr;
const GURL pac_url_;
};
ProxyResolverWinHttp::ProxyResolverWinHttp(
const scoped_refptr<PacFileData>& script_data)
- : session_handle_(nullptr),
- pac_url_(script_data->type() == PacFileData::TYPE_AUTO_DETECT
+ : pac_url_(script_data->type() == PacFileData::TYPE_AUTO_DETECT
? GURL("http://wpad/wpad.dat")
: script_data->url()) {}
diff --git a/net/quic/bidirectional_stream_quic_impl.cc b/net/quic/bidirectional_stream_quic_impl.cc
index befaf5538..3f90770 100644
--- a/net/quic/bidirectional_stream_quic_impl.cc
+++ b/net/quic/bidirectional_stream_quic_impl.cc
@@ -40,10 +40,7 @@
BidirectionalStreamQuicImpl::BidirectionalStreamQuicImpl(
std::unique_ptr<QuicChromiumClientSession::Handle> session)
- : session_(std::move(session)),
- stream_(nullptr),
- request_info_(nullptr),
- delegate_(nullptr) {}
+ : session_(std::move(session)) {}
BidirectionalStreamQuicImpl::~BidirectionalStreamQuicImpl() {
if (stream_) {
diff --git a/net/quic/bidirectional_stream_quic_impl.h b/net/quic/bidirectional_stream_quic_impl.h
index eb54b1f6..3a4442b 100644
--- a/net/quic/bidirectional_stream_quic_impl.h
+++ b/net/quic/bidirectional_stream_quic_impl.h
@@ -86,8 +86,8 @@
const std::unique_ptr<QuicChromiumClientSession::Handle> session_;
std::unique_ptr<QuicChromiumClientStream::Handle> stream_;
- raw_ptr<const BidirectionalStreamRequestInfo> request_info_;
- raw_ptr<BidirectionalStreamImpl::Delegate> delegate_;
+ raw_ptr<const BidirectionalStreamRequestInfo> request_info_ = nullptr;
+ raw_ptr<BidirectionalStreamImpl::Delegate> delegate_ = nullptr;
// Saves the response status if the stream is explicitly closed via OnError
// or OnClose with an error. Once all buffered data has been returned, this
// will be used as the final response.
diff --git a/net/quic/bidirectional_stream_quic_impl_unittest.cc b/net/quic/bidirectional_stream_quic_impl_unittest.cc
index e7132c61..42a8428 100644
--- a/net/quic/bidirectional_stream_quic_impl_unittest.cc
+++ b/net/quic/bidirectional_stream_quic_impl_unittest.cc
@@ -123,21 +123,7 @@
std::unique_ptr<base::OneShotTimer> timer)
: read_buf_(read_buf),
read_buf_len_(read_buf_len),
- timer_(std::move(timer)),
- loop_(nullptr),
- next_proto_(kProtoUnknown),
- received_bytes_(0),
- sent_bytes_(0),
- has_load_timing_info_(false),
- error_(OK),
- on_data_read_count_(0),
- on_data_sent_count_(0),
- not_expect_callback_(false),
- on_failed_called_(false),
- send_request_headers_automatically_(true),
- is_ready_(false),
- trailers_expected_(false),
- trailers_received_(false) {
+ timer_(std::move(timer)) {
loop_ = std::make_unique<base::RunLoop>();
}
@@ -338,23 +324,23 @@
std::unique_ptr<base::RunLoop> loop_;
spdy::Http2HeaderBlock response_headers_;
spdy::Http2HeaderBlock trailers_;
- NextProto next_proto_;
- int64_t received_bytes_;
- int64_t sent_bytes_;
- bool has_load_timing_info_;
+ NextProto next_proto_ = kProtoUnknown;
+ int64_t received_bytes_ = 0;
+ int64_t sent_bytes_ = 0;
+ bool has_load_timing_info_ = false;
LoadTimingInfo load_timing_info_;
- int error_;
- int on_data_read_count_;
- int on_data_sent_count_;
+ int error_ = OK;
+ int on_data_read_count_ = 0;
+ int on_data_sent_count_ = 0;
// This is to ensure that delegate callback is not invoked synchronously when
// calling into |stream_|.
- bool not_expect_callback_;
- bool on_failed_called_;
+ bool not_expect_callback_ = false;
+ bool on_failed_called_ = false;
CompletionOnceCallback callback_;
- bool send_request_headers_automatically_;
- bool is_ready_;
- bool trailers_expected_;
- bool trailers_received_;
+ bool send_request_headers_automatically_ = true;
+ bool is_ready_ = false;
+ bool trailers_expected_ = false;
+ bool trailers_received_ = false;
};
// A delegate that deletes the stream in a particular callback.
@@ -466,7 +452,6 @@
kDefaultServerHostName,
quic::Perspective::IS_SERVER,
false),
- random_generator_(0),
printer_(version_),
destination_(url::kHttpsScheme,
kDefaultServerHostName,
@@ -855,7 +840,7 @@
QuicTestPacketMaker server_maker_;
IPEndPoint self_addr_;
IPEndPoint peer_addr_;
- quic::test::MockRandom random_generator_;
+ quic::test::MockRandom random_generator_{0};
QuicPacketPrinter printer_;
MockCryptoClientStreamFactory crypto_client_stream_factory_;
std::unique_ptr<StaticSocketDataProvider> socket_data_;
diff --git a/net/quic/mock_crypto_client_stream_factory.cc b/net/quic/mock_crypto_client_stream_factory.cc
index 3b50b76..49a9935 100644
--- a/net/quic/mock_crypto_client_stream_factory.cc
+++ b/net/quic/mock_crypto_client_stream_factory.cc
@@ -15,7 +15,7 @@
MockCryptoClientStreamFactory::~MockCryptoClientStreamFactory() {}
MockCryptoClientStreamFactory::MockCryptoClientStreamFactory()
- : last_stream_(nullptr), config_(new quic::QuicConfig()) {}
+ : config_(new quic::QuicConfig()) {}
void MockCryptoClientStreamFactory::SetConfig(const quic::QuicConfig& config) {
config_ = std::make_unique<quic::QuicConfig>(config);
diff --git a/net/quic/mock_crypto_client_stream_factory.h b/net/quic/mock_crypto_client_stream_factory.h
index 540660cc..2a703b8 100644
--- a/net/quic/mock_crypto_client_stream_factory.h
+++ b/net/quic/mock_crypto_client_stream_factory.h
@@ -58,7 +58,7 @@
private:
MockCryptoClientStream::HandshakeMode handshake_mode_ =
MockCryptoClientStream::CONFIRM_HANDSHAKE;
- raw_ptr<MockCryptoClientStream> last_stream_;
+ raw_ptr<MockCryptoClientStream> last_stream_ = nullptr;
base::queue<const ProofVerifyDetailsChromium*> proof_verify_details_queue_;
std::unique_ptr<quic::QuicConfig> config_;
bool use_mock_crypter_ = false;
diff --git a/net/quic/quic_chromium_client_session.cc b/net/quic/quic_chromium_client_session.cc
index 918f5e05..b84d03f 100644
--- a/net/quic/quic_chromium_client_session.cc
+++ b/net/quic/quic_chromium_client_session.cc
@@ -628,7 +628,6 @@
const NetworkTrafficAnnotationTag& traffic_annotation)
: session_(session),
requires_confirmation_(requires_confirmation),
- stream_(nullptr),
traffic_annotation_(traffic_annotation) {}
QuicChromiumClientSession::StreamRequest::~StreamRequest() {
diff --git a/net/quic/quic_chromium_client_session_test.cc b/net/quic/quic_chromium_client_session_test.cc
index ffba0e1..ca0e1ea3 100644
--- a/net/quic/quic_chromium_client_session_test.cc
+++ b/net/quic/quic_chromium_client_session_test.cc
@@ -138,7 +138,6 @@
socket_data_(
new SequencedSocketData(base::make_span(default_read_.get(), 1),
base::span<MockWrite>())),
- random_(0),
helper_(&clock_, &random_),
transport_security_state_(std::make_unique<TransportSecurityState>()),
session_key_(kServerHostname,
@@ -297,7 +296,7 @@
std::unique_ptr<MockRead> default_read_;
std::unique_ptr<SequencedSocketData> socket_data_;
quic::MockClock clock_;
- quic::test::MockRandom random_;
+ quic::test::MockRandom random_{0};
QuicChromiumConnectionHelper helper_;
quic::test::MockAlarmFactory alarm_factory_;
std::unique_ptr<TransportSecurityState> transport_security_state_;
diff --git a/net/quic/quic_chromium_client_stream.cc b/net/quic/quic_chromium_client_stream.cc
index 9767668..11a2dd5 100644
--- a/net/quic/quic_chromium_client_stream.cc
+++ b/net/quic/quic_chromium_client_stream.cc
@@ -45,9 +45,7 @@
} // namespace
QuicChromiumClientStream::Handle::Handle(QuicChromiumClientStream* stream)
- : stream_(stream),
- read_headers_buffer_(nullptr),
- net_log_(stream->net_log()) {
+ : stream_(stream), net_log_(stream->net_log()) {
SaveState();
}
@@ -446,15 +444,8 @@
const NetworkTrafficAnnotationTag& traffic_annotation)
: quic::QuicSpdyStream(id, session, type),
net_log_(net_log),
- handle_(nullptr),
- initial_headers_sent_(false),
session_(session),
- quic_version_(session->connection()->transport_version()),
- can_migrate_to_cellular_network_(true),
- initial_headers_arrived_(false),
- headers_delivered_(false),
- initial_headers_frame_len_(0),
- trailing_headers_frame_len_(0) {}
+ quic_version_(session->connection()->transport_version()) {}
QuicChromiumClientStream::QuicChromiumClientStream(
quic::PendingStream* pending,
@@ -463,15 +454,8 @@
const NetworkTrafficAnnotationTag& traffic_annotation)
: quic::QuicSpdyStream(pending, session),
net_log_(net_log),
- handle_(nullptr),
- initial_headers_sent_(false),
session_(session),
- quic_version_(session->connection()->transport_version()),
- can_migrate_to_cellular_network_(true),
- initial_headers_arrived_(false),
- headers_delivered_(false),
- initial_headers_frame_len_(0),
- trailing_headers_frame_len_(0) {}
+ quic_version_(session->connection()->transport_version()) {}
QuicChromiumClientStream::~QuicChromiumClientStream() {
if (handle_)
diff --git a/net/quic/quic_chromium_client_stream.h b/net/quic/quic_chromium_client_stream.h
index fbf9299..b254848f 100644
--- a/net/quic/quic_chromium_client_stream.h
+++ b/net/quic/quic_chromium_client_stream.h
@@ -183,7 +183,7 @@
// Callback to be invoked when ReadInitialHeaders completes asynchronously.
CompletionOnceCallback read_headers_callback_;
// Provided by the owner of this handle when ReadInitialHeaders is called.
- raw_ptr<spdy::Http2HeaderBlock> read_headers_buffer_;
+ raw_ptr<spdy::Http2HeaderBlock> read_headers_buffer_ = nullptr;
// Callback to be invoked when ReadBody completes asynchronously.
CompletionOnceCallback read_body_callback_;
@@ -312,30 +312,30 @@
void NotifyHandleOfDataAvailable();
NetLogWithSource net_log_;
- raw_ptr<Handle> handle_;
+ raw_ptr<Handle> handle_ = nullptr;
// True when initial headers have been sent.
- bool initial_headers_sent_;
+ bool initial_headers_sent_ = false;
raw_ptr<quic::QuicSpdyClientSessionBase> session_;
quic::QuicTransportVersion quic_version_;
// Set to false if this stream should not be migrated to a cellular network
// during connection migration.
- bool can_migrate_to_cellular_network_;
+ bool can_migrate_to_cellular_network_ = true;
// True if non-informational (non-1xx) initial headers have arrived.
- bool initial_headers_arrived_;
+ bool initial_headers_arrived_ = false;
// True if non-informational (non-1xx) initial headers have been delivered to
// the handle.
- bool headers_delivered_;
+ bool headers_delivered_ = false;
// Stores the initial header until they are delivered to the handle.
spdy::Http2HeaderBlock initial_headers_;
// Length of the HEADERS frame containing initial headers.
- size_t initial_headers_frame_len_;
+ size_t initial_headers_frame_len_ = 0;
// Length of the HEADERS frame containing trailing headers.
- size_t trailing_headers_frame_len_;
+ size_t trailing_headers_frame_len_ = 0;
struct EarlyHints {
EarlyHints(spdy::Http2HeaderBlock headers, size_t frame_len)
diff --git a/net/quic/quic_chromium_packet_writer.cc b/net/quic/quic_chromium_packet_writer.cc
index a9c070cd..f1fcd2c 100644
--- a/net/quic/quic_chromium_packet_writer.cc
+++ b/net/quic/quic_chromium_packet_writer.cc
@@ -81,18 +81,12 @@
std::memcpy(data(), buffer, buf_len);
}
-QuicChromiumPacketWriter::QuicChromiumPacketWriter() {}
-
QuicChromiumPacketWriter::QuicChromiumPacketWriter(
DatagramClientSocket* socket,
base::SequencedTaskRunner* task_runner)
: socket_(socket),
- delegate_(nullptr),
- packet_(
- base::MakeRefCounted<ReusableIOBuffer>(quic::kMaxOutgoingPacketSize)),
- write_in_progress_(false),
- force_write_blocked_(false),
- retry_count_(0) {
+ packet_(base::MakeRefCounted<ReusableIOBuffer>(
+ quic::kMaxOutgoingPacketSize)) {
retry_timer_.SetTaskRunner(task_runner);
write_callback_ = base::BindRepeating(
&QuicChromiumPacketWriter::OnWriteComplete, weak_factory_.GetWeakPtr());
diff --git a/net/quic/quic_chromium_packet_writer.h b/net/quic/quic_chromium_packet_writer.h
index 1781d34..5535eef 100644
--- a/net/quic/quic_chromium_packet_writer.h
+++ b/net/quic/quic_chromium_packet_writer.h
@@ -65,7 +65,6 @@
virtual void OnWriteUnblocked() = 0;
};
- QuicChromiumPacketWriter();
// |socket| and |task_runner| must outlive writer.
QuicChromiumPacketWriter(DatagramClientSocket* socket,
base::SequencedTaskRunner* task_runner);
@@ -112,7 +111,7 @@
void RetryPacketAfterNoBuffers();
quic::WriteResult WritePacketToSocketImpl();
raw_ptr<DatagramClientSocket> socket_; // Unowned.
- raw_ptr<Delegate> delegate_; // Unowned.
+ raw_ptr<Delegate> delegate_ = nullptr; // Unowned.
// Reused for every packet write for the lifetime of the writer. Is
// moved to the delegate in the case of a write error.
scoped_refptr<ReusableIOBuffer> packet_;
@@ -120,13 +119,13 @@
// Whether a write is currently in progress: true if an asynchronous write is
// in flight, or a retry of a previous write is in progress, or session is
// handling write error of a previous write.
- bool write_in_progress_;
+ bool write_in_progress_ = false;
// If ture, IsWriteBlocked() will return true regardless of
// |write_in_progress_|.
- bool force_write_blocked_;
+ bool force_write_blocked_ = false;
- int retry_count_;
+ int retry_count_ = 0;
// Timer set when a packet should be retried after ENOBUFS.
base::OneShotTimer retry_timer_;
diff --git a/net/quic/quic_http_stream.cc b/net/quic/quic_http_stream.cc
index f3ba9a4..dcbcaef 100644
--- a/net/quic/quic_http_stream.cc
+++ b/net/quic/quic_http_stream.cc
@@ -62,10 +62,6 @@
std::unique_ptr<QuicChromiumClientSession::Handle> session,
std::set<std::string> dns_aliases)
: MultiplexedHttpStream(std::move(session)),
- stream_(nullptr),
- request_info_(nullptr),
- request_body_stream_(nullptr),
- response_info_(nullptr),
dns_aliases_(std::move(dns_aliases)) {}
QuicHttpStream::~QuicHttpStream() {
diff --git a/net/quic/quic_http_stream.h b/net/quic/quic_http_stream.h
index e4dfa0d0..d19f78d 100644
--- a/net/quic/quic_http_stream.h
+++ b/net/quic/quic_http_stream.h
@@ -160,20 +160,20 @@
// The request to send.
// Only valid before the response body is read.
- raw_ptr<const HttpRequestInfo> request_info_;
+ raw_ptr<const HttpRequestInfo> request_info_ = nullptr;
// Whether this request can be sent without confirmation.
bool can_send_early_ = false;
// The request body to send, if any, owned by the caller.
- raw_ptr<UploadDataStream> request_body_stream_;
+ raw_ptr<UploadDataStream> request_body_stream_ = nullptr;
// Time the request was issued.
base::Time request_time_;
// The priority of the request.
RequestPriority priority_ = MINIMUM_PRIORITY;
// |response_info_| is the HTTP response data object which is filled in
// when a the response headers are read. It is not owned by this stream.
- raw_ptr<HttpResponseInfo> response_info_;
+ raw_ptr<HttpResponseInfo> response_info_ = nullptr;
bool has_response_status_ = false; // true if response_status_ as been set.
// Because response data is buffered, also buffer the response status if the
// stream is explicitly closed via OnError or OnClose with an error.
diff --git a/net/quic/quic_http_stream_test.cc b/net/quic/quic_http_stream_test.cc
index 8f0471f..84e6718 100644
--- a/net/quic/quic_http_stream_test.cc
+++ b/net/quic/quic_http_stream_test.cc
@@ -288,7 +288,6 @@
kDefaultServerHostName,
quic::Perspective::IS_SERVER,
false),
- random_generator_(0),
printer_(version_) {
FLAGS_quic_enable_http3_grease_randomness = false;
quic::QuicEnableVersion(version_);
@@ -702,7 +701,7 @@
QuicTestPacketMaker server_maker_;
IPEndPoint self_addr_;
IPEndPoint peer_addr_;
- quic::test::MockRandom random_generator_;
+ quic::test::MockRandom random_generator_{0};
ProofVerifyDetailsChromium verify_details_;
MockCryptoClientStreamFactory crypto_client_stream_factory_;
std::unique_ptr<StaticSocketDataProvider> socket_data_;
diff --git a/net/quic/quic_proxy_client_socket.cc b/net/quic/quic_proxy_client_socket.cc
index 512e987..3daf0ced 100644
--- a/net/quic/quic_proxy_client_socket.cc
+++ b/net/quic/quic_proxy_client_socket.cc
@@ -33,7 +33,6 @@
ProxyDelegate* proxy_delegate)
: stream_(std::move(stream)),
session_(std::move(session)),
- read_buf_(nullptr),
endpoint_(endpoint),
auth_(auth_controller),
proxy_server_(proxy_server),
diff --git a/net/quic/quic_proxy_client_socket.h b/net/quic/quic_proxy_client_socket.h
index 4a31834f..1bbf40d 100644
--- a/net/quic/quic_proxy_client_socket.h
+++ b/net/quic/quic_proxy_client_socket.h
@@ -120,7 +120,7 @@
// Stores the callback for Read().
CompletionOnceCallback read_callback_;
// Stores the read buffer pointer for Read().
- raw_ptr<IOBuffer> read_buf_;
+ raw_ptr<IOBuffer> read_buf_ = nullptr;
// Stores the callback for Write().
CompletionOnceCallback write_callback_;
// Stores the write buffer length for Write().
diff --git a/net/quic/quic_proxy_client_socket_unittest.cc b/net/quic/quic_proxy_client_socket_unittest.cc
index fbad904..49aeb05 100644
--- a/net/quic/quic_proxy_client_socket_unittest.cc
+++ b/net/quic/quic_proxy_client_socket_unittest.cc
@@ -184,7 +184,6 @@
kProxyHost,
quic::Perspective::IS_SERVER,
false),
- random_generator_(0),
user_agent_(kUserAgent),
proxy_endpoint_(url::kHttpsScheme, kProxyHost, kProxyPort),
destination_endpoint_(url::kHttpsScheme, kOriginHost, kOriginPort),
@@ -637,7 +636,7 @@
QuicTestPacketMaker client_maker_;
QuicTestPacketMaker server_maker_;
IPEndPoint peer_addr_;
- quic::test::MockRandom random_generator_;
+ quic::test::MockRandom random_generator_{0};
ProofVerifyDetailsChromium verify_details_;
MockCryptoClientStreamFactory crypto_client_stream_factory_;
diff --git a/net/quic/quic_stream_factory.cc b/net/quic/quic_stream_factory.cc
index 2ed3c62..0c2ed48 100644
--- a/net/quic/quic_stream_factory.cc
+++ b/net/quic/quic_stream_factory.cc
@@ -1171,7 +1171,6 @@
host_resolver_(host_resolver),
client_socket_factory_(client_socket_factory),
http_server_properties_(http_server_properties),
- push_delegate_(nullptr),
cert_verifier_(cert_verifier),
ct_policy_enforcer_(ct_policy_enforcer),
transport_security_state_(transport_security_state),
@@ -1197,8 +1196,6 @@
kQuicYieldAfterDurationMilliseconds)),
default_network_(NetworkChangeNotifier::kInvalidNetworkHandle),
connectivity_monitor_(default_network_),
- tick_clock_(nullptr),
- task_runner_(nullptr),
ssl_config_service_(ssl_config_service),
use_network_isolation_key_for_crypto_configs_(
base::FeatureList::IsEnabled(
diff --git a/net/quic/quic_stream_factory.h b/net/quic/quic_stream_factory.h
index 7151d302..c509693 100644
--- a/net/quic/quic_stream_factory.h
+++ b/net/quic/quic_stream_factory.h
@@ -521,7 +521,7 @@
raw_ptr<HostResolver> host_resolver_;
raw_ptr<ClientSocketFactory> client_socket_factory_;
raw_ptr<HttpServerProperties> http_server_properties_;
- raw_ptr<ServerPushDelegate> push_delegate_;
+ raw_ptr<ServerPushDelegate> push_delegate_ = nullptr;
const raw_ptr<CertVerifier> cert_verifier_;
const raw_ptr<CTPolicyEnforcer> ct_policy_enforcer_;
const raw_ptr<TransportSecurityState> transport_security_state_;
@@ -608,9 +608,9 @@
QuicConnectivityMonitor connectivity_monitor_;
- raw_ptr<const base::TickClock> tick_clock_;
+ raw_ptr<const base::TickClock> tick_clock_ = nullptr;
- raw_ptr<base::SequencedTaskRunner> task_runner_;
+ raw_ptr<base::SequencedTaskRunner> task_runner_ = nullptr;
const raw_ptr<SSLConfigService> ssl_config_service_;
diff --git a/net/quic/quic_stream_factory_test.cc b/net/quic/quic_stream_factory_test.cc
index 32370cf..79c9947 100644
--- a/net/quic/quic_stream_factory_test.cc
+++ b/net/quic/quic_stream_factory_test.cc
@@ -229,8 +229,6 @@
false),
http_server_properties_(std::make_unique<HttpServerProperties>()),
cert_verifier_(std::make_unique<MockCertVerifier>()),
- scoped_mock_network_change_notifier_(nullptr),
- factory_(nullptr),
scheme_host_port_(url::kHttpsScheme,
kDefaultServerHostName,
kDefaultServerPort),
diff --git a/net/reporting/reporting_policy.cc b/net/reporting/reporting_policy.cc
index 956db4137..bb895c5 100644
--- a/net/reporting/reporting_policy.cc
+++ b/net/reporting/reporting_policy.cc
@@ -30,12 +30,7 @@
*owned_policy = policy;
}
-ReportingPolicy::ReportingPolicy()
- : delivery_interval(base::Minutes(1)),
- persistence_interval(base::Minutes(1)),
- garbage_collection_interval(base::Minutes(5)),
- max_report_age(base::Minutes(15)),
- max_group_staleness(base::Days(7)) {
+ReportingPolicy::ReportingPolicy() {
endpoint_backoff_policy.num_errors_to_ignore = 0;
endpoint_backoff_policy.initial_delay_ms = 60 * 1000; // 1 minute
endpoint_backoff_policy.multiply_factor = 2.0;
diff --git a/net/reporting/reporting_policy.h b/net/reporting/reporting_policy.h
index edecae7..4edf5781 100644
--- a/net/reporting/reporting_policy.h
+++ b/net/reporting/reporting_policy.h
@@ -39,14 +39,14 @@
size_t max_endpoints_per_origin = 40u;
// Minimum interval at which to attempt delivery of queued reports.
- base::TimeDelta delivery_interval;
+ base::TimeDelta delivery_interval = base::Minutes(1);
// Backoff policy for failing endpoints.
BackoffEntry::Policy endpoint_backoff_policy;
// Minimum interval at which Reporting will persist state to (relatively)
// stable storage to be restored if the embedder restarts.
- base::TimeDelta persistence_interval;
+ base::TimeDelta persistence_interval = base::Minutes(1);
// Whether to persist undelivered reports across embedder restarts.
bool persist_reports_across_restarts = false;
@@ -56,13 +56,13 @@
bool persist_clients_across_restarts = true;
// Minimum interval at which to garbage-collect the cache.
- base::TimeDelta garbage_collection_interval;
+ base::TimeDelta garbage_collection_interval = base::Minutes(5);
// Maximum age a report can be queued for before being discarded as expired.
- base::TimeDelta max_report_age;
+ base::TimeDelta max_report_age = base::Minutes(15);
// Maximum time an endpoint group can go unused before being deleted.
- base::TimeDelta max_group_staleness;
+ base::TimeDelta max_group_staleness = base::Days(7);
// Maximum number of delivery attempts a report can have before being
// discarded as failed.
diff --git a/net/reporting/reporting_test_util.cc b/net/reporting/reporting_test_util.cc
index d12ccf0..08cf7192 100644
--- a/net/reporting/reporting_test_util.cc
+++ b/net/reporting/reporting_test_util.cc
@@ -191,7 +191,7 @@
garbage_collection_timer_ = nullptr;
}
-ReportingTestBase::ReportingTestBase() : store_(nullptr) {
+ReportingTestBase::ReportingTestBase() {
// For tests, disable jitter.
ReportingPolicy policy;
policy.endpoint_backoff_policy.jitter_factor = 0.0;
diff --git a/net/reporting/reporting_test_util.h b/net/reporting/reporting_test_util.h
index 6c1353c..f25577d 100644
--- a/net/reporting/reporting_test_util.h
+++ b/net/reporting/reporting_test_util.h
@@ -290,7 +290,7 @@
base::SimpleTestClock clock_;
base::SimpleTestTickClock tick_clock_;
std::unique_ptr<TestReportingContext> context_;
- raw_ptr<ReportingCache::PersistentReportingStore> store_;
+ raw_ptr<ReportingCache::PersistentReportingStore> store_ = nullptr;
};
class TestReportingService : public ReportingService {
diff --git a/net/server/http_connection.cc b/net/server/http_connection.cc
index 73f4fe1bd..180e0a4 100644
--- a/net/server/http_connection.cc
+++ b/net/server/http_connection.cc
@@ -13,8 +13,7 @@
namespace net {
HttpConnection::ReadIOBuffer::ReadIOBuffer()
- : base_(base::MakeRefCounted<GrowableIOBuffer>()),
- max_buffer_size_(kDefaultMaxBufferSize) {
+ : base_(base::MakeRefCounted<GrowableIOBuffer>()) {
SetCapacity(kInitialBufSize);
}
@@ -91,8 +90,7 @@
}
}
-HttpConnection::QueuedWriteIOBuffer::QueuedWriteIOBuffer()
- : max_buffer_size_(kDefaultMaxBufferSize) {}
+HttpConnection::QueuedWriteIOBuffer::QueuedWriteIOBuffer() = default;
HttpConnection::QueuedWriteIOBuffer::~QueuedWriteIOBuffer() {
data_ = nullptr; // pending_data_ owns data_.
diff --git a/net/server/http_connection.h b/net/server/http_connection.h
index b59d1b8..9167f82 100644
--- a/net/server/http_connection.h
+++ b/net/server/http_connection.h
@@ -64,7 +64,7 @@
~ReadIOBuffer() override;
scoped_refptr<GrowableIOBuffer> base_;
- int max_buffer_size_;
+ int max_buffer_size_ = kDefaultMaxBufferSize;
};
// IOBuffer of pending data to write which has a queue of pending data. Each
@@ -110,7 +110,7 @@
// chunks, as they may be handed out via net::IOBuffer::data().
base::queue<std::unique_ptr<std::string>> pending_data_;
int total_size_ = 0;
- int max_buffer_size_;
+ int max_buffer_size_ = kDefaultMaxBufferSize;
};
HttpConnection(int id, std::unique_ptr<StreamSocket> socket);
diff --git a/net/server/http_server_fuzzer.cc b/net/server/http_server_fuzzer.cc
index f9c9c5e4..b091cc7 100644
--- a/net/server/http_server_fuzzer.cc
+++ b/net/server/http_server_fuzzer.cc
@@ -19,8 +19,7 @@
public:
WaitTillHttpCloseDelegate(FuzzedDataProvider* data_provider,
base::OnceClosure done_closure)
- : server_(nullptr),
- data_provider_(data_provider),
+ : data_provider_(data_provider),
done_closure_(std::move(done_closure)),
action_flags_(data_provider_->ConsumeIntegral<uint8_t>()) {}
@@ -89,7 +88,7 @@
CLOSE_WEBSOCKET_RATHER_THAN_ACCEPT = 16
};
- net::HttpServer* server_;
+ net::HttpServer* server_ = nullptr;
FuzzedDataProvider* const data_provider_;
base::OnceClosure done_closure_;
const uint8_t action_flags_;
diff --git a/net/server/http_server_unittest.cc b/net/server/http_server_unittest.cc
index ea67618e..a48b18a 100644
--- a/net/server/http_server_unittest.cc
+++ b/net/server/http_server_unittest.cc
@@ -943,7 +943,7 @@
class MockStreamSocket : public StreamSocket {
public:
- MockStreamSocket() : read_buf_(nullptr) {}
+ MockStreamSocket() = default;
MockStreamSocket(const MockStreamSocket&) = delete;
MockStreamSocket& operator=(const MockStreamSocket&) = delete;
diff --git a/net/socket/client_socket_handle.cc b/net/socket/client_socket_handle.cc
index a51fea51..3204f6e 100644
--- a/net/socket/client_socket_handle.cc
+++ b/net/socket/client_socket_handle.cc
@@ -21,9 +21,7 @@
namespace net {
ClientSocketHandle::ClientSocketHandle()
- : pool_(nullptr),
- higher_pool_(nullptr),
- resolve_error_info_(ResolveErrorInfo(OK)) {}
+ : resolve_error_info_(ResolveErrorInfo(OK)) {}
ClientSocketHandle::~ClientSocketHandle() {
Reset();
diff --git a/net/socket/client_socket_handle.h b/net/socket/client_socket_handle.h
index 6f68a98..eeb9692 100644
--- a/net/socket/client_socket_handle.h
+++ b/net/socket/client_socket_handle.h
@@ -229,8 +229,8 @@
void ResetErrorState();
bool is_initialized_ = false;
- raw_ptr<ClientSocketPool> pool_;
- raw_ptr<HigherLayeredPool> higher_pool_;
+ raw_ptr<ClientSocketPool> pool_ = nullptr;
+ raw_ptr<HigherLayeredPool> higher_pool_ = nullptr;
std::unique_ptr<StreamSocket> socket_;
ClientSocketPool::GroupId group_id_;
SocketReuseType reuse_type_ = ClientSocketHandle::UNUSED;
diff --git a/net/socket/fuzzed_server_socket.cc b/net/socket/fuzzed_server_socket.cc
index a5fc9dbe..82f4147 100644
--- a/net/socket/fuzzed_server_socket.cc
+++ b/net/socket/fuzzed_server_socket.cc
@@ -15,10 +15,7 @@
FuzzedServerSocket::FuzzedServerSocket(FuzzedDataProvider* data_provider,
net::NetLog* net_log)
- : data_provider_(data_provider),
- net_log_(net_log),
- first_accept_(true),
- listen_called_(false) {}
+ : data_provider_(data_provider), net_log_(net_log) {}
FuzzedServerSocket::~FuzzedServerSocket() = default;
diff --git a/net/socket/fuzzed_server_socket.h b/net/socket/fuzzed_server_socket.h
index 36249c3..e4ef3214 100644
--- a/net/socket/fuzzed_server_socket.h
+++ b/net/socket/fuzzed_server_socket.h
@@ -51,8 +51,8 @@
net::NetLog* net_log_;
IPEndPoint listening_on_;
- bool first_accept_;
- bool listen_called_;
+ bool first_accept_ = true;
+ bool listen_called_ = false;
base::WeakPtrFactory<FuzzedServerSocket> weak_factory_{this};
};
diff --git a/net/socket/fuzzed_socket_factory.cc b/net/socket/fuzzed_socket_factory.cc
index 65c749af..ec213e1 100644
--- a/net/socket/fuzzed_socket_factory.cc
+++ b/net/socket/fuzzed_socket_factory.cc
@@ -107,7 +107,7 @@
} // namespace
FuzzedSocketFactory::FuzzedSocketFactory(FuzzedDataProvider* data_provider)
- : data_provider_(data_provider), fuzz_connect_result_(true) {}
+ : data_provider_(data_provider) {}
FuzzedSocketFactory::~FuzzedSocketFactory() = default;
diff --git a/net/socket/fuzzed_socket_factory.h b/net/socket/fuzzed_socket_factory.h
index 2dd91c5..25526d6 100644
--- a/net/socket/fuzzed_socket_factory.h
+++ b/net/socket/fuzzed_socket_factory.h
@@ -61,7 +61,7 @@
private:
FuzzedDataProvider* data_provider_;
- bool fuzz_connect_result_;
+ bool fuzz_connect_result_ = true;
};
} // namespace net
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc
index f9f41402..0bc5665 100644
--- a/net/socket/socket_test_util.cc
+++ b/net/socket/socket_test_util.cc
@@ -353,11 +353,7 @@
SequencedSocketData::SequencedSocketData(base::span<const MockRead> reads,
base::span<const MockWrite> writes)
- : helper_(reads, writes),
- sequence_number_(0),
- read_state_(IoState::kIdle),
- write_state_(IoState::kIdle),
- busy_before_sync_reads_(false) {
+ : helper_(reads, writes) {
// Check that reads and writes have a contiguous set of sequence numbers
// starting from 0 and working their way up, with no repeats and skipping
// no values.
@@ -939,8 +935,7 @@
: MockClientSocket(NetLogWithSource::Make(net_log, NetLogSourceType::NONE)),
addresses_(addresses),
data_(data),
- read_data_(SYNCHRONOUS, ERR_UNEXPECTED),
- pending_read_buf_(nullptr) {
+ read_data_(SYNCHRONOUS, ERR_UNEXPECTED) {
DCHECK(data_);
peer_addr_ = data->connect_data().peer_addr;
data_->Initialize(this);
@@ -1504,8 +1499,6 @@
: data_(data),
read_data_(SYNCHRONOUS, ERR_UNEXPECTED),
source_host_(IPAddress(192, 0, 2, 33)),
- network_(NetworkChangeNotifier::kInvalidNetworkHandle),
- pending_read_buf_(nullptr),
net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::NONE)) {
if (data_) {
data_->Initialize(this);
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h
index 788df9d..bacfd83c 100644
--- a/net/socket/socket_test_util.h
+++ b/net/socket/socket_test_util.h
@@ -592,11 +592,11 @@
StaticSocketDataHelper helper_;
raw_ptr<SocketDataPrinter> printer_ = nullptr;
- int sequence_number_;
- IoState read_state_;
- IoState write_state_;
+ int sequence_number_ = 0;
+ IoState read_state_ = IoState::kIdle;
+ IoState write_state_ = IoState::kIdle;
- bool busy_before_sync_reads_;
+ bool busy_before_sync_reads_ = false;
// Used by RunUntilPaused. NULL at all other times.
std::unique_ptr<base::RunLoop> run_until_paused_run_loop_;
@@ -847,7 +847,7 @@
bool peer_closed_connection_ = false;
// While an asynchronous read is pending, we save our user-buffer state.
- scoped_refptr<IOBuffer> pending_read_buf_;
+ scoped_refptr<IOBuffer> pending_read_buf_ = nullptr;
int pending_read_buf_len_ = 0;
CompletionOnceCallback pending_read_callback_;
@@ -1045,10 +1045,11 @@
IPEndPoint peer_addr_;
// Network that the socket is bound to.
- NetworkChangeNotifier::NetworkHandle network_;
+ NetworkChangeNotifier::NetworkHandle network_ =
+ NetworkChangeNotifier::kInvalidNetworkHandle;
// While an asynchronous IO is pending, we save our user-buffer state.
- scoped_refptr<IOBuffer> pending_read_buf_;
+ scoped_refptr<IOBuffer> pending_read_buf_ = nullptr;
int pending_read_buf_len_ = 0;
CompletionOnceCallback pending_read_callback_;
CompletionOnceCallback pending_write_callback_;
diff --git a/net/socket/tcp_client_socket.cc b/net/socket/tcp_client_socket.cc
index 037fc4f3..6b25b06 100644
--- a/net/socket/tcp_client_socket.cc
+++ b/net/socket/tcp_client_socket.cc
@@ -155,11 +155,6 @@
bind_address_(std::move(bind_address)),
addresses_(addresses),
current_address_index_(current_address_index),
- next_connect_state_(CONNECT_STATE_NONE),
- previously_disconnected_(false),
- total_received_bytes_(0),
- was_ever_used_(false),
- was_disconnected_on_suspend_(false),
network_quality_estimator_(network_quality_estimator),
network_(network) {
DCHECK(socket_);
diff --git a/net/socket/tcp_client_socket.h b/net/socket/tcp_client_socket.h
index c28c797..891f36b2 100644
--- a/net/socket/tcp_client_socket.h
+++ b/net/socket/tcp_client_socket.h
@@ -210,22 +210,22 @@
CompletionOnceCallback write_callback_;
// The next state for the Connect() state machine.
- ConnectState next_connect_state_;
+ ConnectState next_connect_state_ = CONNECT_STATE_NONE;
// This socket was previously disconnected and has not been re-connected.
- bool previously_disconnected_;
+ bool previously_disconnected_ = false;
// Total number of bytes received by the socket.
- int64_t total_received_bytes_;
+ int64_t total_received_bytes_ = 0;
BeforeConnectCallback before_connect_callback_;
- bool was_ever_used_;
+ bool was_ever_used_ = false;
// Set to true if the socket was disconnected due to entering suspend mode.
// Once set, read/write operations return ERR_NETWORK_IO_SUSPENDED, until
// Connect() or Disconnect() is called.
- bool was_disconnected_on_suspend_;
+ bool was_disconnected_on_suspend_ = false;
// The time when the latest connect attempt was started.
absl::optional<base::TimeTicks> start_connect_attempt_;
diff --git a/net/socket/tcp_server_socket.cc b/net/socket/tcp_server_socket.cc
index 29929fc2..ea14a44 100644
--- a/net/socket/tcp_server_socket.cc
+++ b/net/socket/tcp_server_socket.cc
@@ -24,7 +24,7 @@
source)) {}
TCPServerSocket::TCPServerSocket(std::unique_ptr<TCPSocket> socket)
- : socket_(std::move(socket)), pending_accept_(false) {}
+ : socket_(std::move(socket)) {}
int TCPServerSocket::AdoptSocket(SocketDescriptor socket) {
return socket_->AdoptUnconnectedSocket(socket);
diff --git a/net/socket/tcp_server_socket.h b/net/socket/tcp_server_socket.h
index 3a6cf15..ae883b3 100644
--- a/net/socket/tcp_server_socket.h
+++ b/net/socket/tcp_server_socket.h
@@ -71,7 +71,7 @@
std::unique_ptr<TCPSocket> accepted_socket_;
IPEndPoint accepted_address_;
- bool pending_accept_;
+ bool pending_accept_ = false;
};
} // namespace net
diff --git a/net/socket/tcp_socket_win.cc b/net/socket/tcp_socket_win.cc
index b400332..ad38540 100644
--- a/net/socket/tcp_socket_win.cc
+++ b/net/socket/tcp_socket_win.cc
@@ -133,10 +133,10 @@
// The buffers used in Read() and Write().
scoped_refptr<IOBuffer> read_iobuffer_;
scoped_refptr<IOBuffer> write_iobuffer_;
- int read_buffer_length_;
- int write_buffer_length_;
+ int read_buffer_length_ = 0;
+ int write_buffer_length_ = 0;
- bool non_blocking_reads_initialized_;
+ bool non_blocking_reads_initialized_ = false;
private:
friend class base::RefCounted<Core>;
@@ -183,9 +183,6 @@
TCPSocketWin::Core::Core(TCPSocketWin* socket)
: read_event_(WSACreateEvent()),
- read_buffer_length_(0),
- write_buffer_length_(0),
- non_blocking_reads_initialized_(false),
socket_(socket),
reader_(this),
writer_(this) {
@@ -263,13 +260,6 @@
: socket_(INVALID_SOCKET),
socket_performance_watcher_(std::move(socket_performance_watcher)),
accept_event_(WSA_INVALID_EVENT),
- accept_socket_(nullptr),
- accept_address_(nullptr),
- waiting_connect_(false),
- waiting_read_(false),
- waiting_write_(false),
- connect_os_error_(0),
- logging_multiple_connect_attempts_(false),
net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::SOCKET)) {
net_log_.BeginEventReferencingSource(NetLogEventType::SOCKET_ALIVE, source);
EnsureWinsockInit();
diff --git a/net/socket/tcp_socket_win.h b/net/socket/tcp_socket_win.h
index 8217c318..1b2ad4eb 100644
--- a/net/socket/tcp_socket_win.h
+++ b/net/socket/tcp_socket_win.h
@@ -176,14 +176,14 @@
HANDLE accept_event_;
base::win::ObjectWatcher accept_watcher_;
- raw_ptr<std::unique_ptr<TCPSocketWin>> accept_socket_;
- raw_ptr<IPEndPoint> accept_address_;
+ raw_ptr<std::unique_ptr<TCPSocketWin>> accept_socket_ = nullptr;
+ raw_ptr<IPEndPoint> accept_address_ = nullptr;
CompletionOnceCallback accept_callback_;
// The various states that the socket could be in.
- bool waiting_connect_;
- bool waiting_read_;
- bool waiting_write_;
+ bool waiting_connect_ = false;
+ bool waiting_read_ = false;
+ bool waiting_write_ = false;
// The core of the socket that can live longer than the socket itself. We pass
// resources to the Windows async IO functions and we have to make sure that
@@ -203,9 +203,9 @@
std::unique_ptr<IPEndPoint> peer_address_;
// The OS error that a connect attempt last completed with.
- int connect_os_error_;
+ int connect_os_error_ = 0;
- bool logging_multiple_connect_attempts_;
+ bool logging_multiple_connect_attempts_ = false;
NetLogWithSource net_log_;
diff --git a/net/socket/transport_client_socket_pool.cc b/net/socket/transport_client_socket_pool.cc
index 0d57f2cb..8c11056 100644
--- a/net/socket/transport_client_socket_pool.cc
+++ b/net/socket/transport_client_socket_pool.cc
@@ -92,8 +92,7 @@
socket_params_(std::move(socket_params)),
proxy_annotation_tag_(proxy_annotation_tag),
net_log_(net_log),
- socket_tag_(socket_tag),
- job_(nullptr) {
+ socket_tag_(socket_tag) {
if (respect_limits_ == ClientSocketPool::RespectLimits::DISABLED)
DCHECK_EQ(priority_, MAXIMUM_PRIORITY);
}
@@ -782,9 +781,6 @@
: ClientSocketPool(is_for_websockets,
common_connect_job_params,
std::move(connect_job_factory)),
- idle_socket_count_(0),
- connecting_socket_count_(0),
- handed_out_socket_count_(0),
max_sockets_(max_sockets),
max_sockets_per_group_(max_sockets_per_group),
unused_idle_socket_timeout_(unused_idle_socket_timeout),
diff --git a/net/socket/transport_client_socket_pool.h b/net/socket/transport_client_socket_pool.h
index 60de4755..e215025 100644
--- a/net/socket/transport_client_socket_pool.h
+++ b/net/socket/transport_client_socket_pool.h
@@ -143,7 +143,7 @@
const absl::optional<NetworkTrafficAnnotationTag> proxy_annotation_tag_;
const NetLogWithSource net_log_;
const SocketTag socket_tag_;
- raw_ptr<ConnectJob> job_;
+ raw_ptr<ConnectJob> job_ = nullptr;
};
TransportClientSocketPool(
@@ -764,13 +764,13 @@
PendingCallbackMap pending_callback_map_;
// The total number of idle sockets in the system.
- int idle_socket_count_;
+ int idle_socket_count_ = 0;
// Number of connecting sockets across all groups.
- int connecting_socket_count_;
+ int connecting_socket_count_ = 0;
// Number of connected sockets we handed out across all groups.
- int handed_out_socket_count_;
+ int handed_out_socket_count_ = 0;
// The maximum total number of sockets. See ReachedMaxSocketsLimit.
const int max_sockets_;
diff --git a/net/socket/udp_socket_global_limits.cc b/net/socket/udp_socket_global_limits.cc
index 0163a7b..419d6a0 100644
--- a/net/socket/udp_socket_global_limits.cc
+++ b/net/socket/udp_socket_global_limits.cc
@@ -16,7 +16,7 @@
// Threadsafe singleton for tracking the process-wide count of UDP sockets.
class GlobalUDPSocketCounts {
public:
- GlobalUDPSocketCounts() : count_(0) {}
+ GlobalUDPSocketCounts() = default;
~GlobalUDPSocketCounts() = delete;
@@ -47,7 +47,7 @@
int GetCountForTesting() { return count_.SubtleRefCountForDebug(); }
private:
- base::AtomicRefCount count_;
+ base::AtomicRefCount count_{0};
};
} // namespace
diff --git a/net/socket/udp_socket_posix.cc b/net/socket/udp_socket_posix.cc
index 8dfabde..01fe429 100644
--- a/net/socket/udp_socket_posix.cc
+++ b/net/socket/udp_socket_posix.cc
@@ -138,7 +138,6 @@
write_socket_watcher_(FROM_HERE),
read_watcher_(this),
write_watcher_(this),
- recv_from_address_(nullptr),
net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::UDP_SOCKET)),
bound_network_(NetworkChangeNotifier::kInvalidNetworkHandle),
always_update_bytes_received_(base::FeatureList::IsEnabled(
diff --git a/net/socket/udp_socket_posix.h b/net/socket/udp_socket_posix.h
index 351c305..a19e304 100644
--- a/net/socket/udp_socket_posix.h
+++ b/net/socket/udp_socket_posix.h
@@ -598,7 +598,7 @@
// The buffer used by InternalRead() to retry Read requests
scoped_refptr<IOBuffer> read_buf_;
int read_buf_len_ = 0;
- raw_ptr<IPEndPoint> recv_from_address_;
+ raw_ptr<IPEndPoint> recv_from_address_ = nullptr;
// The buffer used by InternalWrite() to retry Write requests
scoped_refptr<IOBuffer> write_buf_;
diff --git a/net/socket/udp_socket_win.cc b/net/socket/udp_socket_win.cc
index 53364dd..dec07ce 100644
--- a/net/socket/udp_socket_win.cc
+++ b/net/socket/udp_socket_win.cc
@@ -166,7 +166,7 @@
}
//-----------------------------------------------------------------------------
-QwaveApi::QwaveApi() : qwave_supported_(false) {
+QwaveApi::QwaveApi() {
HMODULE qwave = LoadLibrary(L"qwave.dll");
if (!qwave)
return;
@@ -243,15 +243,7 @@
net::NetLog* net_log,
const net::NetLogSource& source)
: socket_(INVALID_SOCKET),
- addr_family_(0),
- is_connected_(false),
socket_options_(SOCKET_OPTION_MULTICAST_LOOP),
- multicast_interface_(0),
- multicast_time_to_live_(1),
- use_non_blocking_io_(false),
- read_iobuffer_len_(0),
- write_iobuffer_len_(0),
- recv_from_address_(nullptr),
net_log_(NetLogWithSource::Make(net_log, NetLogSourceType::UDP_SOCKET)) {
EnsureWinsockInit();
net_log_.BeginEventReferencingSource(NetLogEventType::SOCKET_ALIVE, source);
diff --git a/net/socket/udp_socket_win.h b/net/socket/udp_socket_win.h
index 0a50ac9..880f710 100644
--- a/net/socket/udp_socket_win.h
+++ b/net/socket/udp_socket_win.h
@@ -99,7 +99,7 @@
LPOVERLAPPED overlapped);
private:
- std::atomic<bool> qwave_supported_;
+ std::atomic<bool> qwave_supported_{false};
CreateHandleFn create_handle_func_;
CloseHandleFn close_handle_func_;
@@ -430,19 +430,19 @@
virtual QwaveApi* GetQwaveApi() const;
SOCKET socket_;
- int addr_family_;
- bool is_connected_;
+ int addr_family_ = 0;
+ bool is_connected_ = false;
// Bitwise-or'd combination of SocketOptions. Specifies the set of
// options that should be applied to |socket_| before Bind().
int socket_options_;
// Multicast interface.
- uint32_t multicast_interface_;
+ uint32_t multicast_interface_ = 0;
// Multicast socket options cached for SetMulticastOption.
// Cannot be used after Bind().
- int multicast_time_to_live_;
+ int multicast_time_to_live_ = 1;
// These are mutable since they're just cached copies to make
// GetPeerAddress/GetLocalAddress smarter.
@@ -455,7 +455,7 @@
scoped_refptr<Core> core_;
// True if non-blocking IO is used.
- bool use_non_blocking_io_;
+ bool use_non_blocking_io_ = false;
// Watches |read_write_event_|.
base::win::ObjectWatcher read_write_watcher_;
@@ -467,10 +467,10 @@
scoped_refptr<IOBuffer> read_iobuffer_;
scoped_refptr<IOBuffer> write_iobuffer_;
- int read_iobuffer_len_;
- int write_iobuffer_len_;
+ int read_iobuffer_len_ = 0;
+ int write_iobuffer_len_ = 0;
- raw_ptr<IPEndPoint> recv_from_address_;
+ raw_ptr<IPEndPoint> recv_from_address_ = nullptr;
// Cached copy of the current address we're sending to, if any. Used for
// logging.
diff --git a/net/spdy/bidirectional_stream_spdy_impl.cc b/net/spdy/bidirectional_stream_spdy_impl.cc
index 4b443a4b..bb16279 100644
--- a/net/spdy/bidirectional_stream_spdy_impl.cc
+++ b/net/spdy/bidirectional_stream_spdy_impl.cc
@@ -32,10 +32,7 @@
BidirectionalStreamSpdyImpl::BidirectionalStreamSpdyImpl(
const base::WeakPtr<SpdySession>& spdy_session,
NetLogSource source_dependency)
- : spdy_session_(spdy_session),
- request_info_(nullptr),
- delegate_(nullptr),
- source_dependency_(source_dependency) {}
+ : spdy_session_(spdy_session), source_dependency_(source_dependency) {}
BidirectionalStreamSpdyImpl::~BidirectionalStreamSpdyImpl() {
// Sends a RST to the remote if the stream is destroyed before it completes.
diff --git a/net/spdy/bidirectional_stream_spdy_impl.h b/net/spdy/bidirectional_stream_spdy_impl.h
index 41ef997..a5e2dcc 100644
--- a/net/spdy/bidirectional_stream_spdy_impl.h
+++ b/net/spdy/bidirectional_stream_spdy_impl.h
@@ -91,8 +91,8 @@
bool MaybeHandleStreamClosedInSendData();
const base::WeakPtr<SpdySession> spdy_session_;
- raw_ptr<const BidirectionalStreamRequestInfo> request_info_;
- raw_ptr<BidirectionalStreamImpl::Delegate> delegate_;
+ raw_ptr<const BidirectionalStreamRequestInfo> request_info_ = nullptr;
+ raw_ptr<BidirectionalStreamImpl::Delegate> delegate_ = nullptr;
std::unique_ptr<base::OneShotTimer> timer_;
SpdyStreamRequest stream_request_;
base::WeakPtr<SpdyStream> stream_;
diff --git a/net/spdy/bidirectional_stream_spdy_impl_unittest.cc b/net/spdy/bidirectional_stream_spdy_impl_unittest.cc
index 94d6338..eb6c340 100644
--- a/net/spdy/bidirectional_stream_spdy_impl_unittest.cc
+++ b/net/spdy/bidirectional_stream_spdy_impl_unittest.cc
@@ -75,8 +75,7 @@
: stream_(std::make_unique<BidirectionalStreamSpdyImpl>(session,
NetLogSource())),
read_buf_(read_buf),
- read_buf_len_(read_buf_len),
- loop_(nullptr) {}
+ read_buf_len_(read_buf_len) {}
TestDelegateBase(const TestDelegateBase&) = delete;
TestDelegateBase& operator=(const TestDelegateBase&) = delete;
diff --git a/net/spdy/buffered_spdy_framer.cc b/net/spdy/buffered_spdy_framer.cc
index 913efea..d0502c2c 100644
--- a/net/spdy/buffered_spdy_framer.cc
+++ b/net/spdy/buffered_spdy_framer.cc
@@ -25,7 +25,6 @@
const NetLogWithSource& net_log,
TimeFunc time_func)
: spdy_framer_(spdy::SpdyFramer::ENABLE_COMPRESSION),
- visitor_(nullptr),
max_header_list_size_(max_header_list_size),
net_log_(net_log),
time_func_(time_func) {
diff --git a/net/spdy/buffered_spdy_framer.h b/net/spdy/buffered_spdy_framer.h
index 7679ca6..08ca82b42 100644
--- a/net/spdy/buffered_spdy_framer.h
+++ b/net/spdy/buffered_spdy_framer.h
@@ -250,7 +250,7 @@
private:
spdy::SpdyFramer spdy_framer_;
http2::Http2DecoderAdapter deframer_;
- raw_ptr<BufferedSpdyFramerVisitorInterface> visitor_;
+ raw_ptr<BufferedSpdyFramerVisitorInterface> visitor_ = nullptr;
int frames_received_ = 0;
diff --git a/net/spdy/spdy_buffer.cc b/net/spdy/spdy_buffer.cc
index e8148c9..aaf447e 100644
--- a/net/spdy/spdy_buffer.cc
+++ b/net/spdy/spdy_buffer.cc
@@ -60,13 +60,12 @@
};
SpdyBuffer::SpdyBuffer(std::unique_ptr<spdy::SpdySerializedFrame> frame)
- : shared_frame_(new SharedFrame(std::move(frame))), offset_(0) {}
+ : shared_frame_(new SharedFrame(std::move(frame))) {}
// The given data may not be strictly a SPDY frame; we (ab)use
// |frame_| just as a container.
-SpdyBuffer::SpdyBuffer(const char* data, size_t size) :
- shared_frame_(new SharedFrame()),
- offset_(0) {
+SpdyBuffer::SpdyBuffer(const char* data, size_t size)
+ : shared_frame_(new SharedFrame()) {
CHECK_GT(size, 0u);
CHECK_LE(size, kMaxSpdyFrameSize);
shared_frame_->data = MakeSpdySerializedFrame(data, size);
diff --git a/net/spdy/spdy_buffer.h b/net/spdy/spdy_buffer.h
index 4abe9d9..4b8337c4 100644
--- a/net/spdy/spdy_buffer.h
+++ b/net/spdy/spdy_buffer.h
@@ -100,7 +100,7 @@
const scoped_refptr<SharedFrame> shared_frame_;
std::vector<ConsumeCallback> consume_callbacks_;
- size_t offset_;
+ size_t offset_ = 0;
};
} // namespace net
diff --git a/net/spdy/spdy_http_stream.cc b/net/spdy/spdy_http_stream.cc
index dd9588c..be3c2d7 100644
--- a/net/spdy/spdy_http_stream.cc
+++ b/net/spdy/spdy_http_stream.cc
@@ -110,8 +110,6 @@
pushed_stream_id_(pushed_stream_id),
is_reused_(spdy_session_->IsReused()),
source_dependency_(source_dependency),
- request_info_(nullptr),
- response_info_(nullptr),
dns_aliases_(std::move(dns_aliases)) {
DCHECK(spdy_session_.get());
}
diff --git a/net/spdy/spdy_http_stream.h b/net/spdy/spdy_http_stream.h
index 513b3d6..761271b 100644
--- a/net/spdy/spdy_http_stream.h
+++ b/net/spdy/spdy_http_stream.h
@@ -189,12 +189,12 @@
// |this| to be shared for reading and to possibly outlive request_info_'s
// owner. Setting to null happens after headers are completely read or upload
// data stream is uploaded, whichever is later.
- raw_ptr<const HttpRequestInfo> request_info_;
+ raw_ptr<const HttpRequestInfo> request_info_ = nullptr;
// |response_info_| is the HTTP response data object which is filled in
// when a response HEADERS comes in for the stream.
// It is not owned by this stream object, or point to |push_response_info_|.
- raw_ptr<HttpResponseInfo> response_info_;
+ raw_ptr<HttpResponseInfo> response_info_ = nullptr;
std::unique_ptr<HttpResponseInfo> push_response_info_;
diff --git a/net/spdy/spdy_proxy_client_socket_unittest.cc b/net/spdy/spdy_proxy_client_socket_unittest.cc
index 5ac00e8..9aa415b 100644
--- a/net/spdy/spdy_proxy_client_socket_unittest.cc
+++ b/net/spdy/spdy_proxy_client_socket_unittest.cc
@@ -219,8 +219,7 @@
};
SpdyProxyClientSocketTest::SpdyProxyClientSocketTest()
- : read_buf_(nullptr),
- connect_data_(SYNCHRONOUS, OK),
+ : connect_data_(SYNCHRONOUS, OK),
user_agent_(kUserAgent),
url_(kRequestUrl),
proxy_host_port_(kProxyHost, kProxyPort),
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index fe41ff9..05ff79b123 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -936,11 +936,9 @@
NetworkQualityEstimator* network_quality_estimator,
NetLog* net_log)
: spdy_session_key_(spdy_session_key),
- pool_(nullptr),
http_server_properties_(http_server_properties),
transport_security_state_(transport_security_state),
ssl_config_service_(ssl_config_service),
- socket_(nullptr),
stream_hi_water_mark_(kFirstStreamId),
push_delegate_(push_delegate),
initial_settings_(initial_settings),
diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h
index e343745..8bd21fe 100644
--- a/net/spdy/spdy_session.h
+++ b/net/spdy/spdy_session.h
@@ -1086,7 +1086,7 @@
std::set<SpdySessionKey> pooled_aliases_;
// |pool_| owns us, therefore its lifetime must exceed ours.
- raw_ptr<SpdySessionPool> pool_;
+ raw_ptr<SpdySessionPool> pool_ = nullptr;
raw_ptr<HttpServerProperties> http_server_properties_;
raw_ptr<TransportSecurityState> transport_security_state_;
@@ -1103,7 +1103,7 @@
std::unique_ptr<LoadTimingInfo::ConnectTiming> connect_timing_;
// The socket for this session.
- raw_ptr<StreamSocket> socket_;
+ raw_ptr<StreamSocket> socket_ = nullptr;
// The read buffer used to read data from the socket.
// Non-null if there is a Read() pending.
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 46766de..d2a243c 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -112,7 +112,6 @@
enable_priority_update_(enable_priority_update),
go_away_on_ip_change_(go_away_on_ip_change),
time_func_(time_func),
- push_delegate_(nullptr),
network_quality_estimator_(network_quality_estimator),
cleanup_sessions_on_ip_address_changed_(
cleanup_sessions_on_ip_address_changed) {
diff --git a/net/spdy/spdy_session_pool.h b/net/spdy/spdy_session_pool.h
index 2ba3a0f..1778261 100644
--- a/net/spdy/spdy_session_pool.h
+++ b/net/spdy/spdy_session_pool.h
@@ -493,7 +493,7 @@
SpdySessionRequestMap spdy_session_request_map_;
TimeFunc time_func_;
- raw_ptr<ServerPushDelegate> push_delegate_;
+ raw_ptr<ServerPushDelegate> push_delegate_ = nullptr;
raw_ptr<NetworkQualityEstimator> network_quality_estimator_;
diff --git a/net/spdy/spdy_session_pool_unittest.cc b/net/spdy/spdy_session_pool_unittest.cc
index ccf9fab..6c039ec 100644
--- a/net/spdy/spdy_session_pool_unittest.cc
+++ b/net/spdy/spdy_session_pool_unittest.cc
@@ -62,7 +62,7 @@
SPDY_POOL_CLOSE_IDLE_SESSIONS,
};
- SpdySessionPoolTest() : spdy_session_pool_(nullptr) {}
+ SpdySessionPoolTest() = default;
void CreateNetworkSession() {
http_session_ = SpdySessionDependencies::SpdyCreateSession(&session_deps_);
@@ -91,7 +91,7 @@
SpdySessionDependencies session_deps_;
std::unique_ptr<HttpNetworkSession> http_session_;
- raw_ptr<SpdySessionPool> spdy_session_pool_;
+ raw_ptr<SpdySessionPool> spdy_session_pool_ = nullptr;
std::vector<std::unique_ptr<SSLSocketDataProvider>> ssl_data_vector_;
};
diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc
index 54a53a5..47e91154 100644
--- a/net/spdy/spdy_session_unittest.cc
+++ b/net/spdy/spdy_session_unittest.cc
@@ -176,8 +176,6 @@
HttpNetworkSession::NORMAL_SOCKET_POOL)),
old_max_pool_sockets_(ClientSocketPoolManager::max_sockets_per_pool(
HttpNetworkSession::NORMAL_SOCKET_POOL)),
- test_push_delegate_(nullptr),
- spdy_session_pool_(nullptr),
test_url_(kDefaultUrl),
test_server_(test_url_),
key_(HostPortPair::FromURL(test_url_),
@@ -391,8 +389,8 @@
SpdySessionDependencies session_deps_;
std::unique_ptr<HttpNetworkSession> http_session_;
base::WeakPtr<SpdySession> session_;
- raw_ptr<TestServerPushDelegate> test_push_delegate_;
- raw_ptr<SpdySessionPool> spdy_session_pool_;
+ raw_ptr<TestServerPushDelegate> test_push_delegate_ = nullptr;
+ raw_ptr<SpdySessionPool> spdy_session_pool_ = nullptr;
const GURL test_url_;
const url::SchemeHostPort test_server_;
SpdySessionKey key_;
diff --git a/net/spdy/spdy_stream.cc b/net/spdy/spdy_stream.cc
index 160439cc..c437d83 100644
--- a/net/spdy/spdy_stream.cc
+++ b/net/spdy/spdy_stream.cc
@@ -107,7 +107,6 @@
recv_window_size_(max_recv_window_size),
last_recv_window_update_(base::TimeTicks::Now()),
session_(session),
- delegate_(nullptr),
request_time_(base::Time::Now()),
net_log_(net_log),
traffic_annotation_(traffic_annotation),
diff --git a/net/spdy/spdy_stream.h b/net/spdy/spdy_stream.h
index 4cc771a..fb69c4b 100644
--- a/net/spdy/spdy_stream.h
+++ b/net/spdy/spdy_stream.h
@@ -504,7 +504,7 @@
const base::WeakPtr<SpdySession> session_;
// The transaction should own the delegate.
- raw_ptr<SpdyStream::Delegate> delegate_;
+ raw_ptr<SpdyStream::Delegate> delegate_ = nullptr;
// The headers for the request to send.
bool request_headers_valid_ = false;
diff --git a/net/spdy/spdy_test_util_common.cc b/net/spdy/spdy_test_util_common.cc
index f7f3305..578ebbf 100644
--- a/net/spdy/spdy_test_util_common.cc
+++ b/net/spdy/spdy_test_util_common.cc
@@ -308,28 +308,7 @@
http_auth_handler_factory(HttpAuthHandlerFactory::CreateDefault()),
http_server_properties(std::make_unique<HttpServerProperties>()),
quic_context(std::make_unique<QuicContext>()),
- enable_ip_pooling(true),
- enable_ping(false),
- enable_user_alternate_protocol_ports(false),
- enable_quic(false),
- enable_server_push_cancellation(false),
- session_max_recv_window_size(kDefaultInitialWindowSize),
- session_max_queued_capped_frames(kSpdySessionMaxQueuedCappedFrames),
- time_func(&base::TimeTicks::Now),
- enable_http2_alternative_service(false),
- enable_http2_settings_grease(false),
- http2_end_stream_with_data_frame(false),
- net_log(nullptr),
- disable_idle_sockets_close_on_memory_pressure(false),
- enable_early_data(false),
- key_auth_cache_server_entries_by_network_isolation_key(false),
- enable_priority_update(false),
-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_IOS)
- go_away_on_ip_change(true),
-#else
- go_away_on_ip_change(false),
-#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_IOS)
- ignore_ip_address_changes(false) {
+ time_func(&base::TimeTicks::Now) {
http2_settings[spdy::SETTINGS_INITIAL_WINDOW_SIZE] =
kDefaultInitialWindowSize;
}
diff --git a/net/spdy/spdy_test_util_common.h b/net/spdy/spdy_test_util_common.h
index 5c9f9df..8b3af77 100644
--- a/net/spdy/spdy_test_util_common.h
+++ b/net/spdy/spdy_test_util_common.h
@@ -195,26 +195,30 @@
std::unique_ptr<ReportingService> reporting_service;
std::unique_ptr<NetworkErrorLoggingService> network_error_logging_service;
#endif
- bool enable_ip_pooling;
- bool enable_ping;
- bool enable_user_alternate_protocol_ports;
- bool enable_quic;
- bool enable_server_push_cancellation;
- size_t session_max_recv_window_size;
- int session_max_queued_capped_frames;
+ bool enable_ip_pooling = true;
+ bool enable_ping = false;
+ bool enable_user_alternate_protocol_ports = false;
+ bool enable_quic = false;
+ bool enable_server_push_cancellation = false;
+ size_t session_max_recv_window_size = kDefaultInitialWindowSize;
+ int session_max_queued_capped_frames = kSpdySessionMaxQueuedCappedFrames;
spdy::SettingsMap http2_settings;
SpdySession::TimeFunc time_func;
- bool enable_http2_alternative_service;
- bool enable_http2_settings_grease;
+ bool enable_http2_alternative_service = false;
+ bool enable_http2_settings_grease = false;
absl::optional<SpdySessionPool::GreasedHttp2Frame> greased_http2_frame;
- bool http2_end_stream_with_data_frame;
- raw_ptr<NetLog> net_log;
- bool disable_idle_sockets_close_on_memory_pressure;
- bool enable_early_data;
- bool key_auth_cache_server_entries_by_network_isolation_key;
- bool enable_priority_update;
- bool go_away_on_ip_change;
- bool ignore_ip_address_changes;
+ bool http2_end_stream_with_data_frame = false;
+ raw_ptr<NetLog> net_log = nullptr;
+ bool disable_idle_sockets_close_on_memory_pressure = false;
+ bool enable_early_data = false;
+ bool key_auth_cache_server_entries_by_network_isolation_key = false;
+ bool enable_priority_update = false;
+#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_IOS)
+ bool go_away_on_ip_change = true;
+#else
+ bool go_away_on_ip_change = false;
+#endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_IOS)
+ bool ignore_ip_address_changes = false;
};
std::unique_ptr<URLRequestContextBuilder>
diff --git a/net/ssl/ssl_server_config.cc b/net/ssl/ssl_server_config.cc
index 425d326..b712c0fd 100644
--- a/net/ssl/ssl_server_config.cc
+++ b/net/ssl/ssl_server_config.cc
@@ -10,10 +10,7 @@
namespace net {
-SSLServerConfig::SSLServerConfig()
- : version_min(kDefaultSSLVersionMin),
- version_max(kDefaultSSLVersionMax),
- client_cert_verifier(nullptr) {}
+SSLServerConfig::SSLServerConfig() = default;
SSLServerConfig::SSLServerConfig(const SSLServerConfig& other) = default;
diff --git a/net/ssl/ssl_server_config.h b/net/ssl/ssl_server_config.h
index 520a864..8ffc9d9 100644
--- a/net/ssl/ssl_server_config.h
+++ b/net/ssl/ssl_server_config.h
@@ -40,8 +40,8 @@
// (Use the SSL_PROTOCOL_VERSION_xxx enumerators defined in ssl_config.h)
// SSL 2.0 and SSL 3.0 are not supported. If version_max < version_min, it
// means no protocol versions are enabled.
- uint16_t version_min;
- uint16_t version_max;
+ uint16_t version_min = kDefaultSSLVersionMin;
+ uint16_t version_max = kDefaultSSLVersionMax;
// Whether early data is enabled on this connection. The caller is obligated
// to reject early data that is non-safe to be replayed.
@@ -101,7 +101,7 @@
// and must outlive any sockets spawned from this SSLServerContext.
// This field is meaningful only if client certificates are requested.
// If a verifier is not provided then all certificates are accepted.
- raw_ptr<ClientCertVerifier> client_cert_verifier;
+ raw_ptr<ClientCertVerifier> client_cert_verifier = nullptr;
// The list of application level protocols supported with ALPN (Application
// Layer Protocol Negotiation), in decreasing order of preference. Protocols
diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc
index c259a58..9a278a8 100644
--- a/net/test/embedded_test_server/embedded_test_server.cc
+++ b/net/test/embedded_test_server/embedded_test_server.cc
@@ -277,11 +277,7 @@
EmbeddedTestServer::EmbeddedTestServer(Type type,
HttpConnection::Protocol protocol)
- : is_using_ssl_(type == TYPE_HTTPS),
- protocol_(protocol),
- connection_listener_(nullptr),
- port_(0),
- cert_(CERT_OK) {
+ : is_using_ssl_(type == TYPE_HTTPS), protocol_(protocol) {
DCHECK(thread_checker_.CalledOnValidThread());
// HTTP/2 is only valid by negotiation via TLS ALPN
DCHECK(protocol_ != HttpConnection::Protocol::kHttp2 || type == TYPE_HTTPS);
diff --git a/net/test/embedded_test_server/embedded_test_server.h b/net/test/embedded_test_server/embedded_test_server.h
index 7c5fa125..711d0e9 100644
--- a/net/test/embedded_test_server/embedded_test_server.h
+++ b/net/test/embedded_test_server/embedded_test_server.h
@@ -571,8 +571,8 @@
std::unique_ptr<TCPServerSocket> listen_socket_;
std::unique_ptr<StreamSocket> accepted_socket_;
- raw_ptr<EmbeddedTestServerConnectionListener> connection_listener_;
- uint16_t port_;
+ raw_ptr<EmbeddedTestServerConnectionListener> connection_listener_ = nullptr;
+ uint16_t port_ = 0;
GURL base_url_;
IPEndPoint local_endpoint_;
@@ -586,7 +586,7 @@
base::ThreadChecker thread_checker_;
net::SSLServerConfig ssl_config_;
- ServerCertificate cert_;
+ ServerCertificate cert_ = CERT_OK;
ServerCertificateConfig cert_config_;
scoped_refptr<X509Certificate> x509_cert_;
bssl::UniquePtr<EVP_PKEY> private_key_;
diff --git a/net/test/url_request/url_request_failed_job.cc b/net/test/url_request/url_request_failed_job.cc
index b249abe..ec93428 100644
--- a/net/test/url_request/url_request_failed_job.cc
+++ b/net/test/url_request/url_request_failed_job.cc
@@ -79,10 +79,7 @@
URLRequestFailedJob::URLRequestFailedJob(URLRequest* request,
FailurePhase phase,
int net_error)
- : URLRequestJob(request),
- phase_(phase),
- net_error_(net_error),
- total_received_bytes_(0) {
+ : URLRequestJob(request), phase_(phase), net_error_(net_error) {
CHECK_GE(phase, URLRequestFailedJob::FailurePhase::START);
CHECK_LE(phase, URLRequestFailedJob::FailurePhase::READ_ASYNC);
CHECK_LT(net_error, OK);
diff --git a/net/test/url_request/url_request_failed_job.h b/net/test/url_request/url_request_failed_job.h
index 86606e68..82f91ba0 100644
--- a/net/test/url_request/url_request_failed_job.h
+++ b/net/test/url_request/url_request_failed_job.h
@@ -80,7 +80,7 @@
HttpResponseInfo response_info_;
const FailurePhase phase_;
const int net_error_;
- int64_t total_received_bytes_;
+ int64_t total_received_bytes_ = 0;
base::WeakPtrFactory<URLRequestFailedJob> weak_factory_{this};
};
diff --git a/net/url_request/test_url_fetcher_factory.cc b/net/url_request/test_url_fetcher_factory.cc
index 321e1013..76af817 100644
--- a/net/url_request/test_url_fetcher_factory.cc
+++ b/net/url_request/test_url_fetcher_factory.cc
@@ -42,7 +42,7 @@
}
TestURLFetcher::TestURLFetcher(int id, const GURL& url, URLFetcherDelegate* d)
- : id_(id), original_url_(url), delegate_(d), delegate_for_tests_(nullptr) {
+ : id_(id), original_url_(url), delegate_(d) {
CHECK(original_url_.is_valid());
}
diff --git a/net/url_request/test_url_fetcher_factory.h b/net/url_request/test_url_fetcher_factory.h
index c75f208..412c151 100644
--- a/net/url_request/test_url_fetcher_factory.h
+++ b/net/url_request/test_url_fetcher_factory.h
@@ -213,7 +213,7 @@
const int id_;
const GURL original_url_;
raw_ptr<URLFetcherDelegate> delegate_;
- raw_ptr<DelegateForTests> delegate_for_tests_;
+ raw_ptr<DelegateForTests> delegate_for_tests_ = nullptr;
std::string upload_content_type_;
std::string upload_data_;
base::FilePath upload_file_path_;
diff --git a/net/url_request/url_fetcher_core.cc b/net/url_request/url_fetcher_core.cc
index 22b58be..05fd10c 100644
--- a/net/url_request/url_fetcher_core.cc
+++ b/net/url_request/url_fetcher_core.cc
@@ -84,7 +84,6 @@
delegate_(d),
delegate_task_runner_(base::SequencedTaskRunnerHandle::Get()),
allow_credentials_(absl::nullopt),
- url_request_data_key_(nullptr),
traffic_annotation_(traffic_annotation) {
CHECK(original_url_.is_valid());
}
diff --git a/net/url_request/url_fetcher_core.h b/net/url_request/url_fetcher_core.h
index 3d37e01..e0305399 100644
--- a/net/url_request/url_fetcher_core.h
+++ b/net/url_request/url_fetcher_core.h
@@ -265,7 +265,7 @@
// Cookie/cache info for the request
absl::optional<url::Origin> initiator_; // The request's initiator
// The user data to add to each newly-created URLRequest.
- raw_ptr<const void> url_request_data_key_;
+ raw_ptr<const void> url_request_data_key_ = nullptr;
URLFetcher::CreateDataCallback url_request_create_data_callback_;
HttpRequestHeaders extra_request_headers_;
scoped_refptr<HttpResponseHeaders> response_headers_;
diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc
index 0c0847c..f14a84e 100644
--- a/net/url_request/url_request_context.cc
+++ b/net/url_request/url_request_context.cc
@@ -31,32 +31,8 @@
URLRequestContext::URLRequestContext(
base::PassKey<URLRequestContextBuilder> pass_key)
- : net_log_(nullptr),
- host_resolver_(nullptr),
- cert_verifier_(nullptr),
- http_auth_handler_factory_(nullptr),
- proxy_resolution_service_(nullptr),
- proxy_delegate_(nullptr),
- ssl_config_service_(nullptr),
- network_delegate_(nullptr),
- http_server_properties_(nullptr),
- http_user_agent_settings_(nullptr),
- cookie_store_(nullptr),
- transport_security_state_(nullptr),
- ct_policy_enforcer_(nullptr),
- sct_auditing_delegate_(nullptr),
- http_transaction_factory_(nullptr),
- job_factory_(nullptr),
- throttler_manager_(nullptr),
- quic_context_(nullptr),
- network_quality_estimator_(nullptr),
-#if BUILDFLAG(ENABLE_REPORTING)
- reporting_service_(nullptr),
- network_error_logging_service_(nullptr),
-#endif // BUILDFLAG(ENABLE_REPORTING)
- url_requests_(std::make_unique<std::set<const URLRequest*>>()),
- bound_network_(NetworkChangeNotifier::kInvalidNetworkHandle) {
-}
+ : url_requests_(std::make_unique<std::set<const URLRequest*>>()),
+ bound_network_(NetworkChangeNotifier::kInvalidNetworkHandle) {}
URLRequestContext::~URLRequestContext() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index 9da6d7e..7795b87 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -325,28 +325,28 @@
// Ownership for these members are not defined here. Clients should either
// provide storage elsewhere or have a subclass take ownership.
- raw_ptr<NetLog> net_log_;
- raw_ptr<HostResolver> host_resolver_;
- raw_ptr<CertVerifier> cert_verifier_;
- raw_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_;
- raw_ptr<ProxyResolutionService> proxy_resolution_service_;
- raw_ptr<ProxyDelegate> proxy_delegate_;
- raw_ptr<SSLConfigService> ssl_config_service_;
- raw_ptr<NetworkDelegate> network_delegate_;
- raw_ptr<HttpServerProperties> http_server_properties_;
- raw_ptr<const HttpUserAgentSettings> http_user_agent_settings_;
- raw_ptr<CookieStore> cookie_store_;
- raw_ptr<TransportSecurityState> transport_security_state_;
- raw_ptr<CTPolicyEnforcer> ct_policy_enforcer_;
- raw_ptr<SCTAuditingDelegate> sct_auditing_delegate_;
- raw_ptr<HttpTransactionFactory> http_transaction_factory_;
- raw_ptr<const URLRequestJobFactory> job_factory_;
- raw_ptr<URLRequestThrottlerManager> throttler_manager_;
- raw_ptr<QuicContext> quic_context_;
- raw_ptr<NetworkQualityEstimator> network_quality_estimator_;
+ raw_ptr<NetLog> net_log_ = nullptr;
+ raw_ptr<HostResolver> host_resolver_ = nullptr;
+ raw_ptr<CertVerifier> cert_verifier_ = nullptr;
+ raw_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_ = nullptr;
+ raw_ptr<ProxyResolutionService> proxy_resolution_service_ = nullptr;
+ raw_ptr<ProxyDelegate> proxy_delegate_ = nullptr;
+ raw_ptr<SSLConfigService> ssl_config_service_ = nullptr;
+ raw_ptr<NetworkDelegate> network_delegate_ = nullptr;
+ raw_ptr<HttpServerProperties> http_server_properties_ = nullptr;
+ raw_ptr<const HttpUserAgentSettings> http_user_agent_settings_ = nullptr;
+ raw_ptr<CookieStore> cookie_store_ = nullptr;
+ raw_ptr<TransportSecurityState> transport_security_state_ = nullptr;
+ raw_ptr<CTPolicyEnforcer> ct_policy_enforcer_ = nullptr;
+ raw_ptr<SCTAuditingDelegate> sct_auditing_delegate_ = nullptr;
+ raw_ptr<HttpTransactionFactory> http_transaction_factory_ = nullptr;
+ raw_ptr<const URLRequestJobFactory> job_factory_ = nullptr;
+ raw_ptr<URLRequestThrottlerManager> throttler_manager_ = nullptr;
+ raw_ptr<QuicContext> quic_context_ = nullptr;
+ raw_ptr<NetworkQualityEstimator> network_quality_estimator_ = nullptr;
#if BUILDFLAG(ENABLE_REPORTING)
- raw_ptr<ReportingService> reporting_service_;
- raw_ptr<NetworkErrorLoggingService> network_error_logging_service_;
+ raw_ptr<ReportingService> reporting_service_ = nullptr;
+ raw_ptr<NetworkErrorLoggingService> network_error_logging_service_ = nullptr;
#endif // BUILDFLAG(ENABLE_REPORTING)
std::unique_ptr<std::set<const URLRequest*>> url_requests_;
diff --git a/net/url_request/url_request_filter_unittest.cc b/net/url_request/url_request_filter_unittest.cc
index 2f653dc..c330f61 100644
--- a/net/url_request/url_request_filter_unittest.cc
+++ b/net/url_request/url_request_filter_unittest.cc
@@ -26,7 +26,7 @@
class TestURLRequestInterceptor : public URLRequestInterceptor {
public:
- TestURLRequestInterceptor() : job_(nullptr) {}
+ TestURLRequestInterceptor() = default;
TestURLRequestInterceptor(const TestURLRequestInterceptor&) = delete;
TestURLRequestInterceptor& operator=(const TestURLRequestInterceptor&) =
@@ -47,7 +47,7 @@
}
private:
- mutable raw_ptr<URLRequestTestJob> job_;
+ mutable raw_ptr<URLRequestTestJob> job_ = nullptr;
};
TEST(URLRequestFilter, BasicMatching) {
diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc
index d170e20..1975492c 100644
--- a/net/url_request/url_request_http_job.cc
+++ b/net/url_request/url_request_http_job.cc
@@ -229,8 +229,6 @@
URLRequest* request,
const HttpUserAgentSettings* http_user_agent_settings)
: URLRequestJob(request),
- response_info_(nullptr),
- throttling_entry_(nullptr),
http_user_agent_settings_(http_user_agent_settings) {
URLRequestThrottlerManager* manager = request->context()->throttler_manager();
if (manager)
diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h
index 7bc5cf5..10516a902 100644
--- a/net/url_request/url_request_http_job.h
+++ b/net/url_request/url_request_http_job.h
@@ -232,7 +232,7 @@
RequestPriority priority_ = DEFAULT_PRIORITY;
HttpRequestInfo request_info_;
- raw_ptr<const HttpResponseInfo> response_info_;
+ raw_ptr<const HttpResponseInfo> response_info_ = nullptr;
// Used for any logic, e.g. DNS-based scheme upgrade, that needs to synthesize
// response info to override the real response info. Transaction should be
diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc
index d4105a4c..f2578e40 100644
--- a/net/url_request/url_request_test_job.cc
+++ b/net/url_request/url_request_test_job.cc
@@ -130,13 +130,7 @@
URLRequestTestJob::URLRequestTestJob(URLRequest* request, bool auto_advance)
: URLRequestJob(request),
auto_advance_(auto_advance),
- stage_(WAITING),
- priority_(DEFAULT_PRIORITY),
- offset_(0),
- async_buf_(nullptr),
- async_buf_size_(0),
- response_headers_length_(0),
- async_reads_(false) {}
+ response_headers_length_(0) {}
URLRequestTestJob::URLRequestTestJob(URLRequest* request,
const std::string& response_headers,
@@ -144,16 +138,10 @@
bool auto_advance)
: URLRequestJob(request),
auto_advance_(auto_advance),
- stage_(WAITING),
- priority_(DEFAULT_PRIORITY),
response_data_(response_data),
- offset_(0),
- async_buf_(nullptr),
- async_buf_size_(0),
response_headers_(base::MakeRefCounted<net::HttpResponseHeaders>(
net::HttpUtil::AssembleRawHeaders(response_headers))),
- response_headers_length_(response_headers.size()),
- async_reads_(false) {}
+ response_headers_length_(response_headers.size()) {}
URLRequestTestJob::~URLRequestTestJob() {
base::Erase(g_pending_jobs.Get(), this);
diff --git a/net/url_request/url_request_test_job.h b/net/url_request/url_request_test_job.h
index 6969cb8..d405ed7 100644
--- a/net/url_request/url_request_test_job.h
+++ b/net/url_request/url_request_test_job.h
@@ -161,20 +161,20 @@
bool auto_advance_;
- Stage stage_;
+ Stage stage_ = WAITING;
- RequestPriority priority_;
+ RequestPriority priority_ = DEFAULT_PRIORITY;
// The data to send, will be set in Start() if not provided in the explicit
// ctor.
std::string response_data_;
// current offset within response_data_
- int offset_;
+ int offset_ = 0;
// Holds the buffer for an asynchronous ReadRawData call
- raw_ptr<IOBuffer> async_buf_;
- int async_buf_size_;
+ raw_ptr<IOBuffer> async_buf_ = nullptr;
+ int async_buf_size_ = 0;
LoadTimingInfo load_timing_info_;
@@ -186,7 +186,7 @@
// Original size in bytes of the response headers before decoding.
int response_headers_length_;
- bool async_reads_;
+ bool async_reads_ = false;
base::WeakPtrFactory<URLRequestTestJob> weak_factory_{this};
};
diff --git a/net/url_request/url_request_throttler_entry.cc b/net/url_request/url_request_throttler_entry.cc
index ea55370..c7f4469 100644
--- a/net/url_request/url_request_throttler_entry.cc
+++ b/net/url_request/url_request_throttler_entry.cc
@@ -67,7 +67,6 @@
const std::string& url_id)
: sliding_window_period_(base::Milliseconds(kDefaultSlidingWindowPeriodMs)),
max_send_threshold_(kDefaultMaxSendThreshold),
- is_backoff_disabled_(false),
backoff_entry_(&backoff_policy_),
manager_(manager),
url_id_(url_id),
@@ -89,7 +88,6 @@
int maximum_backoff_ms)
: sliding_window_period_(base::Milliseconds(sliding_window_period_ms)),
max_send_threshold_(max_send_threshold),
- is_backoff_disabled_(false),
backoff_entry_(&backoff_policy_),
manager_(manager),
url_id_(url_id) {
diff --git a/net/url_request/url_request_throttler_entry.h b/net/url_request/url_request_throttler_entry.h
index 7f7a9314..48d41f0 100644
--- a/net/url_request/url_request_throttler_entry.h
+++ b/net/url_request/url_request_throttler_entry.h
@@ -141,7 +141,7 @@
const int max_send_threshold_;
// True if DisableBackoffThrottling() has been called on this object.
- bool is_backoff_disabled_;
+ bool is_backoff_disabled_ = false;
// Access it through GetBackoffEntry() to allow a unit test seam.
BackoffEntry backoff_entry_;
diff --git a/net/url_request/url_request_throttler_manager.cc b/net/url_request/url_request_throttler_manager.cc
index 9fb5ca1..5927ee91 100644
--- a/net/url_request/url_request_throttler_manager.cc
+++ b/net/url_request/url_request_throttler_manager.cc
@@ -16,8 +16,7 @@
const unsigned int URLRequestThrottlerManager::kMaximumNumberOfEntries = 1500;
const unsigned int URLRequestThrottlerManager::kRequestsBetweenCollecting = 200;
-URLRequestThrottlerManager::URLRequestThrottlerManager()
- : registered_from_thread_(base::kInvalidThreadId) {
+URLRequestThrottlerManager::URLRequestThrottlerManager() {
url_id_replacements_.ClearPassword();
url_id_replacements_.ClearUsername();
url_id_replacements_.ClearQuery();
diff --git a/net/url_request/url_request_throttler_manager.h b/net/url_request/url_request_throttler_manager.h
index 5b6a98a6..8bc39d1 100644
--- a/net/url_request/url_request_throttler_manager.h
+++ b/net/url_request/url_request_throttler_manager.h
@@ -141,7 +141,7 @@
NetLogWithSource net_log_;
// Valid once we've registered for network notifications.
- base::PlatformThreadId registered_from_thread_;
+ base::PlatformThreadId registered_from_thread_ = base::kInvalidThreadId;
THREAD_CHECKER(thread_checker_);
};
diff --git a/net/websockets/websocket_basic_handshake_stream.cc b/net/websockets/websocket_basic_handshake_stream.cc
index d66b4b9..0c33580 100644
--- a/net/websockets/websocket_basic_handshake_stream.cc
+++ b/net/websockets/websocket_basic_handshake_stream.cc
@@ -179,7 +179,6 @@
WebSocketEndpointLockManager* websocket_endpoint_lock_manager)
: state_(std::move(connection), using_proxy),
connect_delegate_(connect_delegate),
- http_response_info_(nullptr),
requested_sub_protocols_(std::move(requested_sub_protocols)),
requested_extensions_(std::move(requested_extensions)),
stream_request_(request),
diff --git a/net/websockets/websocket_basic_handshake_stream.h b/net/websockets/websocket_basic_handshake_stream.h
index 8b84684..f50cabb 100644
--- a/net/websockets/websocket_basic_handshake_stream.h
+++ b/net/websockets/websocket_basic_handshake_stream.h
@@ -128,7 +128,7 @@
const raw_ptr<WebSocketStream::ConnectDelegate> connect_delegate_;
// This is stored in SendRequest() for use by ReadResponseHeaders().
- raw_ptr<HttpResponseInfo> http_response_info_;
+ raw_ptr<HttpResponseInfo> http_response_info_ = nullptr;
// The key to be sent in the next Sec-WebSocket-Key header. Usually NULL (the
// key is generated on the fly).
diff --git a/net/websockets/websocket_channel_test.cc b/net/websockets/websocket_channel_test.cc
index 7ac0456..0f9462e 100644
--- a/net/websockets/websocket_channel_test.cc
+++ b/net/websockets/websocket_channel_test.cc
@@ -593,7 +593,7 @@
// otherwise the ReadFrames() callback will never be called.
class EchoeyFakeWebSocketStream : public FakeWebSocketStream {
public:
- EchoeyFakeWebSocketStream() : read_frames_(nullptr) {}
+ EchoeyFakeWebSocketStream() = default;
int WriteFrames(std::vector<std::unique_ptr<WebSocketFrame>>* frames,
CompletionOnceCallback callback) override {
@@ -658,7 +658,7 @@
std::vector<std::unique_ptr<WebSocketFrame>> stored_frames_;
CompletionOnceCallback read_callback_;
// Owned by the caller of ReadFrames().
- raw_ptr<std::vector<std::unique_ptr<WebSocketFrame>>> read_frames_;
+ raw_ptr<std::vector<std::unique_ptr<WebSocketFrame>>> read_frames_ = nullptr;
std::vector<scoped_refptr<IOBuffer>> buffers_;
// True if we should close the connection.
bool done_ = false;
diff --git a/net/websockets/websocket_deflate_stream_test.cc b/net/websockets/websocket_deflate_stream_test.cc
index 45736233..f98f092 100644
--- a/net/websockets/websocket_deflate_stream_test.cc
+++ b/net/websockets/websocket_deflate_stream_test.cc
@@ -198,7 +198,7 @@
class WebSocketDeflateStreamTest : public ::testing::Test {
public:
- WebSocketDeflateStreamTest() : mock_stream_(nullptr), predictor_(nullptr) {}
+ WebSocketDeflateStreamTest() = default;
~WebSocketDeflateStreamTest() override = default;
void SetUp() override {
@@ -247,9 +247,9 @@
std::unique_ptr<WebSocketDeflateStream> deflate_stream_;
// Owned by |deflate_stream_|.
- raw_ptr<MockWebSocketStream> mock_stream_;
+ raw_ptr<MockWebSocketStream> mock_stream_ = nullptr;
// Owned by |deflate_stream_|.
- raw_ptr<WebSocketDeflatePredictorMock> predictor_;
+ raw_ptr<WebSocketDeflatePredictorMock> predictor_ = nullptr;
// TODO(yoichio): Make this type std::vector<std::string>.
std::vector<std::unique_ptr<const char[]>> data_buffers;
diff --git a/net/websockets/websocket_http2_handshake_stream.cc b/net/websockets/websocket_http2_handshake_stream.cc
index 0f3e465..dfbe503 100644
--- a/net/websockets/websocket_http2_handshake_stream.cc
+++ b/net/websockets/websocket_http2_handshake_stream.cc
@@ -48,11 +48,9 @@
std::set<std::string> dns_aliases)
: session_(session),
connect_delegate_(connect_delegate),
- http_response_info_(nullptr),
requested_sub_protocols_(requested_sub_protocols),
requested_extensions_(requested_extensions),
stream_request_(request),
- request_info_(nullptr),
dns_aliases_(std::move(dns_aliases)) {
DCHECK(connect_delegate);
DCHECK(request);
diff --git a/net/websockets/websocket_http2_handshake_stream.h b/net/websockets/websocket_http2_handshake_stream.h
index d9ed31cf..f04e76d 100644
--- a/net/websockets/websocket_http2_handshake_stream.h
+++ b/net/websockets/websocket_http2_handshake_stream.h
@@ -136,7 +136,7 @@
// |connect_delegate| will live during the lifetime of this object.
const raw_ptr<WebSocketStream::ConnectDelegate> connect_delegate_;
- raw_ptr<HttpResponseInfo> http_response_info_;
+ raw_ptr<HttpResponseInfo> http_response_info_ = nullptr;
spdy::Http2HeaderBlock http2_request_headers_;
@@ -148,7 +148,7 @@
const raw_ptr<WebSocketStreamRequestAPI> stream_request_;
- raw_ptr<const HttpRequestInfo> request_info_;
+ raw_ptr<const HttpRequestInfo> request_info_ = nullptr;
RequestPriority priority_;
diff --git a/net/websockets/websocket_stream_create_test_base.cc b/net/websockets/websocket_stream_create_test_base.cc
index ee54346..2c60fdf 100644
--- a/net/websockets/websocket_stream_create_test_base.cc
+++ b/net/websockets/websocket_stream_create_test_base.cc
@@ -92,8 +92,7 @@
base::OnceClosure done_callback_;
};
-WebSocketStreamCreateTestBase::WebSocketStreamCreateTestBase()
- : url_request_(nullptr) {}
+WebSocketStreamCreateTestBase::WebSocketStreamCreateTestBase() = default;
WebSocketStreamCreateTestBase::~WebSocketStreamCreateTestBase() = default;
diff --git a/net/websockets/websocket_stream_create_test_base.h b/net/websockets/websocket_stream_create_test_base.h
index a57c6f26..8e36af7 100644
--- a/net/websockets/websocket_stream_create_test_base.h
+++ b/net/websockets/websocket_stream_create_test_base.h
@@ -90,7 +90,7 @@
ssl_error_callbacks_;
SSLInfo ssl_info_;
bool ssl_fatal_ = false;
- raw_ptr<URLRequest> url_request_;
+ raw_ptr<URLRequest> url_request_ = nullptr;
AuthChallengeInfo auth_challenge_info_;
base::OnceCallback<void(const AuthCredentials*)> on_auth_required_callback_;