[net/dns,extras,filter,log] default member initializers

This change was partially automated with run-clang-tidy.py.
This should cause no functional changes.

Bug: 1334056
Change-Id: I6464a0ef49bf71344badb1b954ec07a3aaa5b1b8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3694545
Reviewed-by: Kenichi Ishibashi <[email protected]>
Commit-Queue: Tsuyoshi Horo <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1012272}
diff --git a/net/dns/address_sorter_posix_unittest.cc b/net/dns/address_sorter_posix_unittest.cc
index 9a4a319..6bd613d 100644
--- a/net/dns/address_sorter_posix_unittest.cc
+++ b/net/dns/address_sorter_posix_unittest.cc
@@ -43,7 +43,7 @@
 class TestUDPClientSocket : public DatagramClientSocket {
  public:
   explicit TestUDPClientSocket(const AddressMapping* mapping)
-      : mapping_(mapping), connected_(false)  {}
+      : mapping_(mapping) {}
 
   TestUDPClientSocket(const TestUDPClientSocket&) = delete;
   TestUDPClientSocket& operator=(const TestUDPClientSocket&) = delete;
@@ -139,7 +139,7 @@
  private:
   NetLogWithSource net_log_;
   raw_ptr<const AddressMapping> mapping_;
-  bool connected_;
+  bool connected_ = false;
   IPEndPoint local_endpoint_;
 };
 
diff --git a/net/dns/dns_config_service.cc b/net/dns/dns_config_service.cc
index 1aafa73..d1df61f0 100644
--- a/net/dns/dns_config_service.cc
+++ b/net/dns/dns_config_service.cc
@@ -30,12 +30,7 @@
 DnsConfigService::DnsConfigService(
     base::FilePath::StringPieceType hosts_file_path,
     absl::optional<base::TimeDelta> config_change_delay)
-    : watch_failed_(false),
-      have_config_(false),
-      have_hosts_(false),
-      need_update_(false),
-      last_sent_empty_(true),
-      config_change_delay_(config_change_delay),
+    : config_change_delay_(config_change_delay),
       hosts_file_path_(hosts_file_path) {
   DETACH_FROM_SEQUENCE(sequence_checker_);
 }
diff --git a/net/dns/dns_config_service.h b/net/dns/dns_config_service.h
index bed76def..d4aa1802 100644
--- a/net/dns/dns_config_service.h
+++ b/net/dns/dns_config_service.h
@@ -205,15 +205,15 @@
 
   // True if any of the necessary watchers failed. In that case, the service
   // will communicate changes via OnTimeout, but will only send empty DnsConfig.
-  bool watch_failed_;
+  bool watch_failed_ = false;
   // True after On*Read, before Invalidate*. Tells if the config is complete.
-  bool have_config_;
-  bool have_hosts_;
+  bool have_config_ = false;
+  bool have_hosts_ = false;
   // True if receiver needs to be updated when the config becomes complete.
-  bool need_update_;
+  bool need_update_ = false;
   // True if the last config sent was empty (instead of |dns_config_|).
   // Set when |timer_| expires.
-  bool last_sent_empty_;
+  bool last_sent_empty_ = true;
 
   const absl::optional<base::TimeDelta> config_change_delay_;
   const base::FilePath hosts_file_path_;
diff --git a/net/dns/dns_hosts.cc b/net/dns/dns_hosts.cc
index 06541a7..ab2cf0d 100644
--- a/net/dns/dns_hosts.cc
+++ b/net/dns/dns_hosts.cc
@@ -29,8 +29,6 @@
       : text_(text),
         data_(text.data()),
         end_(text.size()),
-        pos_(0),
-        token_is_ip_(false),
         comma_mode_(comma_mode) {}
 
   HostsParser(const HostsParser&) = delete;
@@ -127,9 +125,9 @@
   const char* data_;
   const size_t end_;
 
-  size_t pos_;
+  size_t pos_ = 0;
   StringPiece token_;
-  bool token_is_ip_;
+  bool token_is_ip_ = false;
 
   const ParseHostsCommaMode comma_mode_;
 };
diff --git a/net/dns/dns_transaction.cc b/net/dns/dns_transaction.cc
index 3a97987..8196946 100644
--- a/net/dns/dns_transaction.cc
+++ b/net/dns/dns_transaction.cc
@@ -200,7 +200,6 @@
                 std::unique_ptr<DnsQuery> query,
                 DnsUdpTracker* udp_tracker)
       : DnsAttempt(server_index),
-        next_state_(STATE_NONE),
         socket_(std::move(socket)),
         server_(server),
         query_(std::move(query)),
@@ -349,7 +348,7 @@
       std::move(callback_).Run(rv);
   }
 
-  State next_state_;
+  State next_state_ = STATE_NONE;
   base::TimeTicks start_time_;
 
   std::unique_ptr<DatagramClientSocket> socket_;
@@ -649,12 +648,10 @@
                 std::unique_ptr<StreamSocket> socket,
                 std::unique_ptr<DnsQuery> query)
       : DnsAttempt(server_index),
-        next_state_(STATE_NONE),
         socket_(std::move(socket)),
         query_(std::move(query)),
         length_buffer_(
-            base::MakeRefCounted<IOBufferWithSize>(sizeof(uint16_t))),
-        response_length_(0) {}
+            base::MakeRefCounted<IOBufferWithSize>(sizeof(uint16_t))) {}
 
   DnsTCPAttempt(const DnsTCPAttempt&) = delete;
   DnsTCPAttempt& operator=(const DnsTCPAttempt&) = delete;
