[Libreoffice-commits] online.git: loolwsd/DocumentBroker.cpp

Ashod Nakashian ashod.nakashian at collabora.co.uk
Thu May 5 02:34:11 UTC 2016


 loolwsd/DocumentBroker.cpp |   35 ++++++++++++++---------------------
 1 file changed, 14 insertions(+), 21 deletions(-)

New commits:
commit fedb3f520a5841ac946a5283a4a8193f08c7bd18
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Wed May 4 21:14:39 2016 -0400

    loolwsd: factored out common tile message
    
    Change-Id: I39600821e3c9c40f3a63343b167cddb3e42b7072
    Reviewed-on: https://gerrit.libreoffice.org/24667
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loolwsd/DocumentBroker.cpp b/loolwsd/DocumentBroker.cpp
index 9f5c0a3..e3b2b0e 100644
--- a/loolwsd/DocumentBroker.cpp
+++ b/loolwsd/DocumentBroker.cpp
@@ -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::ostringstream oss;
+    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)
     {
-        std::ostringstream oss;
-        oss << "tile: part=" << part
-            << " width=" << width
-            << " height=" << height
-            << " tileposx=" << tilePosX
-            << " tileposy=" << tilePosY
-            << " tilewidth=" << tileWidth
-            << " tileheight=" << tileHeight;
-
 #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());
 }


More information about the Libreoffice-commits mailing list