# File lib/puppet/transaction.rb, line 229
229:     def eval_children_and_apply_resource(resource)
230:         events = []
231: 
232:         @resourcemetrics[:scheduled] += 1
233: 
234:         changecount = @changes.length
235: 
236:         # We need to generate first regardless, because the recursive
237:         # actions sometimes change how the top resource is applied.
238:         children = eval_generate(resource)
239: 
240:         if ! children.empty? and resource.depthfirst?
241:             children.each do |child|
242:                 # The child will never be skipped when the parent isn't
243:                 events += eval_resource(child, false)
244:             end
245:         end
246: 
247:         # Perform the actual changes
248:         seconds = thinmark do
249:             events += apply(resource)
250:         end
251: 
252:         if ! children.empty? and ! resource.depthfirst?
253:             children.each do |child|
254:                 events += eval_resource(child)
255:             end
256:         end
257: 
258:         # A bit of hackery here -- if skipcheck is true, then we're the
259:         # top-level resource.  If that's the case, then make sure all of
260:         # the changes list this resource as a proxy.  This is really only
261:         # necessary for rollback, since we know the generating resource
262:         # during forward changes.
263:         unless children.empty?
264:             @changes[changecount..-1].each { |change| change.proxy = resource }
265:         end
266: 
267:         # Keep track of how long we spend in each type of resource
268:         @timemetrics[resource.class.name] += seconds
269: 
270:         events
271:     end