@@ -878,7 +875,7 @@
         base::BindOnce(&DnsTCPAttempt::OnIOComplete, base::Unretained(this)));
   }
 
-  State next_state_;
+  State next_state_ = STATE_NONE;
   base::TimeTicks start_time_;
 
   std::unique_ptr<StreamSocket> socket_;
@@ -886,7 +883,7 @@
   scoped_refptr<IOBufferWithSize> length_buffer_;
   scoped_refptr<DrainableIOBuffer> buffer_;
 
-  uint16_t response_length_;
+  uint16_t response_length_ = 0;
   std::unique_ptr<DnsResponse> response_;
 
   CompletionOnceCallback callback_;
@@ -1118,11 +1115,7 @@
         secure_dns_mode_(secure_dns_mode),
         fast_timeout_(fast_timeout),
         net_log_(net_log),
-        qnames_initial_size_(0),
-        attempts_count_(0),
-        had_tcp_retry_(false),
-        resolve_context_(resolve_context->AsSafeRef()),
-        request_priority_(DEFAULT_PRIORITY) {
+        resolve_context_(resolve_context->AsSafeRef()) {
     DCHECK(session_.get());
     DCHECK(!hostname_.empty());
     DCHECK(!IsIPLiteral(hostname_));
@@ -1684,15 +1677,15 @@
 
   // Search list of fully-qualified DNS names to query next (in DNS format).
   base::circular_deque<std::string> qnames_;
-  size_t qnames_initial_size_;
+  size_t qnames_initial_size_ = 0;
 
   // List of attempts for the current name.
   std::vector<std::unique_ptr<DnsAttempt>> attempts_;
   // Count of attempts, not reset when |attempts_| vector is cleared.
-  int attempts_count_;
+  int attempts_count_ = 0;
 
   // Records when an attempt was retried via TCP due to a truncation error.
-  bool had_tcp_retry_;
+  bool had_tcp_retry_ = false;
 
   // Iterator to get the index of the DNS server for each search query.
   std::unique_ptr<DnsServerIterator> dns_server_iterator_;
@@ -1701,7 +1694,7 @@
   std::unique_ptr<base::ElapsedTimer> time_from_start_;
 
   base::SafeRef<ResolveContext> resolve_context_;
-  RequestPriority request_priority_;
+  RequestPriority request_priority_ = DEFAULT_PRIORITY;
 
   THREAD_CHECKER(thread_checker_);
 };
diff --git a/net/dns/dns_transaction_unittest.cc b/net/dns/dns_transaction_unittest.cc
index 67d9ff6b..43ac7d35 100644
--- a/net/dns/dns_transaction_unittest.cc
+++ b/net/dns/dns_transaction_unittest.cc
@@ -443,8 +443,6 @@
       ResponseModifierCallback response_modifier = ResponseModifierCallback(),
       UrlRequestStartedCallback on_start = UrlRequestStartedCallback())
       : URLRequestJob(request),
-        content_length_(0),
-        leftover_data_len_(0),
         data_provider_(data_provider),
         response_modifier_(response_modifier),
         on_start_(on_start) {
@@ -585,9 +583,9 @@
     return data_len;
   }
 
-  const int content_length_;
+  const int content_length_ = 0;
   const char* leftover_data_;
-  int leftover_data_len_;
+  int leftover_data_len_ = 0;
   raw_ptr<SocketDataProvider> data_provider_;
   const ResponseModifierCallback response_modifier_;
   const UrlRequestStartedCallback on_start_;
