| 137 | } |
| 138 | |
| 139 | string ResourceMgr::DebugString() const { |
| 140 | mutex_lock l(mu_); |
| 141 | struct Line { |
| 142 | const string* container; |
| 143 | const string type; |
| 144 | const string* resource; |
| 145 | const string detail; |
| 146 | }; |
| 147 | std::vector<Line> lines; |
| 148 | for (const auto& p : containers_) { |
| 149 | const string& container = p.first; |
| 150 | for (const auto& q : *p.second) { |
| 151 | const Key& key = q.first; |
| 152 | const char* type = DebugTypeName(key.first); |
| 153 | const string& resource = key.second; |
| 154 | Line l{&container, port::Demangle(type), q.second.name.get(), |
| 155 | q.second.resource->DebugString()}; |
| 156 | lines.push_back(l); |
| 157 | } |
| 158 | } |
| 159 | std::vector<string> text; |
| 160 | text.reserve(lines.size()); |
| 161 | for (const Line& line : lines) { |
| 162 | text.push_back(strings::Printf( |
| 163 | "%-20s | %-40s | %-40s | %-s", line.container->c_str(), |
| 164 | line.type.c_str(), line.resource->c_str(), line.detail.c_str())); |
| 165 | } |
| 166 | std::sort(text.begin(), text.end()); |
| 167 | return absl::StrJoin(text, "\n"); |
| 168 | } |
| 169 | |
| 170 | Status ResourceMgr::DoCreate(const string& container, TypeIndex type, |
| 171 | const string& name, ResourceBase* resource) { |
nothing calls this directly
no test coverage detected