MCPcopy Create free account
hub / github.com/IENT/YUView / clearFileCache

Method clearFileCache

YUViewLib/src/filesource/FileSource.cpp:346–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344}
345
346void FileSource::clearFileCache()
347{
348 if (!this->isFileOpened)
349 return;
350
351#ifdef Q_OS_WIN
352 // Currently, we only support this on windows. But this is only used in performance testing.
353 // We will close the QFile, open it using the FILE_FLAG_NO_BUFFERING flags, close it and reopen
354 // the QFile. Suggested:
355 // http://stackoverflow.com/questions/478340/clear-file-cache-to-repeat-performance-testing
356 QMutexLocker locker(&this->readMutex);
357 this->srcFile.close();
358
359 LPCWSTR file = (const wchar_t *)this->fullFilePath.utf16();
360 HANDLE hFile =
361 CreateFile(file, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
362 CloseHandle(hFile);
363
364 this->srcFile.setFileName(this->fullFilePath);
365 this->srcFile.open(QIODevice::ReadOnly);
366#endif
367}

Callers 1

cacheFrameMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected