Skip to content

Commit

Permalink
cleaned up
Browse files Browse the repository at this point in the history
  • Loading branch information
yuanming-hu committed Mar 18, 2019
1 parent d0eca42 commit 4b3c5bd
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions include/taichi/common/asset_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,11 @@ class AssetManager {

public:
AssetManager() {
TC_WARN("Creating new asset manager at {:x}", (long long)this);
}

// Note: this is not thread safe!
template <typename T>
std::shared_ptr<T> get_asset_(int id) {
TC_P(this);
TC_P(&id_to_asset);
TC_P(id_to_asset.size());
TC_P(id);
for (auto &it: id_to_asset) {
TC_P(it.first);
}
TC_ASSERT_INFO(id_to_asset.find(id) != id_to_asset.end(), "Asset not found");
auto ptr = id_to_asset[id];
TC_ASSERT_INFO(!ptr.expired(), "Asset has been expired");
Expand All @@ -48,18 +40,10 @@ class AssetManager {
TC_ASSERT_INFO(id_to_asset[existing_id].expired(), "Asset already exists");
asset_to_id.erase(ptr.get());
id_to_asset.erase(existing_id);
TC_INFO("erasing {}", existing_id);
}
int id = counter++;
id_to_asset[id] = static_cast<std::weak_ptr<void>>(std::weak_ptr<T>(ptr));
asset_to_id[ptr.get()] = id;
TC_P(id);
for (auto &it: id_to_asset) {
TC_P(it.first);
}
TC_P(id_to_asset.size());
TC_P(&id_to_asset);
TC_P(this);
return id;
}

Expand Down

0 comments on commit 4b3c5bd

Please sign in to comment.