forked from mozilla/application-services
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wrap the autofill implementation in an Arc<Mutex<>> to help the sync …
…manager. This patch works-around the lack of the functionlity described in mozilla/uniffi-rs#417. In short, it splits the store into 2 parts - the uniffi-exposed "wrapper" and the actual implementation. This "wrapper" wraps the implementation in an `Arc<Mutex>>`, so that it can hand a clone of this `Arc<>` to the sync manager, so that it can construct sync engines, causing us to end up with multiple references to the `Store` being alive but without any being actual `&` references. (Thinking some more about it, I probably could have done this slightly differently, and just wrapped the DB itself, but I ended up somewhat automatically taking this route because this is what the shape would naturally be if uniffi helped us. I think passing the entire store around does make more sense in the longer term anyway (eg, there might be other state beyond the DB) and is what the other components do, but it does make this patch bigger than it would otherwise be) It also makes some changes in the sync manager, really just enough to convince me that it will work - there will be plenty of other places that will need similar treatment. I chose to use the `SyncEngine` trait exclusively there, which I think makes sense because ideally we'd use that trait *everywhere* to avoid the Sync Manager knowing about the implementation (but it would still require it to link to all those crates, so that's just a code-simplicity issue)
- Loading branch information
Showing
11 changed files
with
223 additions
and
73 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.