loolwsd/ChildProcessSession.cpp | 30 +++++++++++++++--------------- loolwsd/ChildProcessSession.hpp | 1 - loolwsd/MasterProcessSession.cpp | 5 ----- 3 files changed, 15 insertions(+), 21 deletions(-)
New commits: commit 200c6a9281dfd68b6a86bcc5b61f3951a384f40e Author: Henry Castro <hcas...@collabora.com> Date: Wed Apr 27 13:47:58 2016 -0400 loolwsd: rework setclientpart diff --git a/loolwsd/ChildProcessSession.cpp b/loolwsd/ChildProcessSession.cpp index a6cd86d..45ac69d 100644 --- a/loolwsd/ChildProcessSession.cpp +++ b/loolwsd/ChildProcessSession.cpp @@ -284,7 +284,6 @@ ChildProcessSession::ChildProcessSession(const std::string& id, _multiView(std::getenv("LOK_VIEW_CALLBACK")), _jailId(jailId), _viewId(0), - _clientPart(0), _onLoad(onLoad), _onUnload(onUnload), _callbackWorker(new CallbackWorker(_callbackQueue, *this)) @@ -459,18 +458,6 @@ bool ChildProcessSession::_handleInput(const char *buffer, int length) tokens[0] == "userinactive" || tokens[0] == "editlock:"); - { - std::unique_lock<std::recursive_mutex> lock(Mutex); - - if (_multiView) - _loKitDocument->pClass->setView(_loKitDocument, _viewId); - - if (_docType != "text" && _loKitDocument->pClass->getPart(_loKitDocument) != _clientPart) - { - _loKitDocument->pClass->setPart(_loKitDocument, _clientPart); - } - } - if (tokens[0] == "clientzoom") { return clientZoom(buffer, length, tokens); @@ -593,7 +580,6 @@ bool ChildProcessSession::loadDocument(const char * /*buffer*/, int /*length*/, if (_docType != "text" && part != -1) { - _clientPart = part; _loKitDocument->pClass->setPart(_loKitDocument, part); } @@ -1345,11 +1331,25 @@ bool ChildProcessSession::saveAs(const char* /*buffer*/, int /*length*/, StringT bool ChildProcessSession::setClientPart(const char* /*buffer*/, int /*length*/, StringTokenizer& tokens) { + int part; if (tokens.count() < 2 || - !getTokenInteger(tokens[1], "part", _clientPart)) + !getTokenInteger(tokens[1], "part", part)) { + sendTextFrame("error: cmd=setclientpart kind=invalid"); return false; } + + std::unique_lock<std::recursive_mutex> lock(Mutex); + + if (part == _loKitDocument->pClass->getPart(_loKitDocument)) + return true; + + if (_multiView) + _loKitDocument->pClass->setView(_loKitDocument, _viewId); + + _loKitDocument->pClass->setPart(_loKitDocument, part); + // invalidate all + loKitCallback(LOK_CALLBACK_INVALIDATE_TILES, std::string("EMPTY").c_str()); return true; } diff --git a/loolwsd/ChildProcessSession.hpp b/loolwsd/ChildProcessSession.hpp index 3fb82b1..39b6d51 100644 --- a/loolwsd/ChildProcessSession.hpp +++ b/loolwsd/ChildProcessSession.hpp @@ -99,7 +99,6 @@ private: const std::string _jailId; /// View ID, returned by createView() or 0 by default. int _viewId; - int _clientPart; std::map<int, std::string> _lastDocStates; std::function<LibreOfficeKitDocument*(const std::string&, const std::string&, const std::string&, bool)> _onLoad; std::function<void(const std::string&)> _onUnload; diff --git a/loolwsd/MasterProcessSession.cpp b/loolwsd/MasterProcessSession.cpp index 9ccab85..ee74bd0 100644 --- a/loolwsd/MasterProcessSession.cpp +++ b/loolwsd/MasterProcessSession.cpp @@ -351,11 +351,6 @@ bool MasterProcessSession::_handleInput(const char *buffer, int length) dispatchChild(); } - if (tokens[0] == "setclientpart") - { - _docBroker->tileCache().removeFile("status.txt"); - } - // Allow 'downloadas' for all kinds of views irrespective of editlock if (_kind == Kind::ToClient && !isEditLocked() && tokens[0] != "downloadas" && tokens[0] != "userinactive" && tokens[0] != "useractive") _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits