diff --git a/engine/src/flutter/ci/licenses_golden/licenses_flutter b/engine/src/flutter/ci/licenses_golden/licenses_flutter index b350d564d67..8eb1d22d1ac 100644 --- a/engine/src/flutter/ci/licenses_golden/licenses_flutter +++ b/engine/src/flutter/ci/licenses_golden/licenses_flutter @@ -203,8 +203,6 @@ FILE: ../../../flutter/fml/synchronization/semaphore_unittest.cc FILE: ../../../flutter/fml/synchronization/shared_mutex.h FILE: ../../../flutter/fml/synchronization/shared_mutex_std.cc FILE: ../../../flutter/fml/synchronization/shared_mutex_std.h -FILE: ../../../flutter/fml/synchronization/thread_annotations.h -FILE: ../../../flutter/fml/synchronization/thread_annotations_unittest.cc FILE: ../../../flutter/fml/synchronization/waitable_event.cc FILE: ../../../flutter/fml/synchronization/waitable_event.h FILE: ../../../flutter/fml/synchronization/waitable_event_unittest.cc diff --git a/engine/src/flutter/fml/BUILD.gn b/engine/src/flutter/fml/BUILD.gn index 85b18692a24..bc66d236266 100644 --- a/engine/src/flutter/fml/BUILD.gn +++ b/engine/src/flutter/fml/BUILD.gn @@ -60,7 +60,6 @@ source_set("fml") { "synchronization/semaphore.cc", "synchronization/semaphore.h", "synchronization/shared_mutex.h", - "synchronization/thread_annotations.h", "synchronization/waitable_event.cc", "synchronization/waitable_event.h", "task_runner.cc", @@ -212,7 +211,6 @@ executable("fml_unittests") { "platform/darwin/string_range_sanitization_unittests.mm", "synchronization/count_down_latch_unittests.cc", "synchronization/semaphore_unittest.cc", - "synchronization/thread_annotations_unittest.cc", "synchronization/waitable_event_unittest.cc", "thread_local_unittests.cc", "thread_unittests.cc", diff --git a/engine/src/flutter/fml/concurrent_message_loop.h b/engine/src/flutter/fml/concurrent_message_loop.h index 0cfd85c90ec..1642c58d363 100644 --- a/engine/src/flutter/fml/concurrent_message_loop.h +++ b/engine/src/flutter/fml/concurrent_message_loop.h @@ -11,7 +11,6 @@ #include "flutter/fml/closure.h" #include "flutter/fml/macros.h" -#include "flutter/fml/synchronization/thread_annotations.h" namespace fml { diff --git a/engine/src/flutter/fml/message_loop_impl.h b/engine/src/flutter/fml/message_loop_impl.h index 3635e8b44b2..ef98bf5fa47 100644 --- a/engine/src/flutter/fml/message_loop_impl.h +++ b/engine/src/flutter/fml/message_loop_impl.h @@ -18,7 +18,6 @@ #include "flutter/fml/memory/ref_counted.h" #include "flutter/fml/message_loop.h" #include "flutter/fml/message_loop_task_queues.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/time/time_point.h" #include "flutter/fml/wakeable.h" diff --git a/engine/src/flutter/fml/message_loop_task_queues.h b/engine/src/flutter/fml/message_loop_task_queues.h index 3b047d8a926..249e09e6857 100644 --- a/engine/src/flutter/fml/message_loop_task_queues.h +++ b/engine/src/flutter/fml/message_loop_task_queues.h @@ -14,7 +14,6 @@ #include "flutter/fml/macros.h" #include "flutter/fml/memory/ref_counted.h" #include "flutter/fml/synchronization/shared_mutex.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/wakeable.h" namespace fml { @@ -146,8 +145,7 @@ class MessageLoopTaskQueues fml::TimePoint GetNextWakeTimeUnlocked(TaskQueueId queue_id) const; static std::mutex creation_mutex_; - static fml::RefPtr instance_ - FML_GUARDED_BY(creation_mutex_); + static fml::RefPtr instance_; std::unique_ptr queue_meta_mutex_; std::map> queue_entries_; diff --git a/engine/src/flutter/fml/message_loop_unittests.cc b/engine/src/flutter/fml/message_loop_unittests.cc index f5b55f1e591..6a64be53359 100644 --- a/engine/src/flutter/fml/message_loop_unittests.cc +++ b/engine/src/flutter/fml/message_loop_unittests.cc @@ -7,6 +7,7 @@ #include #include +#include "flutter/fml/build_config.h" #include "flutter/fml/concurrent_message_loop.h" #include "flutter/fml/message_loop.h" #include "flutter/fml/synchronization/count_down_latch.h" diff --git a/engine/src/flutter/fml/synchronization/thread_annotations.h b/engine/src/flutter/fml/synchronization/thread_annotations.h deleted file mode 100644 index f5ae885782b..00000000000 --- a/engine/src/flutter/fml/synchronization/thread_annotations.h +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Macros for static thread-safety analysis. -// -// These are from http://clang.llvm.org/docs/ThreadSafetyAnalysis.html (and thus -// really derive from google3's thread_annotations.h). -// -// TODO(vtl): We're still using the old-fashioned, deprecated annotations -// ("locks" instead of "capabilities"), since the new ones don't work yet (in -// particular, |TRY_ACQUIRE()| doesn't work: b/19264527). -// https://github.com/domokit/mojo/issues/314 - -#ifndef FLUTTER_FML_SYNCHRONIZATION_THREAD_ANNOTATIONS_H_ -#define FLUTTER_FML_SYNCHRONIZATION_THREAD_ANNOTATIONS_H_ - -#include "flutter/fml/build_config.h" - -// Enable thread-safety attributes only with clang. -// The attributes can be safely erased when compiling with other compilers. -#if defined(__clang__) && !defined(OS_ANDROID) -#define FML_THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) -#else -#define FML_THREAD_ANNOTATION_ATTRIBUTE__(x) -#endif - -#define FML_GUARDED_BY(x) FML_THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x)) - -#define FML_PT_GUARDED_BY(x) FML_THREAD_ANNOTATION_ATTRIBUTE__(pt_guarded_by(x)) - -#define FML_ACQUIRE(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(acquire_capability(__VA_ARGS__)) - -#define FML_RELEASE(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(release_capability(__VA_ARGS__)) - -#define FML_ACQUIRED_AFTER(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(acquired_after(__VA_ARGS__)) - -#define FML_ACQUIRED_BEFORE(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(acquired_before(__VA_ARGS__)) - -#define FML_EXCLUSIVE_LOCKS_REQUIRED(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_locks_required(__VA_ARGS__)) - -#define FML_SHARED_LOCKS_REQUIRED(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(shared_locks_required(__VA_ARGS__)) - -#define FML_LOCKS_EXCLUDED(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(locks_excluded(__VA_ARGS__)) - -#define FML_LOCK_RETURNED(x) FML_THREAD_ANNOTATION_ATTRIBUTE__(lock_returned(x)) - -#define FML_LOCKABLE FML_THREAD_ANNOTATION_ATTRIBUTE__(lockable) - -#define FML_SCOPED_LOCKABLE FML_THREAD_ANNOTATION_ATTRIBUTE__(scoped_lockable) - -#define FML_EXCLUSIVE_LOCK_FUNCTION(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_lock_function(__VA_ARGS__)) - -#define FML_SHARED_LOCK_FUNCTION(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(shared_lock_function(__VA_ARGS__)) - -#define FML_ASSERT_EXCLUSIVE_LOCK(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(assert_exclusive_lock(__VA_ARGS__)) - -#define FML_ASSERT_SHARED_LOCK(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(assert_shared_lock(__VA_ARGS__)) - -#define FML_EXCLUSIVE_TRYLOCK_FUNCTION(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(exclusive_trylock_function(__VA_ARGS__)) - -#define FML_SHARED_TRYLOCK_FUNCTION(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(shared_trylock_function(__VA_ARGS__)) - -#define FML_UNLOCK_FUNCTION(...) \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(unlock_function(__VA_ARGS__)) - -#define FML_NO_THREAD_SAFETY_ANALYSIS \ - FML_THREAD_ANNOTATION_ATTRIBUTE__(no_thread_safety_analysis) - -// Use this in the header to annotate a function/method as not being -// thread-safe. This is equivalent to |FML_NO_THREAD_SAFETY_ANALYSIS|, but -// semantically different: it declares that the caller must abide by additional -// restrictions. Limitation: Unfortunately, you can't apply this to a method in -// an interface (i.e., pure virtual method) and have it applied automatically to -// implementations. -#define FML_NOT_THREAD_SAFE FML_NO_THREAD_SAFETY_ANALYSIS - -#endif // FLUTTER_FML_SYNCHRONIZATION_THREAD_ANNOTATIONS_H_ diff --git a/engine/src/flutter/fml/synchronization/thread_annotations_unittest.cc b/engine/src/flutter/fml/synchronization/thread_annotations_unittest.cc deleted file mode 100644 index 7462614ba60..00000000000 --- a/engine/src/flutter/fml/synchronization/thread_annotations_unittest.cc +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2013 The Flutter Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Tests of the static thread annotation macros. These fall into two categories, -// positive tests (testing that correct code compiles and works) and negative -// tests (testing that incorrect code does not compile). -// -// Unfortunately, we don't have systematic/automated negative compilation tests. -// So instead we have some cheesy macros that you can define to enable -// individual compilation failures. - -#include "flutter/fml/synchronization/thread_annotations.h" - -#include - -#include "flutter/fml/macros.h" -#include "gtest/gtest.h" - -// Uncomment these to enable particular compilation failure tests. -// #define NC_GUARDED_BY -// TODO(vtl): |ACQUIRED_{BEFORE,AFTER}()| are currently unimplemented in clang -// as of 2015-07-06 ("To be fixed in a future update."). So this actually -// compiles! -// #define NC_ACQUIRED_BEFORE - -namespace fml { -namespace { - -// Test FML_GUARDED_BY --------------------------------------------------------- - -class GuardedByClass { - public: - GuardedByClass() : x_() {} - ~GuardedByClass() {} - - void GoodSet(int x) { - mu_.lock(); - x_ = x; - mu_.unlock(); - } - -#ifdef NC_GUARDED_BY - void BadSet(int x) { x_ = x; } -#endif - - private: - std::mutex mu_; - int x_ FML_GUARDED_BY(mu_); - - FML_DISALLOW_COPY_AND_ASSIGN(GuardedByClass); -}; - -TEST(ThreadAnnotationsTest, GuardedBy) { - GuardedByClass c; - c.GoodSet(123); -} - -// Test FML_ACQUIRED_BEFORE ---------------------------------------------------- - -class AcquiredBeforeClass2; - -class AcquiredBeforeClass1 { - public: - AcquiredBeforeClass1() {} - ~AcquiredBeforeClass1() {} - - void NoOp() { - mu_.lock(); - mu_.unlock(); - } - -#ifdef NC_ACQUIRED_BEFORE - void BadMethod(AcquiredBeforeClass2* c2); -#endif - - private: - friend class AcquiredBeforeClass2; - - std::mutex mu_; - - FML_DISALLOW_COPY_AND_ASSIGN(AcquiredBeforeClass1); -}; - -class AcquiredBeforeClass2 { - public: - AcquiredBeforeClass2() {} - ~AcquiredBeforeClass2() {} - - void NoOp() { - mu_.lock(); - mu_.unlock(); - } - - void GoodMethod(AcquiredBeforeClass1* c1) { - mu_.lock(); - c1->NoOp(); - mu_.unlock(); - } - - private: - std::mutex mu_ FML_ACQUIRED_BEFORE(AcquiredBeforeClass1::mu_); - - FML_DISALLOW_COPY_AND_ASSIGN(AcquiredBeforeClass2); -}; - -#ifdef NC_ACQUIRED_BEFORE -void AcquiredBeforeClass1::BadMethod(AcquiredBeforeClass2* c2) { - mu_.lock(); - c2->NoOp(); - mu_.unlock(); -} -#endif - -TEST(ThreadAnnotationsTest, AcquiredBefore) { - AcquiredBeforeClass1 c1; - AcquiredBeforeClass2 c2; - c2.GoodMethod(&c1); -#ifdef NC_ACQUIRED_BEFORE - c1.BadMethod(&c2); -#endif -} - -// TODO(vtl): Test more things. - -} // namespace -} // namespace fml diff --git a/engine/src/flutter/fml/synchronization/waitable_event.cc b/engine/src/flutter/fml/synchronization/waitable_event.cc index 2cc272ef74a..abc597c2ded 100644 --- a/engine/src/flutter/fml/synchronization/waitable_event.cc +++ b/engine/src/flutter/fml/synchronization/waitable_event.cc @@ -150,7 +150,7 @@ bool ManualResetWaitableEvent::WaitWithTimeout(TimeDelta timeout) { // holding |mutex_|. bool rv = WaitWithTimeoutImpl( &locker, &cv_, - [this, last_signal_id]() FML_NO_THREAD_SAFETY_ANALYSIS { + [this, last_signal_id]() { // Also check |signaled_| in case we're already signaled. return signaled_ || signal_id_ != last_signal_id; }, diff --git a/engine/src/flutter/fml/synchronization/waitable_event.h b/engine/src/flutter/fml/synchronization/waitable_event.h index 0a6c81b6473..9a16618301c 100644 --- a/engine/src/flutter/fml/synchronization/waitable_event.h +++ b/engine/src/flutter/fml/synchronization/waitable_event.h @@ -14,7 +14,6 @@ #include #include "flutter/fml/macros.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/time/time_delta.h" namespace fml { diff --git a/engine/src/flutter/lib/ui/isolate_name_server/isolate_name_server.h b/engine/src/flutter/lib/ui/isolate_name_server/isolate_name_server.h index ac840118cc5..22594cfb616 100644 --- a/engine/src/flutter/lib/ui/isolate_name_server/isolate_name_server.h +++ b/engine/src/flutter/lib/ui/isolate_name_server/isolate_name_server.h @@ -10,7 +10,6 @@ #include #include "flutter/fml/macros.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "third_party/dart/runtime/include/dart_api.h" namespace flutter { @@ -23,25 +22,21 @@ class IsolateNameServer { // Looks up the Dart_Port associated with a given name. Returns ILLEGAL_PORT // if the name does not exist. - Dart_Port LookupIsolatePortByName(const std::string& name) - FML_LOCKS_EXCLUDED(mutex_); + Dart_Port LookupIsolatePortByName(const std::string& name); // Registers a Dart_Port with a given name. Returns true if registration is // successful, false if the name entry already exists. - bool RegisterIsolatePortWithName(Dart_Port port, const std::string& name) - FML_LOCKS_EXCLUDED(mutex_); + bool RegisterIsolatePortWithName(Dart_Port port, const std::string& name); // Removes a name to Dart_Port mapping given a name. Returns true if the // mapping was successfully removed, false if the mapping does not exist. - bool RemoveIsolateNameMapping(const std::string& name) - FML_LOCKS_EXCLUDED(mutex_); + bool RemoveIsolateNameMapping(const std::string& name); private: - Dart_Port LookupIsolatePortByNameUnprotected(const std::string& name) - FML_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + Dart_Port LookupIsolatePortByNameUnprotected(const std::string& name); mutable std::mutex mutex_; - std::map port_mapping_ FML_GUARDED_BY(mutex_); + std::map port_mapping_; FML_DISALLOW_COPY_AND_ASSIGN(IsolateNameServer); }; diff --git a/engine/src/flutter/lib/ui/plugins/callback_cache.h b/engine/src/flutter/lib/ui/plugins/callback_cache.h index bbcb8d2af10..d102888b99c 100644 --- a/engine/src/flutter/lib/ui/plugins/callback_cache.h +++ b/engine/src/flutter/lib/ui/plugins/callback_cache.h @@ -11,7 +11,6 @@ #include #include "flutter/fml/macros.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "third_party/dart/runtime/include/dart_api.h" namespace flutter { @@ -29,28 +28,26 @@ class DartCallbackCache { static int64_t GetCallbackHandle(const std::string& name, const std::string& class_name, - const std::string& library_path) - FML_LOCKS_EXCLUDED(mutex_); + const std::string& library_path); - static Dart_Handle GetCallback(int64_t handle) FML_LOCKS_EXCLUDED(mutex_); + static Dart_Handle GetCallback(int64_t handle); static std::unique_ptr GetCallbackInformation( - int64_t handle) FML_LOCKS_EXCLUDED(mutex_); + int64_t handle); - static void LoadCacheFromDisk() FML_LOCKS_EXCLUDED(mutex_); + static void LoadCacheFromDisk(); private: static Dart_Handle LookupDartClosure(const std::string& name, const std::string& class_name, const std::string& library_path); - static void SaveCacheToDisk() FML_EXCLUSIVE_LOCKS_REQUIRED(mutex_); + static void SaveCacheToDisk(); static std::mutex mutex_; static std::string cache_path_; - static std::map cache_ - FML_GUARDED_BY(mutex_); + static std::map cache_; FML_DISALLOW_IMPLICIT_CONSTRUCTORS(DartCallbackCache); }; diff --git a/engine/src/flutter/runtime/dart_service_isolate.cc b/engine/src/flutter/runtime/dart_service_isolate.cc index 2a143de3729..1d747a35ade 100644 --- a/engine/src/flutter/runtime/dart_service_isolate.cc +++ b/engine/src/flutter/runtime/dart_service_isolate.cc @@ -50,7 +50,6 @@ const uint8_t* GetSymbol(Dart_NativeFunction native_function) { std::mutex DartServiceIsolate::callbacks_mutex_; -FML_GUARDED_BY(DartServiceIsolate::callbacks_mutex_) std::set> DartServiceIsolate::callbacks_; diff --git a/engine/src/flutter/runtime/dart_service_isolate.h b/engine/src/flutter/runtime/dart_service_isolate.h index 10ff16192e8..dae06887044 100644 --- a/engine/src/flutter/runtime/dart_service_isolate.h +++ b/engine/src/flutter/runtime/dart_service_isolate.h @@ -11,7 +11,6 @@ #include #include "flutter/fml/compiler_specific.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "third_party/dart/runtime/include/dart_api.h" @@ -46,8 +45,7 @@ class DartServiceIsolate { static void Shutdown(Dart_NativeArguments args); static std::mutex callbacks_mutex_; - static std::set> callbacks_ - FML_GUARDED_BY(callbacks_mutex_); + static std::set> callbacks_; }; } // namespace flutter diff --git a/engine/src/flutter/runtime/dart_vm.cc b/engine/src/flutter/runtime/dart_vm.cc index 55d081a1893..37f8e690f73 100644 --- a/engine/src/flutter/runtime/dart_vm.cc +++ b/engine/src/flutter/runtime/dart_vm.cc @@ -17,7 +17,6 @@ #include "flutter/fml/mapping.h" #include "flutter/fml/size.h" #include "flutter/fml/synchronization/count_down_latch.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/time/time_delta.h" #include "flutter/fml/trace_event.h" #include "flutter/lib/io/dart_io.h" diff --git a/engine/src/flutter/runtime/dart_vm_lifecycle.cc b/engine/src/flutter/runtime/dart_vm_lifecycle.cc index cb2f13634c3..717a0546a28 100644 --- a/engine/src/flutter/runtime/dart_vm_lifecycle.cc +++ b/engine/src/flutter/runtime/dart_vm_lifecycle.cc @@ -12,8 +12,8 @@ namespace flutter { // critical section. All accesses (not just const members) to the global VM // object weak pointer are behind this mutex. static std::mutex gVMMutex; -static std::weak_ptr gVM FML_GUARDED_BY(gVMMutex); -static std::shared_ptr* gVMLeak FML_GUARDED_BY(gVMMutex); +static std::weak_ptr gVM; +static std::shared_ptr* gVMLeak; // We are going to be modifying more than just the control blocks of the // following weak pointers (in the |Create| case where an old VM could not be @@ -21,12 +21,9 @@ static std::shared_ptr* gVMLeak FML_GUARDED_BY(gVMMutex); // but that is only available since C++20. We don't expect contention on these // locks so we just use one mutex for all. static std::mutex gVMDependentsMutex; -static std::weak_ptr gVMData - FML_GUARDED_BY(gVMDependentsMutex); -static std::weak_ptr gVMServiceProtocol - FML_GUARDED_BY(gVMDependentsMutex); -static std::weak_ptr gVMIsolateNameServer - FML_GUARDED_BY(gVMDependentsMutex); +static std::weak_ptr gVMData; +static std::weak_ptr gVMServiceProtocol; +static std::weak_ptr gVMIsolateNameServer; DartVMRef::DartVMRef(std::shared_ptr vm) : vm_(vm) {} diff --git a/engine/src/flutter/runtime/service_protocol.h b/engine/src/flutter/runtime/service_protocol.h index 8f3f238b3e3..e0ecc2e1db5 100644 --- a/engine/src/flutter/runtime/service_protocol.h +++ b/engine/src/flutter/runtime/service_protocol.h @@ -14,7 +14,6 @@ #include "flutter/fml/macros.h" #include "flutter/fml/synchronization/atomic_object.h" #include "flutter/fml/synchronization/shared_mutex.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/task_runner.h" #include "rapidjson/document.h" diff --git a/engine/src/flutter/shell/common/persistent_cache.h b/engine/src/flutter/shell/common/persistent_cache.h index a01368cb498..35d8f08f859 100644 --- a/engine/src/flutter/shell/common/persistent_cache.h +++ b/engine/src/flutter/shell/common/persistent_cache.h @@ -10,7 +10,6 @@ #include #include "flutter/fml/macros.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/task_runner.h" #include "flutter/fml/unique_fd.h" #include "third_party/skia/include/gpu/GrContextOptions.h" @@ -66,8 +65,7 @@ class PersistentCache : public GrContextOptions::PersistentCache { static std::string cache_base_path_; static std::mutex instance_mutex_; - static std::unique_ptr gPersistentCache - FML_GUARDED_BY(instance_mutex_); + static std::unique_ptr gPersistentCache; // Mutable static switch that can be set before GetCacheForProcess is called // and GrContextOptions.fShaderCacheStrategy is set. If true, it means that @@ -83,8 +81,7 @@ class PersistentCache : public GrContextOptions::PersistentCache { const std::shared_ptr cache_directory_; const std::shared_ptr sksl_cache_directory_; mutable std::mutex worker_task_runners_mutex_; - std::multiset> worker_task_runners_ - FML_GUARDED_BY(worker_task_runners_mutex_); + std::multiset> worker_task_runners_; bool stored_new_shaders_ = false; bool is_dumping_skp_ = false; diff --git a/engine/src/flutter/shell/common/shell.h b/engine/src/flutter/shell/common/shell.h index 430a4bda17c..c6753912771 100644 --- a/engine/src/flutter/shell/common/shell.h +++ b/engine/src/flutter/shell/common/shell.h @@ -18,7 +18,6 @@ #include "flutter/fml/memory/thread_checker.h" #include "flutter/fml/memory/weak_ptr.h" #include "flutter/fml/status.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/synchronization/waitable_event.h" #include "flutter/fml/thread.h" #include "flutter/lib/ui/semantics/custom_accessibility_action.h" diff --git a/engine/src/flutter/shell/common/shell_test.h b/engine/src/flutter/shell/common/shell_test.h index 794c499a84b..e1671263630 100644 --- a/engine/src/flutter/shell/common/shell_test.h +++ b/engine/src/flutter/shell/common/shell_test.h @@ -10,7 +10,6 @@ #include "flutter/common/settings.h" #include "flutter/flow/layers/container_layer.h" #include "flutter/fml/macros.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/lib/ui/window/platform_message.h" #include "flutter/shell/common/run_configuration.h" #include "flutter/shell/common/shell.h" @@ -101,8 +100,8 @@ class ShellTestVsyncClock { private: std::mutex mutex_; - std::vector> vsync_promised_ FML_GUARDED_BY(mutex_); - size_t vsync_issued_ FML_GUARDED_BY(mutex_) = 0; + std::vector> vsync_promised_; + size_t vsync_issued_ = 0; }; class ShellTestVsyncWaiter : public VsyncWaiter { diff --git a/engine/src/flutter/shell/common/vsync_waiter.h b/engine/src/flutter/shell/common/vsync_waiter.h index e93b730fe7f..342ca0e5363 100644 --- a/engine/src/flutter/shell/common/vsync_waiter.h +++ b/engine/src/flutter/shell/common/vsync_waiter.h @@ -10,7 +10,6 @@ #include #include "flutter/common/task_runners.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/time/time_point.h" namespace flutter { @@ -58,10 +57,10 @@ class VsyncWaiter : public std::enable_shared_from_this { private: std::mutex callback_mutex_; - Callback callback_ FML_GUARDED_BY(callback_mutex_); + Callback callback_; std::mutex secondary_callback_mutex_; - fml::closure secondary_callback_ FML_GUARDED_BY(callback_mutex_); + fml::closure secondary_callback_; FML_DISALLOW_COPY_AND_ASSIGN(VsyncWaiter); }; diff --git a/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.h b/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.h index 5e1e581a3a9..d4cc7b8c519 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.h +++ b/engine/src/flutter/shell/platform/darwin/ios/platform_view_ios.h @@ -66,7 +66,7 @@ class PlatformViewIOS final : public PlatformView { // Since the `ios_surface_` is created on the platform thread but // used on the GPU thread we need to protect it with a mutex. std::mutex ios_surface_mutex_; - std::unique_ptr ios_surface_ FML_GUARDED_BY(ios_surface_mutex_); + std::unique_ptr ios_surface_; std::shared_ptr gl_context_; PlatformMessageRouter platform_message_router_; std::unique_ptr accessibility_bridge_; diff --git a/engine/src/flutter/shell/platform/embedder/embedder_task_runner.h b/engine/src/flutter/shell/platform/embedder/embedder_task_runner.h index 9c2a4292d52..79cc52cfe8d 100644 --- a/engine/src/flutter/shell/platform/embedder/embedder_task_runner.h +++ b/engine/src/flutter/shell/platform/embedder/embedder_task_runner.h @@ -9,7 +9,6 @@ #include #include "flutter/fml/macros.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "flutter/fml/task_runner.h" namespace flutter { @@ -76,9 +75,8 @@ class EmbedderTaskRunner final : public fml::TaskRunner { const size_t embedder_identifier_; DispatchTable dispatch_table_; std::mutex tasks_mutex_; - uint64_t last_baton_ FML_GUARDED_BY(tasks_mutex_); - std::unordered_map pending_tasks_ - FML_GUARDED_BY(tasks_mutex_); + uint64_t last_baton_; + std::unordered_map pending_tasks_; fml::TaskQueueId placeholder_id_; // |fml::TaskRunner| diff --git a/engine/src/flutter/testing/test_dart_native_resolver.cc b/engine/src/flutter/testing/test_dart_native_resolver.cc index e57b0c1be6f..b8a8f76963f 100644 --- a/engine/src/flutter/testing/test_dart_native_resolver.cc +++ b/engine/src/flutter/testing/test_dart_native_resolver.cc @@ -8,7 +8,6 @@ #include #include "flutter/fml/logging.h" -#include "flutter/fml/synchronization/thread_annotations.h" #include "third_party/tonic/logging/dart_error.h" #include "tonic/converter/dart_converter.h" @@ -36,7 +35,7 @@ Dart_NativeFunction TestDartNativeResolver::ResolveCallback( static std::mutex gIsolateResolversMutex; static std::map> - gIsolateResolvers FML_GUARDED_BY(gIsolateResolversMutex); + gIsolateResolvers; Dart_NativeFunction TestDartNativeResolver::DartNativeEntryResolverCallback( Dart_Handle dart_name,