MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / updateComponentAtomUsage

Method updateComponentAtomUsage

tsunami/engine/rootelem.go:155–188  ·  view source on GitHub ↗
(comp *ComponentImpl, newUsedAtoms map[string]bool)

Source from the content-addressed store, hash-verified

153}
154
155func (r *RootElem) updateComponentAtomUsage(comp *ComponentImpl, newUsedAtoms map[string]bool) {
156 r.atomLock.Lock()
157 defer r.atomLock.Unlock()
158
159 oldUsedAtoms := comp.UsedAtoms
160
161 // Remove component from atoms it no longer uses
162 for atomName := range oldUsedAtoms {
163 if !newUsedAtoms[atomName] {
164 if atom, ok := r.Atoms[atomName]; ok {
165 atom.SetUsedBy(comp.WaveId, false)
166 }
167 }
168 }
169
170 // Add component to atoms it now uses
171 for atomName := range newUsedAtoms {
172 if !oldUsedAtoms[atomName] {
173 if atom, ok := r.Atoms[atomName]; ok {
174 atom.SetUsedBy(comp.WaveId, true)
175 }
176 }
177 }
178
179 // Update component's atom usage map
180 if len(newUsedAtoms) == 0 {
181 comp.UsedAtoms = nil
182 } else {
183 comp.UsedAtoms = make(map[string]bool)
184 for atomName := range newUsedAtoms {
185 comp.UsedAtoms[atomName] = true
186 }
187 }
188}
189
190func (r *RootElem) AtomAddRenderWork(atomName string) {
191 r.atomLock.Lock()

Callers 1

renderComponentMethod · 0.95

Calls 1

SetUsedByMethod · 0.65

Tested by

no test coverage detected