diff options
Diffstat (limited to 'android/mutator.go')
-rw-r--r-- | android/mutator.go | 46 |
1 files changed, 5 insertions, 41 deletions
diff --git a/android/mutator.go b/android/mutator.go index 76487fbad..d6166d2de 100644 --- a/android/mutator.go +++ b/android/mutator.go @@ -67,7 +67,6 @@ type registerMutatorsContext struct { } type RegisterMutatorsContext interface { - TopDown(name string, m TopDownMutator) MutatorHandle BottomUp(name string, m BottomUpMutator) MutatorHandle BottomUpBlueprint(name string, m blueprint.BottomUpMutator) MutatorHandle Transition(name string, m VariationTransitionMutator) TransitionMutatorHandle @@ -195,17 +194,6 @@ func FinalDepsMutators(f RegisterMutatorFunc) { finalDeps = append(finalDeps, f) } -type TopDownMutator func(TopDownMutatorContext) - -type TopDownMutatorContext interface { - BaseModuleContext -} - -type topDownMutatorContext struct { - bp blueprint.TopDownMutatorContext - baseModuleContext -} - type BottomUpMutator func(BottomUpMutatorContext) type BottomUpMutatorContext interface { @@ -281,8 +269,8 @@ type BottomUpMutatorContext interface { } // An outgoingTransitionContextImpl and incomingTransitionContextImpl is created for every dependency of every module -// for each transition mutator. bottomUpMutatorContext and topDownMutatorContext are created once for every module -// for every BottomUp or TopDown mutator. Use a global pool for each to avoid reallocating every time. +// for each transition mutator. bottomUpMutatorContext is created once for every module for every BottomUp mutator. +// Use a global pool for each to avoid reallocating every time. var ( outgoingTransitionContextPool = sync.Pool{ New: func() any { return &outgoingTransitionContextImpl{} }, @@ -293,10 +281,6 @@ var ( bottomUpMutatorContextPool = sync.Pool{ New: func() any { return &bottomUpMutatorContext{} }, } - - topDownMutatorContextPool = sync.Pool{ - New: func() any { return &topDownMutatorContext{} }, - } ) type bottomUpMutatorContext struct { @@ -371,24 +355,6 @@ func (x *registerMutatorsContext) mutatorName(name string) string { return name } -func (x *registerMutatorsContext) TopDown(name string, m TopDownMutator) MutatorHandle { - f := func(ctx blueprint.TopDownMutatorContext) { - if a, ok := ctx.Module().(Module); ok { - moduleContext := a.base().baseModuleContextFactory(ctx) - actx := topDownMutatorContextPool.Get().(*topDownMutatorContext) - defer topDownMutatorContextPool.Put(actx) - *actx = topDownMutatorContext{ - bp: ctx, - baseModuleContext: moduleContext, - } - m(actx) - } - } - mutator := &mutator{name: x.mutatorName(name), topDownMutator: f} - x.mutators = append(x.mutators, mutator) - return mutator -} - func (mutator *mutator) componentName() string { return mutator.name } @@ -398,8 +364,6 @@ func (mutator *mutator) register(ctx *Context) { var handle blueprint.MutatorHandle if mutator.bottomUpMutator != nil { handle = blueprintCtx.RegisterBottomUpMutator(mutator.name, mutator.bottomUpMutator) - } else if mutator.topDownMutator != nil { - handle = blueprintCtx.RegisterTopDownMutator(mutator.name, mutator.topDownMutator) } else if mutator.transitionMutator != nil { handle := blueprintCtx.RegisterTransitionMutator(mutator.name, mutator.transitionMutator) if mutator.neverFar { @@ -529,11 +493,11 @@ func registerDepsMutator(ctx RegisterMutatorsContext) { ctx.BottomUp("deps", depsMutator).UsesReverseDependencies() } -// android.topDownMutatorContext either has to embed blueprint.TopDownMutatorContext, in which case every method that +// android.bottomUpMutatorContext either has to embed blueprint.BottomUpMutatorContext, in which case every method that // has an overridden version in android.BaseModuleContext has to be manually forwarded to BaseModuleContext to avoid -// ambiguous method errors, or it has to store a blueprint.TopDownMutatorContext non-embedded, in which case every +// ambiguous method errors, or it has to store a blueprint.BottomUpMutatorContext non-embedded, in which case every // non-overridden method has to be forwarded. There are fewer non-overridden methods, so use the latter. The following -// methods forward to the identical blueprint versions for topDownMutatorContext and bottomUpMutatorContext. +// methods forward to the identical blueprint versions for bottomUpMutatorContext. func (b *bottomUpMutatorContext) Rename(name string) { b.bp.Rename(name) |