[Libreoffice-commits] online.git: loolwsd/TileCache.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon May 2 02:53:45 UTC 2016
loolwsd/TileCache.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
New commits:
commit c913e8e135e871d58d21fa4b1f5b707d746c44fa
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun May 1 20:34:39 2016 -0400
loolwsd: assert when we should be called with lock acquired
Change-Id: If784dbbfe6ca687fff181f623e413e9b86d51807
Reviewed-on: https://gerrit.libreoffice.org/24580
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/TileCache.cpp b/loolwsd/TileCache.cpp
index 39bc587..6d42158 100644
--- a/loolwsd/TileCache.cpp
+++ b/loolwsd/TileCache.cpp
@@ -89,8 +89,9 @@ std::shared_ptr<TileCache::TileBeingRendered> TileCache::findTileBeingRendered(i
{
const std::string cachedName = cacheFileName(part, width, height, tilePosX, tilePosY, tileWidth, tileHeight);
- const auto tile = _tilesBeingRendered.find(cachedName);
+ assert(!_tilesBeingRenderedMutex.try_lock());
+ const auto tile = _tilesBeingRendered.find(cachedName);
return (tile != _tilesBeingRendered.end() ? tile->second : nullptr);
}
@@ -98,8 +99,9 @@ void TileCache::forgetTileBeingRendered(int part, int width, int height, int til
{
const std::string cachedName = cacheFileName(part, width, height, tilePosX, tilePosY, tileWidth, tileHeight);
- assert(_tilesBeingRendered.find(cachedName) != _tilesBeingRendered.end());
+ assert(!_tilesBeingRenderedMutex.try_lock());
+ assert(_tilesBeingRendered.find(cachedName) != _tilesBeingRendered.end());
_tilesBeingRendered.erase(cachedName);
}
@@ -109,6 +111,7 @@ std::unique_ptr<std::fstream> TileCache::lookupTile(int part, int width, int hei
std::unique_ptr<std::fstream> result(new std::fstream(fileName, std::ios::in));
UnitWSD::get().lookupTile(part, width, height, tilePosX, tilePosY, tileWidth, tileHeight, result);
+
if (result && result->is_open())
{
Log::trace("Found cache tile: " + fileName);
More information about the Libreoffice-commits
mailing list