static void UpdateProcessInfo_Realtime(ProcessInfo& info, uint64_t now, uint32_t thisPid) { if (now - info.mLastRefreshTicks > 1000) { info.mLastRefreshTicks = now; char path[MAX_PATH] = "<error>"; HANDLE h = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, thisPid); if (h) { GetModuleFileNameExA(h, NULL, path, sizeof(path) - 1); std::string name = PathFindFileNameA(path); if (name != info.mModuleName) { info.mChainMap.clear(); info.mModuleName = name; } CloseHandle(h); } else { info.mChainMap.clear(); } } // remove chains without recent updates map_erase_if(info.mChainMap, [now](const std::pair<const uint64_t, SwapChainData>& entry) { return now - entry.second.mLastUpdateTicks > CHAIN_TIMEOUT_THRESHOLD_TICKS; }); }
void LoadedTextureCache::prepare(size_t frame, IterationMode mode) { if (frame != m_LastFrame) { m_ImageCache.cue(frame, mode); m_LastFrame = frame; } m_FrameMedia.clear(); TimelineIterator itr(&m_Timeline, &m_TimelineRanges, frame); itr.setMaxFrameIterations(2); // loading this frame and prefetching next one for (; !itr.empty();) { const auto mfr = itr.next(); m_FrameMedia.insert(mfr); if (m_Map.find(mfr) != m_Map.end()) // already in cache continue; PboPackedFrame pboPackedFrame; const auto pboReady = m_PboCache.get(m_ImageCache, mfr, pboPackedFrame); if (pboReady) m_Map.insert( { mfr, TexturePackedFrame(pboPackedFrame, m_TexturePool.get(pboPackedFrame.description)) }); } // discarding all textures expect those fetched during this call const auto isOutsideCurrentFrame = [&](const Map::value_type &pair) { return m_FrameMedia.find(pair.first)==end(m_FrameMedia); }; map_erase_if(m_Map, isOutsideCurrentFrame); }