[Libreoffice-commits] online.git: loolwsd/bundled loolwsd/ChildSession.cpp loolwsd/LibreOfficeKit.hpp loolwsd/LOOLKit.cpp

Marco Cecchetti marco.cecchetti at collabora.com
Sat Sep 10 19:36:03 UTC 2016


 loolwsd/ChildSession.cpp                                |    1 +
 loolwsd/LOOLKit.cpp                                     |    1 +
 loolwsd/LibreOfficeKit.hpp                              |   11 +++++++++++
 loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h |    5 +++++
 4 files changed, 18 insertions(+)

New commits:
commit ed983f17cbf2627ff7b1b1a04af03449bd18ff6b
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Sat Sep 10 21:07:12 2016 +0200

    loolwsd: we use callbacks latch for not missing messages sent very early
    
    - lok::Document::setCallbackLatch: used on doument loading for
    set/unset the latch
    
    - now cell cursors of other views are correctly notified to the new
    view

diff --git a/loolwsd/ChildSession.cpp b/loolwsd/ChildSession.cpp
index 93a2312..9c3e3dc 100644
--- a/loolwsd/ChildSession.cpp
+++ b/loolwsd/ChildSession.cpp
@@ -356,6 +356,7 @@ bool ChildSession::loadDocument(const char * /*buffer*/, int /*length*/, StringT
 
     // Inform this view of other views
     _docManager.notifyCurrentViewOfOtherViews(getId());
+    _loKitDocument->setCallbackLatch(false);
 
     Log::info("Loaded session " + getId());
     return true;
diff --git a/loolwsd/LOOLKit.cpp b/loolwsd/LOOLKit.cpp
index 94c0846..94d02ef 100644
--- a/loolwsd/LOOLKit.cpp
+++ b/loolwsd/LOOLKit.cpp
@@ -1139,6 +1139,7 @@ private:
             _viewIdToCallbackDescr.emplace(viewId,
                                            std::unique_ptr<CallbackDescriptor>(new CallbackDescriptor({ this, viewId })));
             _loKitDocument->registerCallback(ViewCallback, _viewIdToCallbackDescr[viewId].get());
+            _loKitDocument->setCallbackLatch(true);
 
             Log::info() << "Document [" << _url << "] view ["
                         << viewId << "] loaded, leaving "
diff --git a/loolwsd/LibreOfficeKit.hpp b/loolwsd/LibreOfficeKit.hpp
index 5881c77..d718edd 100644
--- a/loolwsd/LibreOfficeKit.hpp
+++ b/loolwsd/LibreOfficeKit.hpp
@@ -464,6 +464,17 @@ public:
                                             nTileWidth, nTileHeight);
     }
 
+    /**
+     * Enable/disable callbacks latch. LOK will set the latch when it wants to
+     * queue new callbacks but not flush them.
+     *
+     * @param bCallbackLatch: true enables the latch, false disables it.
+     */
+    inline void setCallbackLatch(bool bCallbackLatch)
+    {
+        _pDoc->pClass->setCallbackLatch(_pDoc, bCallbackLatch);
+    }
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 
diff --git a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h
index 81d65c1..6a8388d 100644
--- a/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/loolwsd/bundled/include/LibreOfficeKit/LibreOfficeKit.h
@@ -244,6 +244,11 @@ struct _LibreOfficeKitDocumentClass
                            const int nTileWidth,
                            const int nTileHeight);
 
+
+    /// @see lok::Document::setCallbackLatch().
+    void (*setCallbackLatch) (LibreOfficeKitDocument* pThis,
+                              bool bCallbackLatch);
+
 #endif // defined LOK_USE_UNSTABLE_API || defined LIBO_INTERNAL_ONLY
 };
 


More information about the Libreoffice-commits mailing list