From dbf10d8d799e336cd67252155ffa051c64f9a3ef Mon Sep 17 00:00:00 2001 From: cherylEnkidu Date: Wed, 8 Jan 2025 12:54:07 -0500 Subject: [PATCH] Address more feedbacks --- .../Public/FirebaseFirestore/FIRCallbackWrapper.h | 12 +++++++++--- .../Source/Public/FirebaseFirestore/FIRFirestore.h | 2 +- Firestore/Source/Public/FirebaseFirestore/FIRQuery.h | 1 - 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Firestore/Source/Public/FirebaseFirestore/FIRCallbackWrapper.h b/Firestore/Source/Public/FirebaseFirestore/FIRCallbackWrapper.h index 25f8df2fa23..d5ae24f1602 100644 --- a/Firestore/Source/Public/FirebaseFirestore/FIRCallbackWrapper.h +++ b/Firestore/Source/Public/FirebaseFirestore/FIRCallbackWrapper.h @@ -15,7 +15,8 @@ */ #import -#import +#include +#include namespace firebase { namespace firestore { @@ -47,10 +48,15 @@ NS_SWIFT_SENDABLE NS_SWIFT_NAME(CallbackWrapper) @interface FIRCallbackWrapper : NSObject +// Note: Marking callbacks in callback-based APIs as `Sendable` can help prevent crashes when they +// are invoked on a different thread than the one they were originally defined in. If this callback +// is expected to be called on a different thread, it should be marked as `Sendable` to ensure +// thread safety. + (std::unique_ptr>>) wrapPipelineCallback:(std::shared_ptr)firestore - completion:(void (^)(std::shared_ptr> result, - NSError *_Nullable error))completion + completion:(void (^NS_SWIFT_SENDABLE)( + std::shared_ptr> result, + NSError *_Nullable error))completion NS_SWIFT_NAME(wrapPipelineCallback(firestore:completion:)); @end diff --git a/Firestore/Source/Public/FirebaseFirestore/FIRFirestore.h b/Firestore/Source/Public/FirebaseFirestore/FIRFirestore.h index 515b1882a9f..ca48b1b8f94 100644 --- a/Firestore/Source/Public/FirebaseFirestore/FIRFirestore.h +++ b/Firestore/Source/Public/FirebaseFirestore/FIRFirestore.h @@ -15,7 +15,7 @@ */ #import -#import +#include #import "FIRListenerRegistration.h" diff --git a/Firestore/Source/Public/FirebaseFirestore/FIRQuery.h b/Firestore/Source/Public/FirebaseFirestore/FIRQuery.h index 46f30beeab1..dad8bbd1eed 100644 --- a/Firestore/Source/Public/FirebaseFirestore/FIRQuery.h +++ b/Firestore/Source/Public/FirebaseFirestore/FIRQuery.h @@ -15,7 +15,6 @@ */ #import -#import #import "FIRFirestoreSource.h" #import "FIRListenerRegistration.h"