loolwsd: factored out common tile message

Change-Id: I39600821e3c9c40f3a63343b167cddb3e42b7072
Reviewed-on: https://gerrit.libreoffice.org/24667
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
This commit is contained in:
Ashod Nakashian 2016-05-04 21:14:39 -04:00 committed by Ashod Nakashian
parent 4d52c200c5
commit fedb3f520a

View file

@ -397,26 +397,27 @@ void DocumentBroker::handleTileRequest(int part, int width, int height, int tile
<< ", tilePosX: " << tilePosX << ", tilePosY: " << tilePosY << ", tileWidth: " << tileWidth
<< ", tileHeight: " << tileHeight << Log::end;
std::unique_lock<std::mutex> lock(_mutex);
std::unique_ptr<std::fstream> cachedTile = tileCache().lookupTile(part, width, height, tilePosX, tilePosY, tileWidth, tileHeight);
if (cachedTile)
{
std::ostringstream oss;
oss << "tile: part=" << part
oss << " part=" << part
<< " width=" << width
<< " height=" << height
<< " tileposx=" << tilePosX
<< " tileposy=" << tilePosY
<< " tilewidth=" << tileWidth
<< " tileheight=" << tileHeight;
std::string tileMsg = oss.str();
std::unique_lock<std::mutex> lock(_mutex);
std::unique_ptr<std::fstream> cachedTile = tileCache().lookupTile(part, width, height, tilePosX, tilePosY, tileWidth, tileHeight);
if (cachedTile)
{
#if ENABLE_DEBUG
oss << " renderid=cached";
std::string response = "tile:" + tileMsg + " renderid=cached\n";
#else
std::string response = "tile:" + tileMsg + "\n";
#endif
oss << "\n";
const auto response = oss.str();
std::vector<char> output;
output.reserve(4 * width * height);
@ -442,15 +443,7 @@ void DocumentBroker::handleTileRequest(int part, int width, int height, int tile
return;
// Forward to child to render.
std::ostringstream oss;
oss << "tile part=" << part
<< " width=" << width
<< " height=" << height
<< " tileposx=" << tilePosX
<< " tileposy=" << tilePosY
<< " tilewidth=" << tileWidth
<< " tileheight=" << tileHeight;
const std::string request = oss.str();
const std::string request = "tile " + tileMsg;
_childProcess->getWebSocket()->sendFrame(request.data(), request.size());
}