@@ -2354,8 +2352,7 @@
 
 class CookieCallback {
  public:
-  CookieCallback()
-      : result_(false), loop_to_quit_(std::make_unique<base::RunLoop>()) {}
+  CookieCallback() : loop_to_quit_(std::make_unique<base::RunLoop>()) {}
 
   void SetCookieCallback(CookieAccessResult result) {
     result_ = result.status.IsInclude();
@@ -2380,7 +2377,7 @@
 
  private:
   net::CookieList list_;
-  bool result_;
+  bool result_ = false;
   std::unique_ptr<base::RunLoop> loop_to_quit_;
 };
 
@@ -2548,7 +2545,7 @@
 
 class CountingObserver : public net::NetLog::ThreadSafeObserver {
  public:
-  CountingObserver() : count_(0), dict_count_(0) {}
+  CountingObserver() = default;
 
   ~CountingObserver() override {
     if (net_log())
@@ -2566,8 +2563,8 @@
   int dict_count() const { return dict_count_; }
 
  private:
-  int count_;
-  int dict_count_;
+  int count_ = 0;
+  int dict_count_ = 0;
 };
 
 // Flaky on MSAN. https://crbug.com/1245953
diff --git a/net/dns/host_cache.cc b/net/dns/host_cache.cc
index dea347e..3c4ca83 100644
--- a/net/dns/host_cache.cc
+++ b/net/dns/host_cache.cc
@@ -630,8 +630,6 @@
 
 HostCache::HostCache(size_t max_entries)
     : max_entries_(max_entries),
-      network_changes_(0),
-      restore_size_(0),
       delegate_(nullptr),
       tick_clock_(base::DefaultTickClock::GetInstance()) {}
 
diff --git a/net/dns/host_cache.h b/net/dns/host_cache.h
index 07637c8..70d453ef 100644
--- a/net/dns/host_cache.h
+++ b/net/dns/host_cache.h
@@ -526,10 +526,10 @@
   // a resolved result entry.
   EntryMap entries_;
   size_t max_entries_;
-  int network_changes_;
+  int network_changes_ = 0;
   // Number of cache entries that were restored in the last call to
   // RestoreFromListValue(). Used in histograms.
-  size_t restore_size_;
+  size_t restore_size_ = 0;
 
   raw_ptr<PersistenceDelegate> delegate_;
   // Shared tick clock, overridden for testing.
diff --git a/net/dns/host_resolver_manager_unittest.cc b/net/dns/host_resolver_manager_unittest.cc
index 599b0c4..de7c47e 100644
--- a/net/dns/host_resolver_manager_unittest.cc
+++ b/net/dns/host_resolver_manager_unittest.cc
@@ -144,8 +144,6 @@
 
   MockHostResolverProc()
       : HostResolverProc(nullptr),
-        num_requests_waiting_(0),
-        num_slots_available_(0),
         requests_waiting_(&lock_),
         slots_available_(&lock_) {}
 
@@ -273,8 +271,8 @@
   mutable base::Lock lock_;
   std::map<ResolveKey, AddressList> rules_;
   CaptureList capture_list_;
-  unsigned num_requests_waiting_;
-  unsigned num_slots_available_;
+  unsigned num_requests_waiting_ = 0;
+  unsigned num_slots_available_ = 0;
   base::ConditionVariable requests_waiting_;
   base::ConditionVariable slots_available_;
 };
@@ -358,11 +356,7 @@
                                 int total_attempts)
       : HostResolverProc(previous),
         attempt_number_to_resolve_(attempt_number_to_resolve),
-        current_attempt_number_(0),
         total_attempts_(total_attempts),
-        total_attempts_resolved_(0),
-        resolved_attempt_number_(0),
-        num_attempts_waiting_(0),
         all_done_(&lock_),
         blocked_attempt_signal_(&lock_) {}
 
@@ -458,11 +452,11 @@
 
  private:
   int attempt_number_to_resolve_;
-  int current_attempt_number_;  // Incremented whenever Resolve is called.
+  int current_attempt_number_ = 0;  // Incremented whenever Resolve is called.
   int total_attempts_;
-  int total_attempts_resolved_;
-  int resolved_attempt_number_;
-  int num_attempts_waiting_;
+  int total_attempts_resolved_ = 0;
+  int resolved_attempt_number_ = 0;
+  int num_attempts_waiting_ = 0;
 
   // All attempts wait for right attempt to be resolve.
   base::Lock lock_;
diff --git a/net/dns/host_resolver_proc.cc b/net/dns/host_resolver_proc.cc
index a205f62..a98cbf2 100644
--- a/net/dns/host_resolver_proc.cc
+++ b/net/dns/host_resolver_proc.cc
@@ -258,8 +258,7 @@
                                size_t in_max_retry_attempts)
     : resolver_proc(resolver_proc),
       max_retry_attempts(in_max_retry_attempts),
-      unresponsive_delay(kDnsDefaultUnresponsiveDelay),
-      retry_factor(2) {
+      unresponsive_delay(kDnsDefaultUnresponsiveDelay) {
   // Maximum of 4 retry attempts for host resolution.
   static const size_t kDefaultMaxRetryAttempts = 4u;
   if (max_retry_attempts == HostResolver::ManagerOptions::kDefaultRetryAttempts)
diff --git a/net/dns/host_resolver_proc.h b/net/dns/host_resolver_proc.h
index cff9f64..2d7fd449 100644
--- a/net/dns/host_resolver_proc.h
+++ b/net/dns/host_resolver_proc.h
@@ -177,7 +177,7 @@
   base::TimeDelta unresponsive_delay;
 
   // Factor to grow |unresponsive_delay| when we re-re-try.
-  uint32_t retry_factor;
+  uint32_t retry_factor = 2;
 };
 
 }  // namespace net
diff --git a/net/dns/mdns_client_impl.cc b/net/dns/mdns_client_impl.cc
index 624912d6..2bd3b82 100644
--- a/net/dns/mdns_client_impl.cc
+++ b/net/dns/mdns_client_impl.cc
@@ -62,8 +62,7 @@
     MDnsConnection* connection)
     : socket_(std::move(socket)),
       connection_(connection),
-      response_(dns_protocol::kMaxMulticastSize),
-      send_in_progress_(false) {}
+      response_(dns_protocol::kMaxMulticastSize) {}
 
 MDnsConnection::SocketHandler::~SocketHandler() = default;
 
@@ -496,9 +495,7 @@
       name_(name),
       clock_(clock),
       client_(client),
