Skip to content

C++: eliminate FSTDispatchQueue and replace it with AsyncQueue #2062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Nov 18, 2018

Conversation

var-const
Copy link
Contributor

@var-const var-const commented Nov 9, 2018

  • replace all references to FSTDispatchQueue and FSTTimerID with their C++ equivalents;
  • remove FSTDispatchQueue class and related tests;
  • in method argument names, replace workerDispatchQueue with just workerQueue, more similar to other platforms;
  • move Executor and derived classes out of internal namespace.

Copy link
Contributor Author

@var-const var-const left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a large PR, but most of it is deletions/textual substitutions.

}

- (void)setUp {
_testUserQueue = [FSTDispatchQueue queueWith:dispatch_get_main_queue()];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_testUserQueue wasn't actually used.

@@ -60,6 +61,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)shutdownWithCompletion:(nullable void (^)(NSError *_Nullable error))completion
NS_SWIFT_NAME(shutdown(completion:));

- (firebase::firestore::util::AsyncQueue *)workerQueue;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried but didn't succeed making this a readonly property.

// To deal with transient failures, we allow multiple stream attempts before giving up and
// transitioning from OnlineState Unknown to Offline.
// TODO(mikelehen): This used to be set to 2 as a mitigation for b/66228394. @jdimond thinks that
// bug is sufficiently fixed so that we can set this back to 1. If that works okay, we could
// potentially remove this logic entirely.
static const int kMaxWatchStreamFailures = 1;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using unnamed namespace instead (and const variables are implicitly static anyway).

