1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 00:03:52 +02:00

Comment that cache-filling should be no-fail (we don't use it anyway)

This commit is contained in:
Paul Licameli
2017-03-20 11:18:30 -04:00
parent 54c1b0c955
commit 7159966eb4
5 changed files with 11 additions and 3 deletions

View File

@@ -78,7 +78,8 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
// Fill read cache of block file, if it has any // Fill read cache of block file, if it has any
virtual bool GetNeedFillCache() { return false; } virtual bool GetNeedFillCache() { return false; }
virtual void FillCache() { /* no cache by default */ }
virtual void FillCache() /* noexcept */ { /* no cache by default */ }
/// Stores a representation of this file in XML /// Stores a representation of this file in XML
virtual void SaveXML(XMLWriter &xmlFile) = 0; virtual void SaveXML(XMLWriter &xmlFile) = 0;

View File

@@ -177,7 +177,9 @@ class PROFILE_DLL_API DirManager final : public XMLTagHandler {
// Write all write-cached block files to disc, if any // Write all write-cached block files to disc, if any
void WriteCacheToDisk(); void WriteCacheToDisk();
// Fill cache of blockfiles, if caching is enabled (otherwise do nothing) // (Try to) fill cache of blockfiles, if caching is enabled (otherwise do
// nothing)
// A no-fail operation that does not throw
void FillBlockfilesCache(); void FillBlockfilesCache();
private: private:

View File

@@ -3145,6 +3145,7 @@ void AudacityProject::OpenFile(const wxString &fileNameArg, bool addtohistory)
mImportXMLTagHandler.reset(); mImportXMLTagHandler.reset();
if ( bParseSuccess ) { if ( bParseSuccess ) {
// This is a no-fail:
GetDirManager()->FillBlockfilesCache(); GetDirManager()->FillBlockfilesCache();
EnqueueODTasks(); EnqueueODTasks();
} }
@@ -4183,6 +4184,7 @@ bool AudacityProject::Import(const wxString &fileName, WaveTrackArray* pTrackArr
OnEffectFlags::kConfigured); OnEffectFlags::kConfigured);
} }
// This is a no-fail:
GetDirManager()->FillBlockfilesCache(); GetDirManager()->FillBlockfilesCache();
return true; return true;
} }

View File

@@ -267,6 +267,8 @@ bool SimpleBlockFile::WriteSimpleBlockFile(
return true; return true;
} }
// This function should try to fill the cache, but just return without effect
// (not throwing) if there is failure.
void SimpleBlockFile::FillCache() void SimpleBlockFile::FillCache()
{ {
if (mCache.active) if (mCache.active)

View File

@@ -82,7 +82,8 @@ class PROFILE_DLL_API SimpleBlockFile /* not final */ : public BlockFile {
void WriteCacheToDisk() override; void WriteCacheToDisk() override;
bool GetNeedFillCache() override { return !mCache.active; } bool GetNeedFillCache() override { return !mCache.active; }
void FillCache() override;
void FillCache() /* noexcept */ override;
protected: protected: