Commit Graph
632 Commits
Author SHA1 Message Date
Gil 38d9643a00 Disallow empty document fields (#4229)
Port of firebase/firebase-android-sdk#643.

Also make error messages align with Android's.
2019-11-04 17:03:10 -06:00
wu-hui 2f53582530 Various minor fixes to make SDK compile on Linux (#4185) 2019-11-04 14:39:44 -05:00
Gil 3ea7197090 Port FSTQueryCacheTests to C++ (#4160)
* Move FSTQueryCacheTests files to Firestore/core

* Rewrite QueryCache tests in C++

* Fix test flake in local store tests

This doesn't affect production because we always set the additional
references pointer there, but it's technically optional and some tests
don't do this.
2019-11-02 09:09:25 -05:00
Konstantin Varlamov 04177614d0 Fix fuzz build (#4192) 2019-10-30 14:30:52 -04:00
Brian Chen 251a70f26a Make IN queries publicly available (#4174) 2019-10-29 14:13:02 -07:00
Brian Chen 441d7eda8b Change id to NSArray<id> for IN queries (#4182) 2019-10-28 22:22:37 -07:00
Konstantin Varlamov 8b23a3266d Remove Objective-C serializers and make local/ and remote/ (almost) fully C++ (#4151)
There are more sources that can be `.cc` now (e.g., in API); these are left for a follow-up PR.

The dependency on Objective-C proto library cannot be removed just yet due to current lack of pretty-printing support for Nanopb.
2019-10-23 20:56:44 -04:00
Gil 6fd815a5ed Port FSTRemoteDocumentCacheTests to C++ (#4136) 2019-10-23 12:28:16 -07:00
Konstantin Varlamov 2c53bb9139 C++ migration: use C++ serializer for communicating with the local store (#4116)
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.
2019-10-22 21:52:55 -04:00
Paul Beusterien a621e59217 Merge 6.11.0 (#4134) 2019-10-22 11:35:29 -07:00
Gil 3f1fbe7e9a Migrate FSTPersistenceTestHelpers to C++ (#4122)
* Move FSTPersistenceHelpers to core/test/.../local

* Rewrite persistence_testing in C++

* Migrate from FSTPersistenceTestHelpers to C++ persistence_testing

* Rename .mm to .cc where possible in IndexManager tests

* Remove Objective-C gunk from index_manager_test.h
2019-10-21 20:12:46 -07:00
Konstantin Varlamov 0f2a0bfeef Use C++ serializer for communicating with the backend (#4013)
Replace all uses of `FSTSerializerBeta` in `remote_objc_bridge.{h,mm}` with the C++ `Serializer`. Also, make most of `remote/` sources pure C++ and remove no-longer-used methods in `FSTSerializerBeta`. All integration tests pass, under Address Sanitizer as well.

Unfortunately, pretty-printing is still delegated to Objective-C, so that `remote_objc_bridge.mm` still has to be an Objective-C++ source (and which prevents inlining `remote_objc_bridge` into the streams).

#no-changelog Will add a changelog entry when local serializer is ported, too.
2019-10-18 17:58:14 -04:00
wu-hui 2ebb82d1c5 LocalSerializer feature complete (#4046)
* LocalSerializer feature complete

* Addressing comments 1

* Walk around nanopb boolean issue

* Rename to SafeReadBoolean
2019-10-17 17:04:47 -04:00
Gil b1be1a9c70 Ensure that projectIDs are validated (#4073)
* Avoid priming the backend for emulator tests

* Validate that nil project ids are rejected
2019-10-17 10:03:01 -07:00
Paul Beusterien d8e3a11bb1 Restore Firebase pod to closed source location (#4112) 2019-10-17 09:45:04 -07:00
Ryan Wilson bbcac27b72 Release 6.10.0 (#4022)
* Update versions for Release 6.10.0

* Cherrypick #3983 and include Database in release. (#3986)

* Remove log argument that causes SocketRocket crash (#3983)

* Add FirebaseDatabase to release.

* Update CHANGELOG with version.

* Cherrypick for #3984 along with CHANGELOG update. (#3988)

* Fix race condition in FIRComponentContainer instance creation (#3984)

* Fix race condition in FIRComponentContainer instance creation

Reported in #3967. Users sometimes seeing a crash when multiple threads
concurrently try to create Firestore instances. By inspection I found
that there's a race here where two threads can check for presence in the
cache, see nothing, proceed to creation, both store a value in the cache,
and both return their copies. This would lead to two Firestores being
created for a single App.

This replaces `dispatch_sync` on a serial queue with good old
`@synchronized` blocks. `dispatch_sync` will self-deadlock if called
from a thread already on the queue while `@synchronized` allows
recursion.

No new tests are added because several tests like
`testDependencyDoesntBlock` already cover this case.

* format

* Update Core CHANGELOG

* Update Core CHANGELOG again

* Fix merge from CHANGELOG
2019-10-09 12:10:33 -04:00
Gil f32cc12ce0 Build Firestore with Xcode 11 (#4005)
* Drop dependency on OCMock

* Move Firestore onto Xcode 11 in Travis

* Special case simulators based on Xcode version, not product

This allows Firestore's build with Xcode 8.3.3 to continue to work.

* Make the Firestore Podfile install only one platform at a time

Use the PLATFORM environment variable to limit which targets are
modified. This makes the selected platform work but leaves the other
platforms in a broken state in the Xcode UI.

* Fix code signing errors on macOS builds
2019-10-07 08:46:06 -07:00
Gil 11de159e8e Migrate FSTRemoteEventTests to C++ (#3965)
* move (unchanged) into Firestore/core

* split out TestTargetMetadataProvider

... also rename to not start with "test".

* rewrite in C++
2019-10-04 11:55:20 -07:00
Konstantin Varlamov 893002541b Serializer: implement encoding and decoding of Target (#3932) 2019-10-03 19:05:05 -04:00
Gil 1a004119fa Project updates for recently added/moved files (#3994)
Occasionally Xcode will save these out--I can't predict when.
2019-10-03 16:02:14 -07:00
Sebastian Schmidt 41c411e8f4 Add QueryData.with() helpers (#3991) 2019-10-03 14:52:12 -07:00
Gil b37ab3b433 Migrate FSTViewSnapshotTests to C++ (#3919)
* view_snapshot_test: move (unchanged) from FSTViewSnapshotTest.mm

* view_snapshot_test: automated changes

* view_snapshot_test: sync_project.rb generated changes

* view_snapshot_test: manual fixes

* view_snapshot_test: shorten DocumentViewChange::Type
2019-09-30 19:55:03 -07:00
Gil 7d06d34e05 Migrate tests written as C++ into the C++ tree (#3917)
* field_transform_test: move into Firestore/core

* field_transform_test: project changes

* transform_operation_test: move into Firestore/core

* transform_operation_test: project changes
2019-09-30 18:07:59 -07:00
Gil 62c4fa30d2 Migrate FSTQueryListenerTests to C++ (#3901) 2019-09-30 13:17:53 -07:00
Gil 9ec602efcb Migrate FSTViewTests to C++ (#3900)
* Add view testing utilities

* Copy FSTViewTests.mm to view_test.cc unchanged

* Migrate FSTViewTests to C++
2019-09-30 11:26:42 -07:00
Gil 3185ff61d5 Add Expectations and Async/Await for testing (#3899)
* Add Expectations and Async/Await for testing

* Migrate async tests to Expectations and Async/Await
2019-09-27 12:25:34 -07:00
Gil 75a8356c98 Upgrade GoogleTest to 1.8.1 (#3898)
This gives access to testing::ScopedTrace, which was previously
internal.
2019-09-26 11:41:47 -07:00
Gil 971445ce35 Add cross-platform support for creating Executors (#3897)
* Add Executor::CreateSerial

... a standard way to create an Executor for most cases where we don't
care about the implementation.

* Add ExecutorForTesting/AsyncQueueForTesting

Uses Executor::CreateSerial to do the heavy lifting.

* Use AsyncQueueForTesting

* Avoid direct references to ExecutorLibdispatch in prod code

* Rewrite time_testing in terms of absl::Time

* Migrate async_test_util's now to time_testing

* Fix AddressSanitizer stack-buffer-underflow error

This was reading random data off the stack until it hit a negative
integer's worth of data. The test passed because this was generating the
input and expected values, which were much longer than expected given
the input.
2019-09-26 10:41:36 -07:00
Paul Beusterien fb353c22d4 Merge 6.9.0 (#3907)
* Update versions for Release 6.9.0

* Fix unbalanced background task creation in GDTCCTUploader (#3838) (#3839)

* Add Manifest

* dependency version update

* Cherry picks for 6.9.0 (#3871)

* fixed "expiclitlySet" typo. (#3853)

* Mark unused variables (#3854)

* Mute FCM deprecated warnings with Xcode 11 and min iOS >= 10 (#3857)

* Add a third slash to make sure generated docs include these comments.b/13812238 (#3846)
2019-09-23 10:41:33 -07:00
Brian Chen b1eb602ef4 Rename spec test functions (#3895) 2019-09-20 16:30:11 -04:00
Brian Chen 9d230de9c0 Adding onSnapshotsInSync (not public) (#3850) 2019-09-20 14:15:57 -04:00
wu-hui b48636bf52 Port local store to C++ 2/2 (#3865)
Complete LocalStore port.
2019-09-18 14:00:32 -04:00
Marek Gilbert 3e939a7ee2 Merge branch 'firestore-master' 2019-09-13 12:41:25 -07:00
wu-hui dff57b6048 Enable -Werror for Firestore XCode project (#3836) 2019-09-13 12:39:18 -07:00
Brian Chen 941133705a Port persistence spec test (#3844) 2019-09-13 11:56:47 -07:00
Gil 6ad473ae04 Merge persistence-master to master (#3829)
* Port FSTMemoryPersistence to C++ (#3754)

* Add local::Persistence

* Add MemoryPersistence

* Add MemoryEagerReferenceDelegate

* Make LruDelegate extend ReferenceDelegate

This enables downcasting to LruDelegate in tests that need to do so.

* Add MemoryLruReferenceDelegate

* Don't double-count document key size.

* Port FSTLevelDB to C++ (#3755)

* Add LevelDbPersistence

Note that Apple-specific initialization has been partitioned off in
anticipation of being able to run this code on non-Apple platforms.

* Add LevelDbLruReferenceDelegate

* Migrate to C++ Persistence (1/2) (#3756)

* Use C++ Persistence classes in FSTLocalStore

* Remove ReferenceDelegateBridge

* Cut src over to C++ persistence types

* Remove Objective-C requirement from some classes

... that no longer require it.

* Migrate to C++ Persistence (2/2) (#3757)

* Remove LruDelegateBridge

* Update test initialization of persistence components

In particular, ensure that there's always an owner for the Persistence
instance, which wasn't always handled explicitly in the Objective-C
version of the tests.

* Largely mechanical changes to tests

* Remove Objective-C persistence classes

* Forward declare util::Status when possible (#3761)

* Add a header dedicated to forward declarations for util::Status

* Use status_fwd.h wherever possible
2019-09-12 14:28:10 -07:00
Paul Beusterien 330a55f9de Merge 6.8.1 (#3811) 2019-09-10 06:46:16 -07:00
Maksym Malyhin 89a276928c Merging the 6.8.0 release into master (#3783)
* Update versions for Release 6.8.0

* RemoteConfig fix pod spec lint (#3715) (#3716)

* ABTesting: add protos to private headers.

* RemoteConfig: #import <FirebaseABTesting/ExperimentPayload.pbobjc.h>

* ./scripts/style.sh

* Remote Config `pod spec lint` fixes (#3717) (#3718)

* Fix ExperimentPayload.pbobjc.h imports

* RemoteConfig tests: add missing headers to spec.

* Revert ExperimentPayload.pbobjc.h import for ABTesting sources.

* Add FDL to M55 (#3724)

* Remove references to UIWebView from DynamicLinks to comply with Apple "ITMS-90809: Deprecated API Usage" (#3723)
* Add FDL to M55

* Fix accessing a destroyed object (#3721) (#3725)

This was caused by running under Asan with XCode 11. Apparently, previous versions of XCode cannot catch it (which is why Travis is passing, apparently).

Also:
* enable "Detect use of stack after return" option for Asan. AFAIU, it can only be enabled in the scheme. It's already enabled for unit tests, this PR additionally enables it for integration tests;
* make Asan failures fail Travis build. They were originally not considered blocking due to some sporadic failures. I haven't seen those for some time, and worst case scenario, we can revert this change.

* Cherry pick GDT changes for 6.8.0 and increment versions (#3770)

* Release 6.8.0: cherry pick of #3764 and #3766 (#3772)

* Gate access to cached instances. (#3766)

* Gate access to cached instances.

This is causing an issue in #3728. Hopefully this will fix it, but no
repro is available yet to test. There's still an underlying race
condition where a `creationBlock` could be called twice for a component
that is supposed to cache the instance returned, but that should be
addressed in a follow up PR.

* Review feedback.

* Iterate from array copy in `latestExperimentStartTimestampBetweenTimestamp:` (#3764)

* Release 6.8.0 cherry pick: conflicting Dynamic Links changelog changes. (#3790)

* Update FDL CHANGELOG (#3781)

* Issue number, not PR number (#3785)
2019-09-06 15:19:25 -04:00
wu-hui 1ce982de85 Port FSTSyncEngine to C++ SyncEngine 2/2 (#3741) 2019-09-05 18:40:58 -04:00
Sebastian Schmidt f0f0aeba20 Don't persist documents that we already have (#3650) 2019-09-05 15:36:29 -07:00
Gil 58cae6c573 Misc Objective-C cleanups (#3751)
* Clean up references to Firestore.pbrpc

We're no longer using Objective-C gRPC services and this is no longer generated.

* Remove no longer existing entries from xcgmock
2019-09-04 11:39:13 -07:00
Gil e374338b83 Fix removal of view references in FSTLocalStore (#3737) 2019-09-02 20:07:28 -07:00
Konstantin Varlamov 5da6b69a7d Fix accessing a destroyed object (#3721)
This was caused by running under Asan with XCode 11. Apparently, previous versions of XCode cannot catch it (which is why Travis is passing, apparently).

Also:
* enable "Detect use of stack after return" option for Asan. AFAIU, it can only be enabled in the scheme. It's already enabled for unit tests, this PR additionally enables it for integration tests;
* make Asan failures fail Travis build. They were originally not considered blocking due to some sporadic failures. I haven't seen those for some time, and worst case scenario, we can revert this change.
2019-08-29 14:14:09 -04:00
wu-hui c5b5a44603 Rename shutdown to terminate and publish it. (#3694)
* Rename shutdown to terminate and publish it.

* Addressing feedbacks
2019-08-27 11:51:01 -04:00
Gil aa326a47ce Migrate FSTLRUGarbageCollector to C++ LruGarbageCollector (#3685)
* Add ReferenceDelegate

* Remove Objective-C crutches from model/types.h and query_cache.h

* Add C++ LruGarbageCollector

* Add delegate bridges for LruDelegate and ReferenceDelegate

* Migrate from FSTLRUGarbageCollector to C++ LruGarbageCollector
2019-08-26 21:56:15 -07:00
Gil 5cdff78f2b Migrate FSTView to C++ View (#3684)
* Add C++ ViewChange

* Migrate FSTViewChange to C++ ViewChange

* Add C++ View

* Migrate FSTView to C++ View
2019-08-26 19:39:54 -07:00
Gil 6cf151f28a Fix Xcode 8 builds (again) (#3695)
The fix in #3647 was essentially undone in #3648 because even though the
podspec no longer depends on FirebaseCoreDiagnostics, adding in local
pod declarations for these brought them back into the project.

This change removes local pod declarations for the dependencies that
break under Xcode 8 as well.
2019-08-26 19:35:45 -07:00
wu-hui 7870c73b7c Port FSTFirestoreClient to C++ 2/2 (#3657)
* firestore_client + FSTFirestoreClient becomes delegate.

* fix comment

* addressing comment

* use new instead make_shared

* reformat

* Update references to firestore client

* Addressing comments#2

* addressing comments #3

* add std::move

* remove deleted header.

* fix cmake build error.
2019-08-26 15:48:18 -04:00
Gil 49de84aa5c Migrate FSTMutationBatch to C++ MutationBatch (#3673) 2019-08-25 17:40:31 -07:00
Gil 0da97f9676 Conditionally use local sources for Firestore (#3648)
This will force post-merge builds to validate compatibility with
pre-release versions of other Firebase pods
2019-08-23 12:08:20 -07:00