|
20 | 20 | #include <utility>
|
21 | 21 | #include <vector>
|
22 | 22 |
|
23 |
| -#include "Firestore/core/interfaceForSwift/api/Pipeline.h" |
24 |
| -#include "Firestore/core/interfaceForSwift/api/PipelineResult.h" |
| 23 | +#include "Firestore/core/src/api/pipeline.h" |
| 24 | +#include "Firestore/core/src/api/pipeline_result.h" |
25 | 25 | #include "Firestore/core/src/core/event_listener.h"
|
26 | 26 | #include "Firestore/core/src/util/error_apple.h"
|
27 | 27 | #include "Firestore/core/src/util/statusor.h"
|
|
34 | 34 |
|
35 | 35 | @implementation FIRCallbackWrapper
|
36 | 36 |
|
37 |
| -// In public Swift documentation for integrating Swift and C++, using raw pointers in C++ is |
38 |
| -// generally considered unsafe. However, during an experiment where the result was passed as a value |
39 |
| -// instead of a pointer, a double free error occurred. This issue could not be traced effectively |
40 |
| -// because the implementation resides within the Swift-C++ transition layer. In this specific use |
41 |
| -// case, the C++ OnEvent() scope is destroyed after the Swift callback has been destroyed. Due to |
42 |
| -// this ordering, using a raw pointer is a safe workaround for now. |
43 |
| -+ (PipelineSnapshotListener)wrapPipelineCallback:(std::shared_ptr<api::Firestore>)firestore |
44 |
| - completion:(void (^)(CppPipelineResult *_Nullable result, |
45 |
| - NSError *_Nullable error))completion { |
| 37 | +// In public Swift documentation for integrating Swift and C++, using raw |
| 38 | +// pointers in C++ is generally considered unsafe. However, during an experiment |
| 39 | +// where the result was passed as a value instead of a pointer, a double free |
| 40 | +// error occurred. This issue could not be traced effectively because the |
| 41 | +// implementation resides within the Swift-C++ transition layer. In this |
| 42 | +// specific use case, the C++ OnEvent() scope is destroyed after the Swift |
| 43 | +// callback has been destroyed. Due to this ordering, using a raw pointer is a |
| 44 | +// safe workaround for now. |
| 45 | ++ (PipelineSnapshotListener) |
| 46 | + wrapPipelineCallback:(std::shared_ptr<api::Firestore>)firestore |
| 47 | + completion:(void (^)(CppPipelineResult* _Nullable result, |
| 48 | + NSError* _Nullable error))completion { |
46 | 49 | class Converter : public EventListener<CppPipelineResult> {
|
47 | 50 | public:
|
48 |
| - explicit Converter(std::shared_ptr<api::Firestore> firestore, PipelineBlock completion) |
| 51 | + explicit Converter(std::shared_ptr<api::Firestore> firestore, |
| 52 | + PipelineBlock completion) |
49 | 53 | : firestore_(firestore), completion_(completion) {
|
50 | 54 | }
|
51 | 55 |
|
|
0 commit comments