From 3cd830c93dad30ffc1382c486e972442830b87ce Mon Sep 17 00:00:00 2001 From: Matan Lurey Date: Mon, 13 Nov 2023 14:52:51 -0800 Subject: [PATCH] Make `fml/...` compatible with `.clang_tidy`. (#47992) Work towards https://github.com/flutter/flutter/issues/134969. All changes were made automatically (i.e. with `--fix`). --- fml/memory/ref_counted_internal.h | 3 +-- fml/memory/weak_ptr_internal.h | 2 +- fml/message_loop_task_queues.h | 2 +- fml/platform/android/message_loop_android.h | 2 +- fml/shared_thread_merger.h | 2 +- fml/synchronization/semaphore.cc | 10 +++++----- fml/synchronization/semaphore.h | 2 +- 7 files changed, 11 insertions(+), 12 deletions(-) diff --git a/fml/memory/ref_counted_internal.h b/fml/memory/ref_counted_internal.h index 47bda01005ef9..95f9e6fe75d63 100644 --- a/fml/memory/ref_counted_internal.h +++ b/fml/memory/ref_counted_internal.h @@ -87,8 +87,7 @@ inline RefCountedThreadSafeBase::RefCountedThreadSafeBase() : ref_count_(1u) #ifndef NDEBUG , - adoption_required_(true), - destruction_started_(false) + adoption_required_(true) #endif { } diff --git a/fml/memory/weak_ptr_internal.h b/fml/memory/weak_ptr_internal.h index 28d1fca6d4f57..d94ce7c6fa588 100644 --- a/fml/memory/weak_ptr_internal.h +++ b/fml/memory/weak_ptr_internal.h @@ -30,7 +30,7 @@ class WeakPtrFlag : public fml::RefCountedThreadSafe { void Invalidate(); private: - bool is_valid_; + bool is_valid_ = false; FML_DISALLOW_COPY_AND_ASSIGN(WeakPtrFlag); }; diff --git a/fml/message_loop_task_queues.h b/fml/message_loop_task_queues.h index ba464493952c0..b3c9a63314af6 100644 --- a/fml/message_loop_task_queues.h +++ b/fml/message_loop_task_queues.h @@ -155,7 +155,7 @@ class MessageLoopTaskQueues { mutable std::mutex queue_mutex_; std::map> queue_entries_; - size_t task_queue_id_counter_; + size_t task_queue_id_counter_ = 0; std::atomic_int order_; diff --git a/fml/platform/android/message_loop_android.h b/fml/platform/android/message_loop_android.h index 6ff26be0fd373..a1bdad38a3840 100644 --- a/fml/platform/android/message_loop_android.h +++ b/fml/platform/android/message_loop_android.h @@ -29,7 +29,7 @@ class MessageLoopAndroid : public MessageLoopImpl { private: fml::UniqueObject looper_; fml::UniqueFD timer_fd_; - bool running_; + bool running_ = false; MessageLoopAndroid(); diff --git a/fml/shared_thread_merger.h b/fml/shared_thread_merger.h index 3f8ae9a6367f8..ed361edb7f062 100644 --- a/fml/shared_thread_merger.h +++ b/fml/shared_thread_merger.h @@ -59,7 +59,7 @@ class SharedThreadMerger fml::TaskQueueId subsumed_; fml::MessageLoopTaskQueues* task_queues_; std::mutex mutex_; - bool enabled_; + bool enabled_ = false; /// The |MergeWithLease| or |ExtendLeaseTo| method will record the caller /// into this lease_term_by_caller_ map, |UnMergeNowIfLastOne| diff --git a/fml/synchronization/semaphore.cc b/fml/synchronization/semaphore.cc index 8ffaab76cac29..9746c19f21f97 100644 --- a/fml/synchronization/semaphore.cc +++ b/fml/synchronization/semaphore.cc @@ -170,24 +170,24 @@ class PlatformSemaphore { namespace fml { -Semaphore::Semaphore(uint32_t count) : _impl(new PlatformSemaphore(count)) {} +Semaphore::Semaphore(uint32_t count) : impl_(new PlatformSemaphore(count)) {} Semaphore::~Semaphore() = default; bool Semaphore::IsValid() const { - return _impl->IsValid(); + return impl_->IsValid(); } bool Semaphore::Wait() { - return _impl->Wait(); + return impl_->Wait(); } bool Semaphore::TryWait() { - return _impl->TryWait(); + return impl_->TryWait(); } void Semaphore::Signal() { - return _impl->Signal(); + return impl_->Signal(); } } // namespace fml diff --git a/fml/synchronization/semaphore.h b/fml/synchronization/semaphore.h index 38d1488d64870..1207f59a6f3d2 100644 --- a/fml/synchronization/semaphore.h +++ b/fml/synchronization/semaphore.h @@ -78,7 +78,7 @@ class Semaphore { void Signal(); private: - std::unique_ptr _impl; + std::unique_ptr impl_; FML_DISALLOW_COPY_AND_ASSIGN(Semaphore); };