-      delegate_(delegate),
-      started_(false),
-      active_refresh_(false) {}
+      delegate_(delegate) {}
 
 MDnsListenerImpl::~MDnsListenerImpl() {
   if (started_) {
@@ -628,7 +625,6 @@
       name_(name),
       callback_(callback),
       client_(client),
-      started_(false),
       flags_(flags) {
   DCHECK((flags_ & MDnsTransaction::FLAG_MASK) == flags_);
   DCHECK(flags_ & MDnsTransaction::QUERY_CACHE ||
diff --git a/net/dns/mdns_client_impl.h b/net/dns/mdns_client_impl.h
index 2bca834d..d21c1db 100644
--- a/net/dns/mdns_client_impl.h
+++ b/net/dns/mdns_client_impl.h
@@ -103,7 +103,7 @@
     IPEndPoint recv_addr_;
     DnsResponse response_;
     IPEndPoint multicast_addr_;
-    bool send_in_progress_;
+    bool send_in_progress_ = false;
     base::queue<std::pair<scoped_refptr<IOBuffer>, unsigned>> send_queue_;
   };
 
@@ -293,8 +293,8 @@
 
   base::Time last_update_;
   uint32_t ttl_;
-  bool started_;
-  bool active_refresh_;
+  bool started_ = false;
+  bool active_refresh_ = false;
 
   base::CancelableRepeatingClosure next_refresh_;
 };
@@ -360,7 +360,7 @@
 
   raw_ptr<MDnsClientImpl> client_;
 
-  bool started_;
+  bool started_ = false;
   int flags_;
 };
 
diff --git a/net/dns/mock_host_resolver.cc b/net/dns/mock_host_resolver.cc
index 6ac17d0a..6d33a9c 100644
--- a/net/dns/mock_host_resolver.cc
+++ b/net/dns/mock_host_resolver.cc
@@ -144,9 +144,7 @@
         priority_(parameters_.initial_priority),
         host_resolver_flags_(ParametersToHostResolverFlags(parameters_)),
         resolve_error_info_(ResolveErrorInfo(ERR_IO_PENDING)),
-        id_(0),
-        resolver_(resolver),
-        complete_(false) {}
+        resolver_(resolver) {}
 
   RequestImpl(const RequestImpl&) = delete;
   RequestImpl& operator=(const RequestImpl&) = delete;
@@ -382,13 +380,13 @@
   ResolveErrorInfo resolve_error_info_;
 
   // Used while stored with the resolver for async resolution.  Otherwise 0.
-  size_t id_;
+  size_t id_ = 0;
 
   CompletionOnceCallback callback_;
   // Use a WeakPtr as the resolver may be destroyed while there are still
   // outstanding request objects.
   base::WeakPtr<MockHostResolverBase> resolver_;
-  bool complete_;
+  bool complete_ = false;
 };
 
 class MockHostResolverBase::ProbeRequestImpl
@@ -882,11 +880,7 @@
 MockHostResolverBase::MockHostResolverBase(bool use_caching,
                                            int cache_invalidation_num,
                                            RuleResolver rule_resolver)
-    : last_request_priority_(DEFAULT_PRIORITY),
-      last_secure_dns_policy_(SecureDnsPolicy::kAllow),
-      synchronous_mode_(false),
-      ondemand_mode_(false),
-      rule_resolver_(std::move(rule_resolver)),
+    : rule_resolver_(std::move(rule_resolver)),
       initial_cache_invalidation_num_(cache_invalidation_num),
       tick_clock_(base::DefaultTickClock::GetInstance()),
       state_(base::MakeRefCounted<State>()) {
@@ -1147,8 +1141,7 @@
 
 RuleBasedHostResolverProc::RuleBasedHostResolverProc(HostResolverProc* previous,
                                                      bool allow_fallback)
-    : HostResolverProc(previous, allow_fallback),
-      modifications_allowed_(true) {}
+    : HostResolverProc(previous, allow_fallback) {}
 
 void RuleBasedHostResolverProc::AddRule(const std::string& host_pattern,
                                         const std::string& replacement) {
diff --git a/net/dns/mock_host_resolver.h b/net/dns/mock_host_resolver.h
index fb00c7b7..06f57b1 100644
--- a/net/dns/mock_host_resolver.h
+++ b/net/dns/mock_host_resolver.h
@@ -413,11 +413,11 @@
   void AddListener(MdnsListenerImpl* listener);
   void RemoveCancelledListener(MdnsListenerImpl* listener);
 
-  RequestPriority last_request_priority_;
+  RequestPriority last_request_priority_ = DEFAULT_PRIORITY;
   absl::optional<NetworkIsolationKey> last_request_network_isolation_key_;
-  SecureDnsPolicy last_secure_dns_policy_;
-  bool synchronous_mode_;
-  bool ondemand_mode_;
+  SecureDnsPolicy last_secure_dns_policy_ = SecureDnsPolicy::kAllow;
+  bool synchronous_mode_ = false;
+  bool ondemand_mode_ = false;
   RuleResolver rule_resolver_;
   std::unique_ptr<HostCache> cache_;
 
@@ -626,7 +626,7 @@
   base::Lock rule_lock_;
 
   // Whether changes are allowed.
-  bool modifications_allowed_;
+  bool modifications_allowed_ = true;
 };
 
 // Create rules that map all requests to localhost.
diff --git a/net/dns/record_rdata.cc b/net/dns/record_rdata.cc
index 26b46cb..8e969a1 100644
--- a/net/dns/record_rdata.cc
+++ b/net/dns/record_rdata.cc
@@ -54,8 +54,7 @@
   }
 }
 
-SrvRecordRdata::SrvRecordRdata() : priority_(0), weight_(0), port_(0) {
-}
+SrvRecordRdata::SrvRecordRdata() = default;
 
 SrvRecordRdata::~SrvRecordRdata() = default;
 
