void RenderCounter::destroyCounterNode(RenderObject* owner, const AtomicString& identifier) { CounterMap* map = counterMaps().get(owner); if (!map) return; CounterMap::iterator mapIterator = map->find(identifier); if (mapIterator == map->end()) return; destroyCounterNodeWithoutMapRemoval(identifier, mapIterator->value.get()); map->remove(mapIterator); // We do not delete "map" here even if empty because we expect to reuse // it soon. In order for a renderer to lose all its counters permanently, // a style change for the renderer involving removal of all counter // directives must occur, in which case, RenderCounter::destroyCounterNodes() // must be called. // The destruction of the Renderer (possibly caused by the removal of its // associated DOM node) is the other case that leads to the permanent // destruction of all counters attached to a Renderer. In this case // RenderCounter::destroyCounterNodes() must be and is now called, too. // RenderCounter::destroyCounterNodes() handles destruction of the counter // map associated with a renderer, so there is no risk in leaking the map. }