[Libreoffice-commits] online.git: loolwsd/ChildSession.cpp loolwsd/ChildSession.hpp loolwsd/LibreOfficeKit.hpp loolwsd/LOOLKit.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Mon Jul 18 02:50:05 UTC 2016
loolwsd/ChildSession.cpp | 3 +--
loolwsd/ChildSession.hpp | 2 +-
loolwsd/LOOLKit.cpp | 40 ++++++++++++++++++++--------------------
loolwsd/LibreOfficeKit.hpp | 3 +++
4 files changed, 25 insertions(+), 23 deletions(-)
New commits:
commit 6536ba2fe218d26940af12baff2f61b41ccc7300
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Sun Jul 17 12:29:15 2016 -0400
loolwsd: correct multiview creation
Change-Id: Id6675f6410793b743aec53182a4b5756b7cffa23
Reviewed-on: https://gerrit.libreoffice.org/27272
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 7923519..73738b2 100644
--- a/loolwsd/ChildSession.cpp
+++ b/loolwsd/ChildSession.cpp
@@ -609,7 +609,6 @@ bool ChildSession::loadDocument(const char * /*buffer*/, int /*length*/, StringT
if (_multiView)
{
_viewId = _loKitDocument->getView();
- _loKitDocument->initializeForRendering((renderOpts.empty() ? nullptr : renderOpts.c_str()));
}
_docType = LOKitHelper::getDocumentTypeAsString(_loKitDocument->get());
@@ -619,7 +618,7 @@ bool ChildSession::loadDocument(const char * /*buffer*/, int /*length*/, StringT
}
// Respond by the document status, which has no arguments.
- Log::debug("Sending status after load.");
+ Log::debug("Sending status after loading view " + std::to_string(_viewId) + ".");
if (!getStatus(nullptr, 0))
return false;
diff --git a/loolwsd/ChildSession.hpp b/loolwsd/ChildSession.hpp
index aa17be8..72b4883 100644
--- a/loolwsd/ChildSession.hpp
+++ b/loolwsd/ChildSession.hpp
@@ -44,7 +44,7 @@ public:
bool getPartPageRectangles(const char *buffer, int length);
virtual void disconnect() override;
- int getViewId() const { return _viewId; }
+ int getViewId() const { return _viewId; }
const std::string& getDocType() const { return _docType; }
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index f1a89b6..1c02554 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -901,26 +901,9 @@ private:
return nullptr;
}
- // initializeForRendering() should be called before
- // registerCallback(), as the previous creates a new view in
- // Impress.
- _loKitDocument->initializeForRendering((renderOpts.empty() ? nullptr : renderOpts.c_str()));
-
- if (_multiView)
- {
- Log::info("Loading view to document from URI: [" + uri + "] for session [" + sessionId + "].");
- const auto viewId = _loKitDocument->createView();
-
- _loKitDocument->registerCallback(DocumentCallback, this);
-
- Log::info() << "Document [" << _url << "] view ["
- << viewId << "] loaded, leaving "
- << (_clientViews + 1) << " views." << Log::end;
- }
- else
- {
- _loKitDocument->registerCallback(DocumentCallback, this);
- }
+ // Only save the options on opening the document.
+ // No support for changing them after opening a document.
+ _renderOpts = renderOpts;
}
else
{
@@ -945,6 +928,22 @@ private:
}
}
+ if (_multiView)
+ {
+ Log::info("Loading view to document from URI: [" + uri + "] for session [" + sessionId + "].");
+ const auto viewId = _loKitDocument->createView();
+
+ Log::info() << "Document [" << _url << "] view ["
+ << viewId << "] loaded, leaving "
+ << (_clientViews + 1) << " views." << Log::end;
+ }
+
+ // initializeForRendering() should be called before
+ // registerCallback(), as the previous creates a new view in Impress.
+ _loKitDocument->initializeForRendering(_renderOpts.c_str());
+
+ _loKitDocument->registerCallback(DocumentCallback, this);
+
return _loKitDocument;
}
@@ -956,6 +955,7 @@ private:
const std::string _docKey;
const std::string _url;
std::string _jailedUrl;
+ std::string _renderOpts;
std::shared_ptr<lok::Document> _loKitDocument;
diff --git a/loolwsd/LibreOfficeKit.hpp b/loolwsd/LibreOfficeKit.hpp
index 91dea2d..326d996 100644
--- a/loolwsd/LibreOfficeKit.hpp
+++ b/loolwsd/LibreOfficeKit.hpp
@@ -405,6 +405,7 @@ public:
int createView()
{
std::unique_lock<std::mutex> lock(_mutex);
+ Log::trace() << "lok::Document: createView" << Log::end;
return _pDoc->pClass->createView(_pDoc);
}
@@ -415,6 +416,7 @@ public:
void destroyView(int nId)
{
std::unique_lock<std::mutex> lock(_mutex);
+ Log::trace() << "lok::Document: destroyView: " << nId << Log::end;
_pDoc->pClass->destroyView(_pDoc, nId);
}
@@ -425,6 +427,7 @@ public:
void setView(int nId)
{
std::unique_lock<std::mutex> lock(_mutex);
+ Log::trace() << "lok::Document: setView: " << nId << Log::end;
_pDoc->pClass->setView(_pDoc, nId);
}
More information about the Libreoffice-commits
mailing list