[Libreoffice-commits] online.git: loolwsd/ChildProcessSession.cpp
Tor Lillqvist
tml at collabora.com
Mon Apr 18 15:30:46 UTC 2016
loolwsd/ChildProcessSession.cpp | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
New commits:
commit bbcc70c69fbe7d2b4a54155992efef49c8efb869
Author: Tor Lillqvist <tml at collabora.com>
Date: Fri Apr 15 17:13:04 2016 +0300
Add debug hack to intentionally slow down tile rendering
When compiled with --enable-debug, when requesting a tile for part=42,
actually use part=0, and sleep five seconds before passing the
rendered tile back up. This makes it easier to debug handling of
simultaneous requests for the same tile from multiple clients.
diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp
index 553fa4c..ac8b8a0 100644
--- a/loolwsd/ChildProcessSession.cpp
+++ b/loolwsd/ChildProcessSession.cpp
@@ -7,7 +7,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
+#include "config.h"
+
#include <iostream>
+#include <thread>
#include <Poco/Exception.h>
#include <Poco/JSON/Object.h>
@@ -675,6 +678,15 @@ void ChildProcessSession::sendTile(const char* /*buffer*/, int /*length*/, Strin
std::vector<unsigned char> pixmap;
pixmap.resize(4 * width * height);
+#if ENABLE_DEBUG
+ bool makeSlow = false;
+ if (part == 42)
+ {
+ makeSlow = true;
+ part = 0;
+ }
+#endif
+
if (_docType != "text" && part != _loKitDocument->pClass->getPart(_loKitDocument))
{
_loKitDocument->pClass->setPart(_loKitDocument, part);
@@ -693,6 +705,14 @@ void ChildProcessSession::sendTile(const char* /*buffer*/, int /*length*/, Strin
return;
}
+#if ENABLE_DEBUG
+ if (makeSlow)
+ {
+ Log::debug("Sleeping for 5 seconds");
+ std::this_thread::sleep_for(std::chrono::seconds(5));
+ }
+#endif
+
sendBinaryFrame(output.data(), output.size());
}
More information about the Libreoffice-commits
mailing list