[Libreoffice-commits] online.git: loolwsd/ChildSession.cpp loolwsd/ChildSession.hpp loolwsd/LibreOfficeKit.hpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Aug 15 03:08:02 UTC 2016
loolwsd/ChildSession.cpp | 14 +-------------
loolwsd/ChildSession.hpp | 14 ++++----------
loolwsd/LibreOfficeKit.hpp | 8 ++++++--
3 files changed, 11 insertions(+), 25 deletions(-)
New commits:
commit 58468c76be771a7b1fc0b7372c2c5cb3c4b5b44a
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sat Aug 13 12:14:44 2016 -0400
loolwsd: cleaned up ChildSession public members
Change-Id: I4bfc008859edb979688ece89d99af227ea3d0416
Reviewed-on: https://gerrit.libreoffice.org/28123
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loolwsd/ChildSession.cpp b/loolwsd/ChildSession.cpp
index dbc1a5c..9a89b66 100644
--- a/loolwsd/ChildSession.cpp
+++ b/loolwsd/ChildSession.cpp
@@ -118,19 +118,7 @@ public:
{
case LOK_CALLBACK_INVALIDATE_TILES:
{
- const auto lokitDoc = _session.getLoKitDocument();
- if (lokitDoc == nullptr)
- {
- return;
- }
-
- assert(lokitDoc->pClass);
- assert(lokitDoc->pClass->getPart);
-
- // Text docs have a single coordinate system.
- const auto curPart = (_session.getDocType() == "text")
- ? 0
- : lokitDoc->pClass->getPart(lokitDoc);
+ const auto curPart = _session.getPart();
StringTokenizer tokens(rPayload, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
if (tokens.count() == 4)
diff --git a/loolwsd/ChildSession.hpp b/loolwsd/ChildSession.hpp
index 7045a04..1481a9f 100644
--- a/loolwsd/ChildSession.hpp
+++ b/loolwsd/ChildSession.hpp
@@ -42,21 +42,16 @@ public:
bool getStatus(const char *buffer, int length);
bool getPartPageRectangles(const char *buffer, int length);
- virtual void disconnect() override;
-
unsigned getViewId() const { return _viewId; }
+ int getPart() const { return _loKitDocument->getPart(); }
- const std::string& getDocType() const { return _docType; }
-
- LibreOfficeKitDocument *getLoKitDocument() const { return (_loKitDocument ? _loKitDocument->get() : nullptr); }
+ void setDocState(const int type, const std::string& payload) { _lastDocStates[type] = payload; }
void loKitCallback(const int nType, const std::string& payload);
static std::unique_lock<std::recursive_mutex> getLock() { return std::unique_lock<std::recursive_mutex>(Mutex); }
- void setDocState(const int type, const std::string& payload) { _lastDocStates[type] = payload; }
-
- protected:
+private:
bool loadDocument(const char *buffer, int length, Poco::StringTokenizer& tokens);
bool sendFontRendering(const char *buffer, int length, Poco::StringTokenizer& tokens);
@@ -79,8 +74,7 @@ public:
bool setClientPart(const char *buffer, int length, Poco::StringTokenizer& tokens);
bool setPage(const char *buffer, int length, Poco::StringTokenizer& tokens);
-private:
-
+ virtual void disconnect() override;
virtual bool _handleInput(const char *buffer, int length) override;
private:
diff --git a/loolwsd/LibreOfficeKit.hpp b/loolwsd/LibreOfficeKit.hpp
index 326d996..4e2aab0 100644
--- a/loolwsd/LibreOfficeKit.hpp
+++ b/loolwsd/LibreOfficeKit.hpp
@@ -41,7 +41,9 @@ public:
}
/// This lock must be held while calling
- /// one or more member of this class.
+ /// one or more members of this class if
+ /// the client is multi-threaded.
+ /// No member function takes this lock otherwise.
std::unique_lock<std::mutex> getLock()
{
return std::unique_lock<std::mutex>(_mutex);
@@ -110,9 +112,11 @@ public:
}
/// Get the current part of the document.
+ /// Note: For Writer documents this always returns 0
+ /// since text docs have a single coordinate system.
inline int getPart()
{
- return _pDoc->pClass->getPart(_pDoc);
+ return getDocumentType() == LOK_DOCTYPE_TEXT ? 0 : _pDoc->pClass->getPart(_pDoc);
}
/// Set the current part of the document.
More information about the Libreoffice-commits
mailing list