HARD_ASSERT(self.state == OnlineState::Unknown,
"Timer should be canceled if we transitioned to a different state.");
[self logClientOfflineWarningIfNecessaryWithReason:
[NSString stringWithFormat:@"Backend didn't respond within %lld seconds.",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a tiny improvement, previously the log showed "10.000000 seconds".

[self.onlineStateTimer cancel];
self.onlineStateTimer = nil;
}
_onlineStateTimer.Cancel();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cancel is idempotent.


auto userPromise = std::make_shared<std::promise<User>>();
bool initialized = false;

__weak __typeof__(self) weakSelf = self;
auto credentialChangeListener = [initialized, userPromise, weakSelf,
workerDispatchQueue](User user) mutable {
auto credentialChangeListener = [self, initialized, userPromise, weakSelf,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need both weakSelf and self?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code uses self implicitly after checking weakSelf, I wanted to minimize the change.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code only uses self via __typeof__ (which is a nonstandard extension meaning something similar to decltype), which has a compile-time effect but doesn't result in a run-time capture.

Putting self in the explicit capture here retains the strong reference and defeats the purpose of passing this as a weak reference.

Objective-C does not support type inference so __typeof__(self) is the simplest way to say something like "same type just strong". Objective-C++ has auto so you could do this instead:

__strong auto strongSelf = weakSelf;

This is documented as working:
https://stackoverflow.com/questions/44690475/what-are-the-rules-for-deduced-type-by-auto-keyword-when-applied-in-objective


// To deal with stream attempts that don't succeed or fail in a timely manner, we have a
// timeout for OnlineState to reach Online or Offline. If the timeout is reached, we transition
// to Offline rather than waiting indefinitely.
static const NSTimeInterval kOnlineStateTimeout = 10;
const AsyncQueue::Milliseconds kOnlineStateTimeout = chr::seconds(10);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but my initial reaction was to think there was a bug. You're assigning a 'seconds' value to a variable of type 'millis'. It seems like you'd be off by 1000x. In reality, AsyncQueue::Milliseconds is actually a chrono::duration, so this all works fine.

Not relevant to this PR, but what are your thoughts on changing AsyncQueue::Milliseconds to AQ::Duration? That would change this line to c AQ::Duration timeout = chr::seconds(10); which reads nicer to me. It would also change AQ::EnqueueAfterDelay(Milliseconds delay, ...) to AQ::EnqueueAfterDelay(Duration delay, ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed offline, to briefly recap: my concern is that this would make a constructor like AQ::Duration foo{100} non-obvious. <chrono> is very reasonable with its conversions: conversions from larger to smaller units are implicit, but the reverse requires chrono::duration_cast. It's a compromise, but I'm inclined to leave as is.

} // namespace internal

using internal::DispatchAsync;
using internal::DispatchSync;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving these 'using' decl's into the anon namespace, 2 lines down. (http://go/totw/119#scope-of-the-alias)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@rsgowman rsgowman assigned var-const and unassigned rsgowman Nov 13, 2018
Copy link
Contributor

@zxu123 zxu123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, only straightforward replacement and should be safe to go.

@zxu123 zxu123 removed their assignment Nov 13, 2018
@var-const
Copy link
Contributor Author

@wilhuff I have one question on this PR. I made FIRFirestore to be the owner of the worker queue. I suspect FSTFirestoreClient would be a more natural owner; the main reason I've done it that way is to make implementing - (FSTDispatchQueue *)queueForFirestore: in FSTIntegrationTestCase easier. Alternatively, I could add just a getter returning the queue to FIRFirestore, which would delegate to another new getter on FSTFirestoreClient. What do you think?

@var-const var-const assigned wilhuff and unassigned var-const Nov 13, 2018
@wilhuff
Copy link
Contributor

wilhuff commented Nov 13, 2018

@wilhuff I have one question on this PR. I made FIRFirestore to be the owner of the worker queue. I suspect FSTFirestoreClient would be a more natural owner; the main reason I've done it that way is to make implementing - (FSTDispatchQueue *)queueForFirestore: in FSTIntegrationTestCase easier. Alternatively, I could add just a getter returning the queue to FIRFirestore, which would delegate to another new getter on FSTFirestoreClient. What do you think?

At a high level we should be moving toward FIRFirestore and other FIR-components becoming very thin shells since we'll need to maintain a parallel implementation for the public C++ API.

In terms of the specifics here, it seems reasonable to put the worker queue in its natural home and then add whatever plumbing is required to make the tests work.

It's possible to put such accessors in a Testing or internal category so that they're not a part of the public API. For example, here's an extra test-only accessor on the sync engine:

https://github.com/firebase/firebase-ios-sdk/blob/master/Firestore/Example/Tests/Core/FSTSyncEngine%2BTesting.h


auto userPromise = std::make_shared<std::promise<User>>();
bool initialized = false;

__weak __typeof__(self) weakSelf = self;
auto credentialChangeListener = [initialized, userPromise, weakSelf,
workerDispatchQueue](User user) mutable {
auto credentialChangeListener = [self, initialized, userPromise, weakSelf,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code only uses self via __typeof__ (which is a nonstandard extension meaning something similar to decltype), which has a compile-time effect but doesn't result in a run-time capture.

Putting self in the explicit capture here retains the strong reference and defeats the purpose of passing this as a weak reference.

Objective-C does not support type inference so __typeof__(self) is the simplest way to say something like "same type just strong". Objective-C++ has auto so you could do this instead:

__strong auto strongSelf = weakSelf;

This is documented as working:
https://stackoverflow.com/questions/44690475/what-are-the-rules-for-deduced-type-by-auto-keyword-when-applied-in-objective

@@ -151,17 +150,17 @@ - (instancetype)initWithDatabaseInfo:(const DatabaseInfo &)databaseInfo
// Defer initialization until we get the current user from the credentialChangeListener. This is
// guaranteed to be synchronously dispatched onto our worker queue, so we will be initialized
// before any subsequently queued work runs.
[_workerDispatchQueue dispatchAsync:^{
_workerQueue->Enqueue([=] {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lambda escapes the current stack frame so I'm wary of a default capture like this. I don't feel strongly though and likely non-harmful (default capture by reference would definitely not be OK).

I realize you've probably considered this, but is it worth adopting a convention of spelling out the capture when the lambda escapes?

# This is the 1st commit message:

C++: eliminate `FSTDispatchQueue` and replace it with `AsyncQueue`.

# This is the commit message #2:

wip
@var-const var-const force-pushed the varconst/replace-fst-dispatch-queue branch from 8a75cb1 to 8458189 Compare November 13, 2018 23:49
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of all the commit author(s), set the cla label to yes (if enabled on your project), and then merge this pull request when appropriate.

@var-const var-const changed the base branch from grpc-master to master November 13, 2018 23:51
@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot removed the cla: no label Nov 14, 2018
Copy link
Contributor Author

@var-const var-const left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At a high level we should be moving toward FIRFirestore and other FIR-components becoming very thin shells since we'll need to maintain a parallel implementation for the public C++ API.

In terms of the specifics here, it seems reasonable to put the worker queue in its natural home and then add whatever plumbing is required to make the tests work.

It's possible to put such accessors in a Testing or internal category so that they're not a part of the public API. For example, here's an extra test-only accessor on the sync engine:

https://github.com/firebase/firebase-ios-sdk/blob/master/Firestore/Example/Tests/Core/FSTSyncEngine%2BTesting.h

(sorry, tried rebasing, which improved history but messed up the comments)

There's a problem with making FSTFirestoreClient own the queue. First, the client's shutdown (omitting unimportant stuff):

- (void)shutdownWithCompletion:(nullable FSTVoidErrorBlock)completion {
  _workerQueue->Enqueue([self, completion] {
    [self.remoteStore shutdown]; // Calls Datastore::Shutdown
  });
}

Once the delayed operation completes, the last reference to FSTFirestoreClient dies, which leads to the destruction of the client and consequently of the worker queue. The problem is that it's possible that in-between when shutdownWithCompletion enqueues the delayed operation, and when the delayed operation is executed by the worker queue, Datastore happens to take another gRPC completion off the queue and enqueue its Complete method. libdispatch will then attempt to run that after the queue is destroyed, because it was enqueued later than shutdown. The cancellation mechanism in ExecutorLibdispatch only deals with delayed operations, not operations scheduled for "immediate" execution.

This didn't affect the previous version of the code, where FIRFirestore owned the queue, because the tearDown method in FSTIntegrationTestCase waits for shutdown to complete (including async operations) before releasing its pointer to FIRFirestore. I'm not sure if user code is required/expected to do the same thing.

The easiest workaround is:

- (void)shutdownWithCompletion:(nullable FSTVoidErrorBlock)completion {
  _workerQueue->Enqueue([self, completion] {
    [self.remoteStore shutdown];
    _workerQueue->EnqueueRelaxed([self] {}); // Hack
  });
}

Needless to say, it's pretty hacky. I'll give it some more thought tomorrow; what do you think?

__typeof__(self) strongSelf = weakSelf;
if (!strongSelf) return;

if (!initialized) {
initialized = true;
userPromise->set_value(user);
} else {
[workerDispatchQueue dispatchAsync:^{
strongSelf->_workerQueue->Enqueue([weakSelf, user] {
__typeof__(self) strongSelf = weakSelf;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original code only uses self via __typeof__ (which is a nonstandard extension meaning something similar to decltype), which has a compile-time effect but doesn't result in a run-time capture.

Putting self in the explicit capture here retains the strong reference and defeats the purpose of passing this as a weak reference.

Objective-C does not support type inference so __typeof__(self) is the simplest way to say something like "same type just strong". Objective-C++ has auto so you could do this instead:

__strong auto strongSelf = weakSelf;

This is documented as working:
https://stackoverflow.com/questions/44690475/what-are-the-rules-for-deduced-type-by-auto-keyword-when-applied-in-objective

Thanks for spotting the self problem (looking at weakSelf and strongSelf, I mistakenly treated self as if it were this).

When calling _workerQueue->Enqueue, is another weakSelf necessary?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Treating self and this as equivalent isn't really problematic--they're essentially functionally equivalent.

The difficulty in translating Objective-C to C++ is that when it comes to any Objective-C reference (self or otherwise), any assignment to a local or parameter could extend the lifetime of the object. (However, in the interest of not giving the wrong impression the self passed implicitly to a method on invocation is unsafe_unretained: Objective-C assumes the caller of a method on an object retains the reference).

One weakSelf is enough. There's nothing magical about which weak reference we're using: all the strong and weak references to a given object share the same control block, no matter how they're created.

if (self = [super init]) {
_databaseInfo = databaseInfo;
_credentialsProvider = credentialsProvider;
_userExecutor = std::move(userExecutor);
_workerDispatchQueue = workerDispatchQueue;
_workerQueue = std::move(workerQueue);

auto userPromise = std::make_shared<std::promise<User>>();
bool initialized = false;
Copy link
Contributor Author

@var-const var-const Nov 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilhuff Hmm, I don't think this works as intended -- because initialized is copied into the lambda, it seems like line 143 will always take the "true" branch. Looking through history, it appears that in a previous iteration, this was a __block variable captured in a block. I don't know the rules for blocks, but unless they somehow extend the lifetime of locals, perhaps it suffered from the same problem.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The credential change listener is lambda that's called multiple times. When the lambda is first created initialized is copied into its closure and on the first call the value of initialized is flipped to true. The closure is preserved from invocation to invocation which makes this work.

The prior version which used a __block used the same principle though it works differently. When you decorate a variable with __block it's allocated directly in the closure and then the local acts like a non-const reference. The net effect is the same though, the initial value of initialized only affects the first invocation of the block.

If this weren't working as intended (i.e. that assigning initialized = true never had any effect) we'd attempt to set_value on the userPromise more than once which would result in a std::future_error which we're not seeing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it's the same function that is invoked each time. Sorry, false alarm.

@@ -151,17 +156,17 @@ - (instancetype)initWithDatabaseInfo:(const DatabaseInfo &)databaseInfo
// Defer initialization until we get the current user from the credentialChangeListener. This is
// guaranteed to be synchronously dispatched onto our worker queue, so we will be initialized
// before any subsequently queued work runs.
[_workerDispatchQueue dispatchAsync:^{
_workerQueue->Enqueue([self, userPromise, usePersistence] {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lambda escapes the current stack frame so I'm wary of a default capture like this. I don't feel strongly though and likely non-harmful (default capture by reference would definitely not be OK).

I realize you've probably considered this, but is it worth adopting a convention of spelling out the capture when the lambda escapes?

I think it's reasonable to mandate explicit capture list in this case (except in tests). Updated throughout.

@wilhuff
Copy link
Contributor

wilhuff commented Nov 14, 2018

The easiest workaround is:

- (void)shutdownWithCompletion:(nullable FSTVoidErrorBlock)completion {
  _workerQueue->Enqueue([self, completion] {
    [self.remoteStore shutdown];
    _workerQueue->EnqueueRelaxed([self] {}); // Hack
  });
}

Needless to say, it's pretty hacky. I'll give it some more thought tomorrow; what do you think?

The traditional way to deal with the problem in Objective-C and libdispatch is to capture the thing you're calling back into with a weak reference. That way if the object you're calling back into is destroyed while you're waiting your turn on the queue you can detect it and no harm done.

The alternative arrangement, used when the deferred work should keep the target object alive, is to capture a strong reference.

The scenario you're describing here seems essentially the same and it seems as if this could be straightforwardly be solved by making the GrpcCompletion keep a std::weak_ptr to the async queue. Unfortunately this change is anything but straightforward since the async queue currently is referred to by a non-owning raw pointer which cannot convey changes in lifetime. It would be invasive to do this.

Meanwhile, the approach you've given above still seems like it would work for gRPC but it only works because our implementation finds and destroys all pending operations before returning. It wouldn't work in the arbitrary callback case like where Auth is calling us back.

Meanwhile @rsgowman was complaining about something similar on Android. Is it worth investigating adding general support to the async queue to handle this cleanly?

@wilhuff wilhuff assigned var-const and unassigned wilhuff Nov 14, 2018
Copy link
Contributor Author

@var-const var-const left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so the easiest way to make FSTFirestoreClient own the queue and avoid lifetime issues is to remove the bit in FIRFirestore shutdown where it lets go of its reference to client early. This fixes integration tests.

Two approaches I can think of in general would be:

  • having a method in AsyncQueue that, after it is invoked, will make the queue stop accepting new operations;
  • making the executor cancel all operations, not just delayed operations, in its destructor.

I'd prefer not to do either as part of this PR. The latter approach seems reasonable to me, but implementing it in ExecutorLibdispatch is not straightforward (ExecutorStd, on the other hand, doesn't suffer from this problem at all).

if (self = [super init]) {
_databaseInfo = databaseInfo;
_credentialsProvider = credentialsProvider;
_userExecutor = std::move(userExecutor);
_workerDispatchQueue = workerDispatchQueue;
_workerQueue = std::move(workerQueue);

auto userPromise = std::make_shared<std::promise<User>>();
bool initialized = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it's the same function that is invoked each time. Sorry, false alarm.

@var-const var-const assigned wilhuff and unassigned var-const Nov 16, 2018
Copy link
Contributor

@wilhuff wilhuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I'm OK with deferring major rework here. We'll likely need to revisit whatever we do here once we try to support app deletion so conserving effort in the short term is the right call.

@wilhuff wilhuff assigned var-const and unassigned wilhuff Nov 16, 2018
@var-const var-const merged commit e0d7975 into master Nov 18, 2018
rsgowman added a commit that referenced this pull request Nov 27, 2018
* Allow for custom domains in the FDL iOS SDK

Allow for custo domains to be whitelisted by the info.plist file.

* Fix style. Run ./scripts/style.sh

* style

* Update versions for Release 5.11.0

* Update Firestore Generated Protos (#1972)

* Remove cruft from project file (#1975)

* Lock reads and writes to session map

* Changed FDL to use compatible __typeof__() operator. (#1982)

typeof() is not supported in some C language dialects which causes
issues when integrating FDL in projects that do use non-GNU compiler modes.

For example, this causes problems when building in some versions of Unity
firebase/quickstart-unity#228

* Changed FDL to use compatible __typeof__() operator. (#1982)

typeof() is not supported in some C language dialects which causes
issues when integrating FDL in projects that do use non-GNU compiler modes.

For example, this causes problems when building in some versions of Unity
firebase/quickstart-unity#228

* Bump DynamicLinks patch version

* Add FDL to release manifest

* Bump GoogleUtilities patch version to deliver fix for #1964 (#1987)

* Wrap diagnostics notification in collection flag check. (#1979)

* Wrap diagnostics notification in collection flag check.

Some of the diagnostics notifications were missed and not covered by
the data collection flag.

* Remove redundant notification call, move Core diagnostics API call.

* Removed configure with no options test.

* Queue Storage Tasks on separate queue (#1981)

* Increase timeout for testDispatchAfterDelay (#1988)

* Update Storage Changelog (#1989)

* Add missing FirebaseStorage release note (#1990)

* Allow semicolon in file name (#1991)

*  Remove unnecessary notification flag (#1993)

* Remove unnecessary notification flag.

This was added when the Google pod could configure Firebase but the
Google pod is deprecated and can only work with Firebase 3.X. These
flags and conditional checks can be safely removed.

* Resolve issues from commit split.

* Style fixes.

* Reduce singleton usage in FIRApp tests. (#1995)

* Reduce singleton usage in FIRApp tests.

There have been some issues while creating new tests of conflicts with
mocks of classes and instances, this should alleviate some of those
conflicts in the future.

* Remove bad style changes.

* Use default app name flag instead of local variable.

* Comply with c99 standard (#1992)

* Trigger travis for Firestore podspec changes

* Use C99-compatible __typeof__ instead of typeof (#1985)

`typeof` is only defined if you compile with GNU extensions, while
`__typeof__` is always available.

This is the Firestore equivalent of #1982.

Note that Firestore won't yet build in this mode because among other
things the Objective-C gRPC still uses `typeof`. Once we eliminate that
dependency this might become possible.

* Adding AppCode Diff (#1996)

* Remove warning (#1999)

* Add InAppMessaging to Carthage template (#2006)

* Restore SafariServices framework (#2002)

* SafariServices not available on tvOS and not used on osx

* Force Firestore to conform to C99 and C++11. (#2001)

Note that c++0x is how Xcode spells c++11.

Also fix an issue where we were accidentally using a C++14 feature.

* Changing the internal testing repo (#2003)

* Clean up test. The issue has already been fixed and we are now running integration test with actual server instead of hexa. (#2007)

* gRPC: replace Objective-C implementation with the new C++ implementation (#1968)

* add support for SSL disabled to `GrpcConnection` (unfortunately, there
  currently is no way to verify this change actually works);
* make gRPC calls using the C++ implementation:
* make `FSTRemoteStore` create C++ streams instead of their Objective-C
  counterparts;
* port firebase/firebase-js-sdk#1041: streams
  are now never recreated, only restarted;
* make `FSTDatastore` delegate server calls to the C++ implementation;
* port `MockWatchStream` and `MockWriteStream` to C++ (`FSTMockDatastore` is
  still in place, because `Datastore` is not fully ported yet);
* no longer generate Objective-C gRPC service definitions from protos;
* remove all references to Objective-C gRPC client;
* check in gRPC root certificates file and load it at runtime (the check-in part
  is temporary until gRPC-C++.podspec provides the certificate). This makes SSL
  work.

* Add component system documentation.

* Fixed markdown layout issue.

* Remove trailing whitespaces.

* Add table of contents.

* Remove extra parentheses from TOC.

* Renamed SDKs to frameworks and products for accuracy.

* Updated the Carthage installation instructions (#2012)

* Add Rome instructions (#2014)

* Attempt to fix frequent Auth Unit Test flake on OSX (#2017)

* Increase timeouts in attempt to eliminate travis flakes (#2016)

* Don't rely on test always being in foreground (#2021)

* Fix log overflow in continuous fuzz testing (#2020)

Prevent generating too many "Unrecognized selector" console messages that eventually make Travis kill the job due to log exceeding limits.

* Assign the default app before posting notifications. (#2024)

Although SDKs being configured should access the app through the
dictionary being passed in (and soon the `FIRCoreConfigurable`
protocol), the default app should be assigned before notifying SDKs
that Core is ready.

* Update CHANGELOG for Firestore v0.14.0 (#2025)

* M37 Core release notes (#2027)

* Add changelog to GoogleUtilities

* Fix static analysis warning in Core. (#2034)

Explicitly check for `nil` instead of using the `!` operator on the pointer.

* Update CHANGELOG.md for #2034 (#2035)

* Revert "gRPC: replace Objective-C implementation with the new C++ implementation (#1968)" (#2030)

This reverts commit a514bd9.

* Partially revert "Update CHANGELOG for Firestore v0.14.0 (#2025)" (#2031)

This removes the changelog entry that describes our migration to
gRPC-C++.

* Move #2034 into 5.12.0 (#2036)

* Remove Held Write Acks (#2029)

* Drop acknowledged mutations in schema migration (#1818)

Drop acknowledged mutations in schema migration as part of removing held write acks.

Port of firebase/firebase-js-sdk#1149

* Change removeMutationBatch to remove a single batch (#1955)

* Update Firestore Generated Protos

*  Adding UnknownDocument and hasCommittedMutations (#1971)

* Removing held write batch handling from LocalStore (#1997)

* View changes for held write acks (#2004)

* Held Write Acks Unit Test Fixes (#2008)

* Held Write Ack Removal Spec Tests (#2018)

* Fix integration test

* Held Write Acks Changelog (#2037)

To be submitted when main PR goes in

* Fix tablet layout for in-app messaging (#2032)

* Rename fine-tuning methods to reflect size class rather than orientation

* Modify existing constraints to de-portrait tablet layout, need a card width for tablet now

* Further constraint tinkering, add identifiers for better auto layout debugging

* More constraints for "landscape" appearance in tablet. Looks good for every case except Thin Image, which blows up the height of the message card

* Fix fine tune layout methods to correctly fine tune for compact height and width

* Update layout constraint identifiers to match titles in document outline for easier debugging

* Revert superfluous method name changes for layout fine tuning methods

* Address travis timeout flakes (#2033)

*  Delete deprecated files (#2038)

* Add missing nanopb flag (#2042)

* Fix auth multi app support (#2043)

* Isolate Firestore nanopb messages in C++ namespaces (#2046)

* Add C++ namespaces and use C++ linkage for nanopb-generated sources.
* Regenerate nanopb sources as C++
* Add generated C++ nanopb sources to the podspec

* Fix analyze errors (#2047)

* Release 5.12.0 (#2051)

* Update versions for Release 5.12.0
* Add missing nanopb flag
* Isolate Firestore nanopb messages in C++ namespaces (#2046)
* Add C++ namespaces and use C++ linkage for nanopb-generated sources.
* Regenerate nanopb sources as C++
* Add generated C++ nanopb sources to the podspec

* Remove Mutation tombstones (#2052)

* Remove Mutation tombstones

* Review comments

* Porting Multi-Tab Structural Changes (#2049)

* Delete Firestore public C++ API (#2050)

* Add firebase_cpp_sdk 5.4.0

... to the Firestore CMake build.

* Move C++ public API headers to cpp/include

* Add Firebase C++ API tests.

* Add support for building on Linux

* Add clang-format configuration for Firestore/cpp

* Add windows build support

* Review feedback

* Revert build changes to support Firebase C++ integration.

It turns out the public Firebase C++ SDK doesn't include enough to
actually build another component of that SDK externally so these changes
don't really help.

Eventually, once Firebase C++ is open source we'll integrate with that
to actually test Firestore's public C++ API.

* Delete Firestore/cpp and public C++ artifacts

It's not yet feasible to build these components externally so there's no
use in keeping them here.

* Add clang-format installation instructions (#2057)

* Update Auth samples to sync with internal changes (#2056)

* Add a nanopb string (#1839)

* Add Equatable and Comparable
* Add nanopb String

* FIRApp is already configured. Remove duplicate configure call. This Fixes unit test failure.

* Invalidate non-background url sessions

* Run style

* Update abseil to master@{2018-11-06} (#2058)

* Update abseil-cpp to a new upstream

Update to 7990fd459e9339467814ddb95000c87cb1e4d945 master@{2018-11-06}

* Re-apply -Wcomma fix

* Update add_subdirectory for Abseil

* Remove references to Firestore/Port (which longer exists)

* Fix ABSL_HAVE_THREAD_LOCAL when targeting iOS 8 in Xcode 10

* Clean up abseil warnings

* Clean up a Firestore format string warning.

* Exclude third_party/abseil-cpp from whitespace checks

* Port code review changes from google3

* Amend changelog

* Minor edits: change domain names in test app plist, fix warnings.

* Fix warning.

* Fix style.

* Adding Numeric Add Proto message (#2064)

* Adding Numeric Add Proto message

* Remove trailing whitespace

* Adding base_writes proto field (#2066)

* Update the GULObjectSwizzler to handle NSProxy objects (#2053)

* GoogleUtilities 5.3.5 (#2067)

* gRPC: replace Objective-C implementation with the new C++ implementation (#2068)

* Revert "Revert "gRPC: replace Objective-C implementation with the new C++ implementation (#1968)" (#2030)"

This reverts commit ea567dc.

* gRPC: fix bugs found during testing (#2039)

All in `GrpcStream`:
* make sure there are no pending completions when "finish" operation is enqueued;
* always finish gRPC calls;
* when connectivity changes, reset not just the calls, but the underlying channel as well.

* Revert "Partially revert "Update CHANGELOG for Firestore v0.14.0 (#2025)" (#2031)"

This reverts commit b2437b8.

* Update changelog for v0.15.0.

* gRPC: add gRPC wrapper classes to CMake build (#2015)

* add a C++ equivalent of `FIRFirestoreVersionString`. This eliminates the only Objective-C dependency of `grpc_connection.mm` and allows making it a pure C++ file;
* open-source `binary_to_array.py` script and use it in the build to embed `roots.pem` certificate file from gRPC into the Firestore binary. The embedded char array is then used to load certificate at runtime.

* Revert local change -- do not enable sanitizers by default

* Fix `string_view` referring to an out-of-scope string (#2074)

* Allow setting the domainURIPrefix for custom domain names/paths when creating dynamic links (#2071)

* Add support for creating DL with custom domain names/paths. The new domainURIPrefix parameter requires either a. a valid FDL domain name created in the Firebase console or b. a custom domain name or c. a custom domain name with path registered for DL. All domainURIPrefixes need to start with a valid (https) scheme.

* Fix style.

* style

* Fix typo in DEPRECATED_MSG_ATTRIBUTE, other nits.

* Fix styling.

* Check incoming domainURIPrefix for validity using NSURL and check for an https scheme.

* Release manifest for 5.13.0 (#2076)

* Renaming manifest (#2077)

* Release manifest for 5.13.0

* Add warning for deprecated API to indicate that the passed in domain name's scheme will deduced as https (#2078)

* Add support for creating DL with custom domain names/paths. The new domainURIPrefix parameter requires either a. a valid FDL domain name created in the Firebase console or b. a custom domain name or c. a custom domain name with path registered for DL. All domainURIPrefixes need to start with a valid (https) scheme.

* Fix style.

* style

* Fix typo in DEPRECATED_MSG_ATTRIBUTE, other nits.

* Fix styling.

* Check incoming domainURIPrefix for validity using NSURL and check for an https scheme.

* Add extra checks for deprecated domain parameter being incorrectly called with a scheme. Also fix some nits.

* Log a warning for the deprecated API stating that the scheme for the supplied domain will be deduced as https.

* Update CHANGELOG for M38.

* Update changelog for M38

* Update CHANGELOG for M38 release.

* Capitalize HTTPS.

* Update CHANGELOG to include PR for removal of deprecated files.

* Capitalize HTTPS.

* Fix GoogleUtilities nullability regressions (#2079)

* Remove `adjustsFontForContentSizeCategory` (unsupported in iOS 10.0) from labels in card layout Storyboard (#2083)

* Add pod spec lint testing for Xcode 9 (#2084)

* FirebaseAnalyticsInterop is cross-platform (#2088)

* C++: eliminate `FSTDispatchQueue` and replace it with `AsyncQueue` (#2062)

* replace all references to `FSTDispatchQueue` and `FSTTimerID` with their C++ equivalents;
* remove `FSTDispatchQueue` class and related tests;
* in method argument names, replace `workerDispatchQueue` with just `workerQueue`, more similar to other platforms;
* move `Executor` and derived classes out of `internal` namespace.

* Database Interop (#1865)

* Register Database with Interop

+ Add AuthInterop dependency
+ Have Database register with Interop component container
+ Add weak dependency on Auth
~ Cleaned up imports

* Use Interop for Auth token fetching

+ Use macro to get auth component
~ Change `getTokenForcingRefresh:withCallback:` call to use Interop component version of Auth
~ Clean up imports

* Implement necessary protocols

+ Added FIRComponentRegistrant and FIRDatabaseNilProtocol to FIRDatabase

* Squash of my previous local commits for Database Interop

Register Database with Interop:

  + Add AuthInterop dependency
  + Have Database register with Interop component container
  + Add weak dependency on Auth
  ~ Cleaned up imports

Use Interop for Auth token fetching:

  + Use macro to get auth component
  ~ Change `getTokenForcingRefresh:withCallback:` call to use Interop component version of Auth
  ~ Clean up imports

Implement necessary protocols:

  + Added FIRComponentRegistrant and FIRDatabaseNilProtocol to FIRDatabase

Clean up Database tests:

  - Removed all unnecessary header files
  ~ Ran style.sh across all the tests

Cleaned Up project file:

  Some header removals were missed in the last commit.

Sorted some test files

Fix Database Fake App Tests:

  + Added container property
  + Added an Auth fake in the container
  + Added the Shared utils files to the necessary targets
  + Added a missing XCTest reference in a test that didn't compile for me

* Revert "Squash of my previous local commits for Database Interop"

This reverts commit c0d0421.

* Cleaned Up project file

Some header removals were missed in the last commit.

* Sorted some test files

* Fix Database Fake App Tests

+ Added container property
+ Added an Auth fake in the container
+ Added the Shared utils files to the necessary targets
+ Added a missing XCTest reference in a test that didn't compile for me

* PR Feedback Changes

+ Created new FIRDatabaseComponent class to encapsulate instance creation
+ Updated FAuthTokenProvider to only use an auth instance rather than an app.

* PR Feedback Follow-Up

- Removed FIRDatabase registration code

* pod deintegrate

* Move instance management

Somes tests may still be out of date.

* Fix Auth integration test

* pod deintegrate -- again

* PR Feedback

* PR Feedback

Added the FIRComponentLifecycleMaintainer protocol to FIRDatabaseComponent

* Update Firebase/Database/Api/FIRDatabaseComponent.m

Missed some small changes

* Get integration tests compiling

* Fix some tests

* Fixed more tests

Component needs to be cacheable in order to get the appWIllBeDeleted callback.

* Update target memberships

* Revert project file changes

* Add FIRAuthInteropFake for broken targets

* PR feedback

* Spacing and Style

* Moved `instances` to ivar

* Simplify FIRDatabaseDictionary

It's now keyed on the URL with the app being implied since each app will get its own `FIRDatabaseComponent`

* Revert "Database Interop (#1865)" (#2093)

This reverts commit 4090195.

* Revert premature api changes (#2097)

* Revert "Add warning for deprecated API to indicate that the passed in domain name's scheme will deduced as https (#2078)"

This reverts commit ceb8392.

* Revert "Allow setting the domainURIPrefix for custom domain names/paths when creating dynamic links (#2071)"

This reverts commit d917bac.

* Revert "Minor edits: change domain names in test app plist, fix warnings."

This reverts commit 15f5d46.

* Revert "Fix style. Run ./scripts/style.sh"

This reverts commit 0e16e6c.

* Revert "Allow for custom domains in the FDL iOS SDK"

This reverts commit 5e33153.

* Version is still 3.2.0

* Add test for verify iOS client (#2096)

* Release 5.13.0 (#2101)

* Update versions for Release 5.13.0

* Revert premature api changes (#2097)

* Revert "Add warning for deprecated API to indicate that the passed in domain name's scheme will deduced as https (#2078)"

This reverts commit ceb8392.

* Revert "Allow setting the domainURIPrefix for custom domain names/paths when creating dynamic links (#2071)"

This reverts commit d917bac.

* Revert "Minor edits: change domain names in test app plist, fix warnings."

This reverts commit 15f5d46.

* Revert "Fix style. Run ./scripts/style.sh"

This reverts commit 0e16e6c.

* Revert "Allow for custom domains in the FDL iOS SDK"

This reverts commit 5e33153.

* Version is still 3.2.0

* Pin gRPC-C++ version to exactly 0.0.5 (#2105)

While gRPC-C++ is in its 0.* versions, any new version could potentially contain breaking changes. Make sure we only upgrade at our own pace.

* Database Interop Rollforward (#2095)

* Register Database with Interop

+ Add AuthInterop dependency
+ Have Database register with Interop component container
+ Add weak dependency on Auth
~ Cleaned up imports

* Use Interop for Auth token fetching

+ Use macro to get auth component
~ Change `getTokenForcingRefresh:withCallback:` call to use Interop component version of Auth
~ Clean up imports

* Implement necessary protocols

+ Added FIRComponentRegistrant and FIRDatabaseNilProtocol to FIRDatabase

* Squash of my previous local commits for Database Interop

Register Database with Interop:

  + Add AuthInterop dependency
  + Have Database register with Interop component container
  + Add weak dependency on Auth
  ~ Cleaned up imports

Use Interop for Auth token fetching:

  + Use macro to get auth component
  ~ Change `getTokenForcingRefresh:withCallback:` call to use Interop component version of Auth
  ~ Clean up imports

Implement necessary protocols:

  + Added FIRComponentRegistrant and FIRDatabaseNilProtocol to FIRDatabase

Clean up Database tests:

  - Removed all unnecessary header files
  ~ Ran style.sh across all the tests

Cleaned Up project file:

  Some header removals were missed in the last commit.

Sorted some test files

Fix Database Fake App Tests:

  + Added container property
  + Added an Auth fake in the container
  + Added the Shared utils files to the necessary targets
  + Added a missing XCTest reference in a test that didn't compile for me

* Revert "Squash of my previous local commits for Database Interop"

This reverts commit c0d0421.

* Cleaned Up project file

Some header removals were missed in the last commit.

* Sorted some test files

* Fix Database Fake App Tests

+ Added container property
+ Added an Auth fake in the container
+ Added the Shared utils files to the necessary targets
+ Added a missing XCTest reference in a test that didn't compile for me

* PR Feedback Changes

+ Created new FIRDatabaseComponent class to encapsulate instance creation
+ Updated FAuthTokenProvider to only use an auth instance rather than an app.

* PR Feedback Follow-Up

- Removed FIRDatabase registration code

* pod deintegrate

* Move instance management

Somes tests may still be out of date.

* Fix Auth integration test

* pod deintegrate -- again

* PR Feedback

* PR Feedback

Added the FIRComponentLifecycleMaintainer protocol to FIRDatabaseComponent

* Update Firebase/Database/Api/FIRDatabaseComponent.m

Missed some small changes

* Get integration tests compiling

* Fix some tests

* Fixed more tests

Component needs to be cacheable in order to get the appWIllBeDeleted callback.

* Update target memberships

* Revert project file changes

* Add FIRAuthInteropFake for broken targets

* PR feedback

* Spacing and Style

* Moved `instances` to ivar

* Simplify FIRDatabaseDictionary

It's now keyed on the URL with the app being implied since each app will get its own `FIRDatabaseComponent`

* Fix Database Integration Tests

Have the FakeApp cache DB instances
Use the Full host/URL path to cache DB instances
Simplified shared scheme

```
Test Suite 'Database_IntegrationTests_iOS.xctest' passed at 2018-11-20 07:09:30.520.
	 Executed 326 tests, with 0 failures (0 unexpected) in 66.251 (66.528) seconds
Test Suite 'All tests' passed at 2018-11-20 07:09:30.522.
	 Executed 326 tests, with 0 failures (0 unexpected) in 66.251 (66.530) seconds
```

* Clarify defaultApp use

* Prefer roots.pem from gRPC-C++, but fall back to Firestore bundled ones if necessary (#2106)

gRPC-C++ versions up to and including 0.0.3, and also 0.0.5, don't bundle `roots.pem` in the podspec. gRPC-C++ 0.0.4 and, presumably, the currently not-yet-released 0.0.6 do. Firestore currently also bundles this file under the same bundle name, which leads to build errors when both Firestore and gRPC-C++ try to add the file into the build (only shows during archiving).

For transition, this PR:
* renames the Firestore bundle to avoid naming clash;
* changes the loading code so that it first tries to load certificates bundled with gRPC-C++ (versions 0.0.4 and 0.0.6+), but falls back to those bundled with Firestore if necessary.

At a later point, Firestore should be changed to not bundle the certificates altogether.

* Add Firebase Source to Header Search Path (#2114)

This resolves the annoying Xcode errors that claim `FIRAppInternal.h` can't be found.

It also makes it *much* easier to "Jump to definition" now.

* Implement PatchMutation::ApplyToLocalView (#1973)

* Test namespacing fixup

Since the nanopb protos are now namespaced, we need to account for that
in our serializer_test.cc file.
@paulb777 paulb777 deleted the varconst/replace-fst-dispatch-queue branch May 26, 2019 20:48
@firebase firebase locked and limited conversation to collaborators Oct 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants