* Manual Xcode project fixups
* Remove `firebase/firestore` from paths in Firestore/core
This renames all Firestore files under `Firestore/core` to remove the
interior `firebase/firestore` directory structure. This is motivated by
build failures under Windows where the filenames of intermediates were
too long.
Concretely:
* `Firebase/core/src/firebase/firestore` becomes `Firebase/core/src`
* `Firebase/core/test/firebase/firestore` becomes
`Firebase/core/test/unit`
Moving the tests into a `unit` subdirectory aligns Firestore with the
directory structure in
[AddNewPod](https://github.com/firebase/firebase-ios-sdk/blob/master/AddNewPod.md),
modified for C++ (see discussion in #3224).
After this PR is merged, the Objective-C serializers can be completely removed from the project. Also, this PR changes the `Message` class quite a bit; it's probably in its final form now.
I did some performance testing locally and came to the conclusion that replacing Objective-C serializers with their C++ versions brings no performance downgrade; actually, there seems to be a very slight improvement. I tested writing large batches and reading large collections:
* both are network-dominated; wall time is about twice longer than CPU time;
* serialization represents a pretty small percentage of the total CPU time;
* for writing, C++ serialization is a little more efficient, taking ~6% of total CPU time, compared to ~8% in the Objective-C version. I've seen similar results for reading.
All integration tests pass, under Address Sanitizer as well.
* Remove stale references to DatabaseId
* Have Firestore take the DatabaseId directly
* Allow tests to default the database implicitly
* Have FSTSerializerBeta take DatabaseId by value
* Have FSTUserDataConverter take DatabaseId by value
* Make FIRFirestore.databaseID a const reference
* Make FSTFirestoreClient.databaseID a const reference
* Have FSTReferenceValue take DatabaseId by value
* Have DatabaseInfo take DatabaseId by value
* Have Serializer take DatabaseId by value
* Fix C++ ReferenceValue
* Take DatabaseId by value
* Reverse order to match Android
* Rename `reference` to `key`
Now, we use the re-worked nanopb deserializer (that mallocs). This also
had the advantage of moving the C++ serialization code closer to the
other platforms.
Still TODO:
- Reorder the methods within the files to resemble the other platforms.
* Use nanopb::Reader, Writer, in the serializer's public methods. This eliminates overloads that take raw bytes.
* Refactor the serializer's return values from Status, StatusOr<T> to void, optional<T> (or unique_ptr<T>) for encoding/decode methods, respectively.
* Errors during serializer encoding methods now fatal. Previously, we'd propagate the errors back to the caller, but there aren't any errors that could realistically be recovered from. So now we just abort(). (This is in contrast to *de*coding methods, which could generate errors that we might want to recover from.)
* Reduce early returns in the serializers
* Unify public/private method return values of the serializers. Now the private methods return void/optional, just like the public methods.
* Reader::ReadTag now tracks the last read tag. This allows:
* RequireWireType to not need it as a parameter
* SkipField to not need it as a parameter
* ReadTag to be inlined into most switch statements
* Move RequireWireType into ReadX methods
* Reader::SkipField -> Reader::SkipUnknown
* Add ReadNestedMessage overload in order to accept non-static functions.
* Add a few using statements to simplify code. (Also keeps local serializer more in sync with the remote serializer.)
* Use nullopt/nullptr instead of {}
* Reader::update_status() -> Fail()
* Add DecodeSnapshotVersion
* Don't directly update status within nanopb::Reader. Instead, call Reader::Fail() (which calls Status::Update()). This ensures we don't accidentally overwrite the first error status with
a subsequent one.
* Added fuzzing targets read from env variable.
* Refactored Serializer fuzz tests in a separate file
* Separate header file for each fuzzing target.
* Write crashing outputs using `artifact_prefix` flag to `NSTemporaryDirectory`.