diff --git a/net/dns/record_rdata.h b/net/dns/record_rdata.h
index 8e4b4e6f..6097b96b 100644
--- a/net/dns/record_rdata.h
+++ b/net/dns/record_rdata.h
@@ -68,9 +68,9 @@
  private:
   SrvRecordRdata();
 
-  uint16_t priority_;
-  uint16_t weight_;
-  uint16_t port_;
+  uint16_t priority_ = 0;
+  uint16_t weight_ = 0;
+  uint16_t port_ = 0;
 
   std::string target_;
 };
diff --git a/net/dns/resolve_context.cc b/net/dns/resolve_context.cc
index 1eca1bc..52ffae34 100644
--- a/net/dns/resolve_context.cc
+++ b/net/dns/resolve_context.cc
@@ -119,7 +119,7 @@
 
 ResolveContext::ServerStats::ServerStats(
     std::unique_ptr<base::SampleVector> buckets)
-    : last_failure_count(0), rtt_histogram(std::move(buckets)) {}
+    : rtt_histogram(std::move(buckets)) {}
 
 ResolveContext::ServerStats::ServerStats(ServerStats&&) = default;
 
diff --git a/net/dns/resolve_context.h b/net/dns/resolve_context.h
index d9c0e756..f915332 100644
--- a/net/dns/resolve_context.h
+++ b/net/dns/resolve_context.h
@@ -206,7 +206,7 @@
     ~ServerStats();
 
     // Count of consecutive failures after last success.
-    int last_failure_count;
+    int last_failure_count = 0;
 
     // True if any success has ever been recorded for this server for the
     // current connection.
diff --git a/net/dns/serial_worker.cc b/net/dns/serial_worker.cc
index 5a3444b7f..ee0a6c3 100644
--- a/net/dns/serial_worker.cc
+++ b/net/dns/serial_worker.cc
@@ -49,8 +49,7 @@
 
 SerialWorker::SerialWorker(int max_number_of_retries,
                            const net::BackoffEntry::Policy* backoff_policy)
-    : state_(State::kIdle),
-      max_number_of_retries_(max_number_of_retries),
+    : max_number_of_retries_(max_number_of_retries),
       backoff_entry_(backoff_policy ? backoff_policy : &kDefaultBackoffPolicy) {
 }
 
diff --git a/net/dns/serial_worker.h b/net/dns/serial_worker.h
index b7076be..c226fe6 100644
--- a/net/dns/serial_worker.h
+++ b/net/dns/serial_worker.h
@@ -117,7 +117,7 @@
 
   void RerunWork(std::unique_ptr<WorkItem> work_item);
 
-  State state_;
+  State state_ = State::kIdle;
 
   // Max retries and backoff entry to control timing.
   const int max_number_of_retries_;
diff --git a/net/dns/serial_worker_unittest.cc b/net/dns/serial_worker_unittest.cc
index e04b0f1..d5e7e7f 100644
--- a/net/dns/serial_worker_unittest.cc
+++ b/net/dns/serial_worker_unittest.cc
@@ -168,8 +168,7 @@
         work_allowed_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
                       base::WaitableEvent::InitialState::NOT_SIGNALED),
         work_called_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
-                     base::WaitableEvent::InitialState::NOT_SIGNALED),
-        work_running_(false) {}
+                     base::WaitableEvent::InitialState::NOT_SIGNALED) {}
 
   // Helpers for tests.
 
@@ -212,7 +211,7 @@
   base::WaitableEvent work_called_;
 
   // Protected by read_lock_. Used to verify that read calls are serialized.
-  bool work_running_;
+  bool work_running_ = false;
   base::Lock work_lock_;
 
   int work_finished_calls_ = 0;
diff --git a/net/extras/preload_data/decoder.cc b/net/extras/preload_data/decoder.cc
index 6fa8122..3db5c680 100644
--- a/net/extras/preload_data/decoder.cc
+++ b/net/extras/preload_data/decoder.cc
@@ -11,11 +11,7 @@
 namespace extras {
 
 PreloadDecoder::BitReader::BitReader(const uint8_t* bytes, size_t num_bits)
-    : bytes_(bytes),
-      num_bits_(num_bits),
-      num_bytes_((num_bits + 7) / 8),
-      current_byte_index_(0),
-      num_bits_used_(8) {}
+    : bytes_(bytes), num_bits_(num_bits), num_bytes_((num_bits + 7) / 8) {}
 
 // Next sets |*out| to the next bit from the input. It returns false if no
 // more bits are available or true otherwise.
diff --git a/net/extras/preload_data/decoder.h b/net/extras/preload_data/decoder.h
index 84fa144..b6076ac 100644
--- a/net/extras/preload_data/decoder.h
+++ b/net/extras/preload_data/decoder.h
@@ -79,12 +79,12 @@
     const size_t num_bits_;
     const size_t num_bytes_;
     // current_byte_index_ contains the current byte offset in |bytes_|.
-    size_t current_byte_index_;
+    size_t current_byte_index_ = 0;
     // current_byte_ contains the current byte of the input.
     uint8_t current_byte_;
     // num_bits_used_ contains the number of bits of |current_byte_| that have
     // been read.
-    unsigned num_bits_used_;
+    unsigned num_bits_used_ = 8;
   };
 
   // HuffmanDecoder is a very simple Huffman reader. The input Huffman tree is
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store.cc b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
index 058bae6e..945082c 100644
--- a/net/extras/sqlite/sqlite_persistent_cookie_store.cc
+++ b/net/extras/sqlite/sqlite_persistent_cookie_store.cc
@@ -263,10 +263,7 @@
                                          kCompatibleVersionNumber,
                                          std::move(background_task_runner),
                                          std::move(client_task_runner)),
