-
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.
Every implementation needs access to the current `InternalContext` so we can save a bit of memory by just passing it. This is pretty minor since `ProvisionListeners` are rare, but it satisfies a long running TODO and allows us to eliminate some allocations from the normal provisioning path. PiperOrigin-RevId: 715467849
- Loading branch information
1 parent
c4401b8
commit 325ac9c
Showing
7 changed files
with
55 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ | |
* | ||
* @author [email protected] (Bob Lee) | ||
*/ | ||
final class ConstructorInjector<T> { | ||
final class ConstructorInjector<T> implements ProvisionCallback<T> { | ||
|
||
private final ImmutableSet<InjectionPoint> injectableMembers; | ||
private final SingleParameterInjector<?>[] parameterInjectors; | ||
|
@@ -82,17 +82,17 @@ Object construct( | |
} else { | ||
// NOTE: `provision` always calls the callback, even if provision listeners | ||
// throw exceptions. | ||
return provisionCallback.provision( | ||
context, | ||
new ProvisionCallback<T>() { | ||
@Override | ||
public T call() throws InternalProvisionException { | ||
return provision(context); | ||
} | ||
}); | ||
return provisionCallback.provision(context, dependency, this); | ||
} | ||
} | ||
|
||
// Implements ProvisionCallback<T> | ||
@Override | ||
public final T call(InternalContext context, Dependency<?> dependency) | ||
throws InternalProvisionException { | ||
return provision(context); | ||
} | ||
|
||
/** Provisions a new T. */ | ||
private T provision(InternalContext context) throws InternalProvisionException { | ||
MembersInjectorImpl<T> localMembersInjector = membersInjector; | ||
|
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