Skip to content

Commit

Permalink
Assert that cache load is a success (#2756)
Browse files Browse the repository at this point in the history
mCache->loadCache() should always succeed given that
mCache->hasCache() had just returned true.
  • Loading branch information
hevrard authored May 17, 2019
1 parent ce76367 commit 36df861
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gapir/cc/cached_resource_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "cached_resource_loader.h"
#include "resource.h"

#include "core/cc/assert.h"

#include <utility>
#include <vector>

Expand Down Expand Up @@ -57,15 +59,14 @@ bool CachedResourceLoader::load(const Resource* resources, size_t count,
return false; // Not enough space
}

bool succeeded = true;

ResourceLoadingBatch batch;
uint8_t* dst = reinterpret_cast<uint8_t*>(target);
for (size_t i = 0; i < count; i++) {
const auto& r = resources[i];
// Check cache first
if (mCache->hasCache(r)) {
succeeded &= mCache->loadCache(r, static_cast<void*>(dst));
bool cache_load_success = mCache->loadCache(r, static_cast<void*>(dst));
GAPID_ASSERT(cache_load_success);
dst += r.size;
continue;
}
Expand All @@ -92,4 +93,4 @@ bool CachedResourceLoader::load(const Resource* resources, size_t count,
return true;
}

} // namespace gapir
} // namespace gapir

0 comments on commit 36df861

Please sign in to comment.