Only register mutators once
am: 4498afc55b
Change-Id: Ibfec9f690be83e8997e850380e16a0a6fe3facdd
This commit is contained in:
@@ -14,7 +14,11 @@
|
|||||||
|
|
||||||
package android
|
package android
|
||||||
|
|
||||||
import "github.com/google/blueprint"
|
import (
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"github.com/google/blueprint"
|
||||||
|
)
|
||||||
|
|
||||||
type moduleType struct {
|
type moduleType struct {
|
||||||
name string
|
name string
|
||||||
@@ -47,6 +51,8 @@ func RegisterSingletonType(name string, factory blueprint.SingletonFactory) {
|
|||||||
singletons = append(singletons, singleton{name, factory})
|
singletons = append(singletons, singleton{name, factory})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var registerMutatorsOnce sync.Once
|
||||||
|
|
||||||
func NewContext() *blueprint.Context {
|
func NewContext() *blueprint.Context {
|
||||||
ctx := blueprint.NewContext()
|
ctx := blueprint.NewContext()
|
||||||
|
|
||||||
@@ -58,7 +64,7 @@ func NewContext() *blueprint.Context {
|
|||||||
ctx.RegisterSingletonType(t.name, t.factory)
|
ctx.RegisterSingletonType(t.name, t.factory)
|
||||||
}
|
}
|
||||||
|
|
||||||
registerMutators()
|
registerMutatorsOnce.Do(registerMutators)
|
||||||
|
|
||||||
for _, t := range mutators {
|
for _, t := range mutators {
|
||||||
var handle blueprint.MutatorHandle
|
var handle blueprint.MutatorHandle
|
||||||
|
Reference in New Issue
Block a user