-        num_pending_(0),
         restore_old_session_cookies_(restore_old_session_cookies),
-        num_priority_waiting_(0),
-        total_priority_requests_(0),
         crypto_(crypto_delegate) {}
 
   Backend(const Backend&) = delete;
@@ -401,7 +398,7 @@
   typedef std::map<CanonicalCookie::UniqueCookieKey, PendingOperationsForKey>
       PendingOperationsMap;
   PendingOperationsMap pending_ GUARDED_BY(lock_);
-  PendingOperationsMap::size_type num_pending_ GUARDED_BY(lock_);
+  PendingOperationsMap::size_type num_pending_ GUARDED_BY(lock_) = 0;
   // Guard |cookies_|, |pending_|, |num_pending_|.
   base::Lock lock_;
 
@@ -423,9 +420,9 @@
   // Guards the following metrics-related properties (only accessed when
   // starting/completing priority loads or completing the total load).
   base::Lock metrics_lock_;
-  int num_priority_waiting_ GUARDED_BY(metrics_lock_);
+  int num_priority_waiting_ GUARDED_BY(metrics_lock_) = 0;
   // The total number of priority requests.
-  int total_priority_requests_ GUARDED_BY(metrics_lock_);
+  int total_priority_requests_ GUARDED_BY(metrics_lock_) = 0;
   // The time when |num_priority_waiting_| incremented to 1.
   base::Time current_priority_wait_start_ GUARDED_BY(metrics_lock_);
   // The cumulative duration of time when |num_priority_waiting_| was greater
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc b/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc
index e48be61..f4e67841 100644
--- a/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc
+++ b/net/extras/sqlite/sqlite_persistent_cookie_store_perftest.cc
@@ -58,8 +58,7 @@
 class SQLitePersistentCookieStorePerfTest : public testing::Test {
  public:
   SQLitePersistentCookieStorePerfTest()
-      : seed_multiple_(1),
-        test_start_(base::Time::Now()),
+      : test_start_(base::Time::Now()),
         loaded_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
                       base::WaitableEvent::InitialState::NOT_SIGNALED),
         key_loaded_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
@@ -146,7 +145,7 @@
   }
 
  protected:
-  int seed_multiple_;
+  int seed_multiple_ = 1;
   base::Time test_start_;
   base::test::TaskEnvironment task_environment_;
   const scoped_refptr<base::SequencedTaskRunner> background_task_runner_ =
diff --git a/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc b/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc
index bfe43d4d..6d6e470 100644
--- a/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc
+++ b/net/extras/sqlite/sqlite_persistent_cookie_store_unittest.cc
@@ -65,7 +65,7 @@
   bool DecryptString(const std::string& ciphertext,
                      std::string* plaintext) override;
 
-  bool should_encrypt_;
+  bool should_encrypt_ = true;
 
  private:
   std::unique_ptr<crypto::SymmetricKey> key_;
@@ -73,8 +73,7 @@
 };
 
 CookieCryptor::CookieCryptor()
