| 299 | } |
| 300 | |
| 301 | DiskCache::Entry* DiskCache::GetOrCreateEntry(const std::string& id, |
| 302 | bool create) { |
| 303 | EntryMap::iterator it = map_.find(id); |
| 304 | if (it != map_.end()) |
| 305 | return &it->second; |
| 306 | if (!create) |
| 307 | return NULL; |
| 308 | Entry e; |
| 309 | e.lock_state = LS_UNLOCKED; |
| 310 | e.accessors = 0; |
| 311 | e.size = 0; |
| 312 | e.streams = 0; |
| 313 | e.last_modified = time(0); |
| 314 | it = map_.insert(EntryMap::value_type(id, e)).first; |
| 315 | return &it->second; |
| 316 | } |
| 317 | |
| 318 | void DiskCache::ReleaseResource(const std::string& id, size_t index) const { |
| 319 | const Entry* entry = GetEntry(id); |
no test coverage detected