Skip to content

Commit dbf10d8

Browse files
committed
Address more feedbacks
1 parent da80692 commit dbf10d8

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

Firestore/Source/Public/FirebaseFirestore/FIRCallbackWrapper.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
*/
1616

1717
#import <Foundation/Foundation.h>
18-
#import <memory>
18+
#include <memory>
19+
#include <vector>
1920

2021
namespace firebase {
2122
namespace firestore {
@@ -47,10 +48,15 @@ NS_SWIFT_SENDABLE
4748
NS_SWIFT_NAME(CallbackWrapper)
4849
@interface FIRCallbackWrapper : NSObject
4950

51+
// Note: Marking callbacks in callback-based APIs as `Sendable` can help prevent crashes when they
52+
// are invoked on a different thread than the one they were originally defined in. If this callback
53+
// is expected to be called on a different thread, it should be marked as `Sendable` to ensure
54+
// thread safety.
5055
+ (std::unique_ptr<core::EventListener<std::vector<api::PipelineResult>>>)
5156
wrapPipelineCallback:(std::shared_ptr<api::Firestore>)firestore
52-
completion:(void (^)(std::shared_ptr<std::vector<api::PipelineResult>> result,
53-
NSError *_Nullable error))completion
57+
completion:(void (^NS_SWIFT_SENDABLE)(
58+
std::shared_ptr<std::vector<api::PipelineResult>> result,
59+
NSError *_Nullable error))completion
5460
NS_SWIFT_NAME(wrapPipelineCallback(firestore:completion:));
5561

5662
@end

Firestore/Source/Public/FirebaseFirestore/FIRFirestore.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
#import <Foundation/Foundation.h>
18-
#import <memory>
18+
#include <memory>
1919

2020
#import "FIRListenerRegistration.h"
2121

Firestore/Source/Public/FirebaseFirestore/FIRQuery.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616

1717
#import <Foundation/Foundation.h>
18-
#import <memory>
1918

2019
#import "FIRFirestoreSource.h"
2120
#import "FIRListenerRegistration.h"

0 commit comments

Comments
 (0)