-    : should_encrypt_(true),
-      key_(crypto::SymmetricKey::DeriveKeyFromPasswordUsingPbkdf2(
+    : key_(crypto::SymmetricKey::DeriveKeyFromPasswordUsingPbkdf2(
           crypto::SymmetricKey::AES,
           "password",
           "saltiest",
diff --git a/net/extras/sqlite/sqlite_persistent_reporting_and_nel_store.cc b/net/extras/sqlite/sqlite_persistent_reporting_and_nel_store.cc
index 21fca6e..e1fa9d9 100644
--- a/net/extras/sqlite/sqlite_persistent_reporting_and_nel_store.cc
+++ b/net/extras/sqlite/sqlite_persistent_reporting_and_nel_store.cc
@@ -144,8 +144,7 @@
             kCurrentVersionNumber,
             kCompatibleVersionNumber,
             background_task_runner,
-            client_task_runner),
-        num_pending_(0) {}
+            client_task_runner) {}
 
   Backend(const Backend&) = delete;
   Backend& operator=(const Backend&) = delete;
@@ -302,7 +301,7 @@
 
   // Total number of pending operations (may not match the sum of the number of
   // elements in the pending operations queues, due to operation coalescing).
-  size_t num_pending_ GUARDED_BY(lock_);
+  size_t num_pending_ GUARDED_BY(lock_) = 0;
 
   // Queue of pending operations pertaining to NEL policies, keyed on origin.
   QueueType<NetworkErrorLoggingService::NelPolicyKey, NelPolicyInfo>
diff --git a/net/extras/sqlite/sqlite_persistent_store_backend_base.cc b/net/extras/sqlite/sqlite_persistent_store_backend_base.cc
index 283d1a14..f7cc3a2 100644
--- a/net/extras/sqlite/sqlite_persistent_store_backend_base.cc
+++ b/net/extras/sqlite/sqlite_persistent_store_backend_base.cc
@@ -28,8 +28,6 @@
     scoped_refptr<base::SequencedTaskRunner> client_task_runner)
     : path_(path),
       histogram_tag_(std::move(histogram_tag)),
-      initialized_(false),
-      corruption_detected_(false),
       current_version_number_(current_version_number),
       compatible_version_number_(compatible_version_number),
       background_task_runner_(std::move(background_task_runner)),
diff --git a/net/extras/sqlite/sqlite_persistent_store_backend_base.h b/net/extras/sqlite/sqlite_persistent_store_backend_base.h
index 09c8374..9f391f2 100644
--- a/net/extras/sqlite/sqlite_persistent_store_backend_base.h
+++ b/net/extras/sqlite/sqlite_persistent_store_backend_base.h
@@ -174,10 +174,10 @@
   const std::string histogram_tag_;
 
   // Whether the database has been initialized.
-  bool initialized_;
+  bool initialized_ = false;
 
   // Whether the KillDatabase callback has been scheduled.
-  bool corruption_detected_;
+  bool corruption_detected_ = false;
 
   // Current version number of the database. Must be greater than 0.
   const int current_version_number_;
diff --git a/net/filter/brotli_source_stream.cc b/net/filter/brotli_source_stream.cc
index 8adf3bf..5e708779 100644
--- a/net/filter/brotli_source_stream.cc
+++ b/net/filter/brotli_source_stream.cc
@@ -23,12 +23,7 @@
 class BrotliSourceStream : public FilterSourceStream {
  public:
   explicit BrotliSourceStream(std::unique_ptr<SourceStream> upstream)
-      : FilterSourceStream(SourceStream::TYPE_BROTLI, std::move(upstream)),
-        decoding_status_(DecodingStatus::DECODING_IN_PROGRESS),
-        used_memory_(0),
-        used_memory_maximum_(0),
-        consumed_bytes_(0),
-        produced_bytes_(0) {
+      : FilterSourceStream(SourceStream::TYPE_BROTLI, std::move(upstream)) {
     brotli_state_ =
         BrotliDecoderCreateInstance(AllocateMemory, FreeMemory, this);
     CHECK(brotli_state_);
@@ -169,12 +164,12 @@
 
   raw_ptr<BrotliDecoderState> brotli_state_;
 
-  DecodingStatus decoding_status_;
+  DecodingStatus decoding_status_ = DecodingStatus::DECODING_IN_PROGRESS;
 
-  size_t used_memory_;
-  size_t used_memory_maximum_;
-  size_t consumed_bytes_;
-  size_t produced_bytes_;
+  size_t used_memory_ = 0;
+  size_t used_memory_maximum_ = 0;
+  size_t consumed_bytes_ = 0;
+  size_t produced_bytes_ = 0;
 };
 
 }  // namespace
diff --git a/net/filter/filter_source_stream.cc b/net/filter/filter_source_stream.cc
index 6691053f..f3b00880 100644
--- a/net/filter/filter_source_stream.cc
+++ b/net/filter/filter_source_stream.cc
@@ -30,11 +30,7 @@
 
 FilterSourceStream::FilterSourceStream(SourceType type,
                                        std::unique_ptr<SourceStream> upstream)
-    : SourceStream(type),
-      upstream_(std::move(upstream)),
-      next_state_(STATE_NONE),
-      output_buffer_size_(0),
-      upstream_end_reached_(false) {
+    : SourceStream(type), upstream_(std::move(upstream)) {
   DCHECK(upstream_);
 }
 
diff --git a/net/filter/filter_source_stream.h b/net/filter/filter_source_stream.h
index a62509e..6450a55f 100644
--- a/net/filter/filter_source_stream.h
+++ b/net/filter/filter_source_stream.h
@@ -97,7 +97,7 @@
   // |upstream_| to |this_|.
   std::unique_ptr<SourceStream> upstream_;
 
-  State next_state_;
+  State next_state_ = STATE_NONE;
 
   // Buffer for reading data out of |upstream_| and then for use by |this|
   // before the filtered data is returned through Read().
@@ -110,11 +110,11 @@
 
   // Not null if there is a pending Read.
   scoped_refptr<IOBuffer> output_buffer_;
-  int output_buffer_size_;
+  int output_buffer_size_ = 0;
   CompletionOnceCallback callback_;
 
   // Reading from |upstream_| has returned 0 byte or an error code.
-  bool upstream_end_reached_;
+  bool upstream_end_reached_ = false;
 };
 
 }  // namespace net
diff --git a/net/filter/filter_source_stream_unittest.cc b/net/filter/filter_source_stream_unittest.cc
index f21fc96..bba8fab 100644
--- a/net/filter/filter_source_stream_unittest.cc
+++ b/net/filter/filter_source_stream_unittest.cc
@@ -177,8 +177,7 @@
   NoOutputSourceStream(std::unique_ptr<SourceStream> upstream,
                        size_t expected_input_size)
       : TestFilterSourceStreamBase(std::move(upstream)),
-        expected_input_size_(expected_input_size),
-        consumed_all_input_(false) {}
+        expected_input_size_(expected_input_size) {}
 
   NoOutputSourceStream(const NoOutputSourceStream&) = delete;
   NoOutputSourceStream& operator=(const NoOutputSourceStream&) = delete;
@@ -201,7 +200,7 @@
  private:
   // Expected remaining bytes to be received from |upstream|.
   int expected_input_size_;
-  bool consumed_all_input_;
+  bool consumed_all_input_ = false;
 };
 
 // A FilterSourceStream return an error code in FilterData().
