void RuleSet::compactPendingRules(PendingRuleMap& pendingMap, CompactRuleMap& compactMap) { for (auto& item : pendingMap) { OwnPtrWillBeRawPtr<WillBeHeapLinkedStack<RuleData>> pendingRules = item.value.release(); CompactRuleMap::ValueType* compactRules = compactMap.add(item.key, nullptr).storedValue; WillBeHeapTerminatedArrayBuilder<RuleData> builder(compactRules->value.release()); builder.grow(pendingRules->size()); while (!pendingRules->isEmpty()) { builder.append(pendingRules->peek()); pendingRules->pop(); } compactRules->value = builder.release(); } }
void RuleSet::compactPendingRules(PendingRuleMap& pendingMap, CompactRuleMap& compactMap) { PendingRuleMap::iterator end = pendingMap.end(); for (PendingRuleMap::iterator it = pendingMap.begin(); it != end; ++it) { OwnPtr<LinkedStack<RuleData> > pendingRules = it->value.release(); CompactRuleMap::ValueType* compactRules = compactMap.add(it->key, nullptr).storedValue; TerminatedArrayBuilder<RuleData> builder(compactRules->value.release()); builder.grow(pendingRules->size()); while (!pendingRules->isEmpty()) { builder.append(pendingRules->peek()); pendingRules->pop(); } compactRules->value = builder.release(); } }