-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow factories to customize their generated Providers
This enables a few optimizations - A number of implementations can avoid `InternalContext` overheads addressing #1802 - `ConstantBindings`, one time bindings like `Initializable` and `@Singleton` bound values, and a number of multibinder bindings in particular. - We can leverage the cache within `BindingImpl` to share provider instances. The tricky part is about multibindings, which have complex multi-phase initialization semantics, so we need to be defensive about `makeProvider` getting called prior to being initialized. To help manage this I * reordered the `LookupProcessor` to run _after_ multibinders. - The comment justifying its current location in initialization is obsolete since multibinders were rewritten to be 'native'. - This ensures lookups get optimized providers! * made the `SyntheticProviderFactory` allocate its delegate lazily. * make `OptionalBinder` explicitly initialize their delegate bindings and also be defensive against recursive and duplicate initialization. This is necessary to force initialization to be correct when our `getExistingBinding` query ends up delegating to another multibinder. * be defensive about initialization failing to complete due to errors PiperOrigin-RevId: 721080468
- Loading branch information
1 parent
54f53e8
commit 9e4df6f
Showing
19 changed files
with
678 additions
and
169 deletions.
There are no files selected for viewing
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
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.