diff --git a/net/filter/gzip_source_stream.cc b/net/filter/gzip_source_stream.cc
index 32b89e2..e68bd1a 100644
--- a/net/filter/gzip_source_stream.cc
+++ b/net/filter/gzip_source_stream.cc
@@ -53,10 +53,7 @@
 
 GzipSourceStream::GzipSourceStream(std::unique_ptr<SourceStream> upstream,
                                    SourceStream::SourceType type)
-    : FilterSourceStream(type, std::move(upstream)),
-      gzip_footer_bytes_left_(0),
-      input_state_(STATE_START),
-      replay_state_(STATE_COMPRESSED_BODY) {}
+    : FilterSourceStream(type, std::move(upstream)) {}
 
 bool GzipSourceStream::Init() {
   zlib_stream_ = std::make_unique<z_stream>();
diff --git a/net/filter/gzip_source_stream.h b/net/filter/gzip_source_stream.h
index 5774d0a..80633e4 100644
--- a/net/filter/gzip_source_stream.h
+++ b/net/filter/gzip_source_stream.h
@@ -102,13 +102,13 @@
   GZipHeader gzip_header_;
 
   // Tracks how many bytes of gzip footer are yet to be filtered.
-  size_t gzip_footer_bytes_left_;
+  size_t gzip_footer_bytes_left_ = 0;
 
   // Tracks the state of the input stream.
-  InputState input_state_;
+  InputState input_state_ = STATE_START;
 
   // Used when replaying data.
-  InputState replay_state_;
+  InputState replay_state_ = STATE_COMPRESSED_BODY;
 };
 
 }  // namespace net
diff --git a/net/log/file_net_log_observer.cc b/net/log/file_net_log_observer.cc
index bde6ccc..f92b834 100644
--- a/net/log/file_net_log_observer.cc
+++ b/net/log/file_net_log_observer.cc
@@ -173,7 +173,7 @@
   // runner's local queue is swapped with the shared write queue.
   //
   // |lock_| must be acquired to read or write to this.
-  uint64_t memory_;
+  uint64_t memory_ = 0;
 
   // Indicates the maximum amount of memory that the |queue_| is allowed to
   // use.
@@ -317,7 +317,7 @@
 
   // Counter for the events file currently being written into. See
   // FileNumberToIndex() for an explanation of what "number" vs "index" mean.
-  size_t current_event_file_number_;
+  size_t current_event_file_number_ = 0;
 
   // Indicates the maximum size of each individual events file. May be kNoLimit
   // to indicate that it can grow arbitrarily large.
@@ -325,7 +325,7 @@
 
   // Whether any bytes were written for events. This is used to properly format
   // JSON (events list shouldn't end with a comma).
-  bool wrote_event_bytes_;
+  bool wrote_event_bytes_ = false;
 
   // Task runner for doing file operations.
   const scoped_refptr<base::SequencedTaskRunner> task_runner_;
@@ -516,7 +516,7 @@
 }
 
 FileNetLogObserver::WriteQueue::WriteQueue(uint64_t memory_max)
-    : memory_(0), memory_max_(memory_max) {}
+    : memory_max_(memory_max) {}
 
 size_t FileNetLogObserver::WriteQueue::AddEntryToQueue(
     std::unique_ptr<std::string> event) {
@@ -554,9 +554,7 @@
     : final_log_path_(log_path),
       inprogress_dir_path_(inprogress_dir_path),
       total_num_event_files_(total_num_event_files),
-      current_event_file_number_(0),
       max_event_file_size_(max_event_file_size),
-      wrote_event_bytes_(false),
       task_runner_(std::move(task_runner)) {
   DCHECK_EQ(pre_existing_log_file.has_value(), log_path.empty());
   DCHECK_EQ(IsBounded(), !inprogress_dir_path.empty());
diff --git a/net/log/net_log.cc b/net/log/net_log.cc
index dd76223..2bb696e 100644
--- a/net/log/net_log.cc
+++ b/net/log/net_log.cc
@@ -14,8 +14,7 @@
 
 namespace net {
 
-NetLog::ThreadSafeObserver::ThreadSafeObserver()
-    : capture_mode_(NetLogCaptureMode::kDefault), net_log_(nullptr) {}
+NetLog::ThreadSafeObserver::ThreadSafeObserver() : net_log_(nullptr) {}
 
 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 9a6fc19..a89dbc56 100644
--- a/net/log/net_log.h
+++ b/net/log/net_log.h
@@ -136,7 +136,7 @@
     friend class NetLog;
 
     // Both of these values are only modified by the NetLog.
-    NetLogCaptureMode capture_mode_;
+    NetLogCaptureMode capture_mode_ = NetLogCaptureMode::kDefault;
     raw_ptr<NetLog> net_log_;
   };
 
diff --git a/net/log/net_log_unittest.cc b/net/log/net_log_unittest.cc
index 7ef0ca73..b0de08e 100644
--- a/net/log/net_log_unittest.cc
+++ b/net/log/net_log_unittest.cc
@@ -186,7 +186,7 @@
 
 class CountingObserver : public NetLog::ThreadSafeObserver {
  public:
-  CountingObserver() : count_(0) {}
+  CountingObserver() = default;
 
   ~CountingObserver() override {
     if (net_log())
@@ -198,7 +198,7 @@
   int count() const { return count_; }
 
  private:
-  int count_;
+  int count_ = 0;
 };
 
 class LoggingObserver : public NetLog::ThreadSafeObserver {