MCPcopy Create free account
hub / github.com/Snapchat/Valdi / removeUnusedItems

Function removeUnusedItems

valdi/src/valdi/runtime/Resources/Bundle.cpp:295–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293
294template<typename T>
295void removeUnusedItems(FlatMap<StringBox, T>& items) {
296 auto it = items.begin();
297 while (it != items.end()) {
298 if (it->second.use_count() == 1) {
299 it = items.erase(it);
300 } else {
301 ++it;
302 }
303 }
304}
305
306void Bundle::unloadUnusedResources() {
307 std::lock_guard<std::recursive_mutex> guard(_mutex);

Callers 1

unloadUnusedResourcesMethod · 0.85

Calls 4

use_countMethod · 0.80
endMethod · 0.65
beginMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected