[Libreoffice-commits] online.git: 3 commits - wsd/DocumentBroker.cpp wsd/DocumentBroker.hpp wsd/Storage.hpp

Tor Lillqvist tml at collabora.com
Mon Dec 19 12:34:46 UTC 2016


 wsd/DocumentBroker.cpp |    5 +++++
 wsd/DocumentBroker.hpp |    1 +
 wsd/Storage.hpp        |    4 ++--
 3 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 45aad66e65ea42a6329b5f629801ed447328b265
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Dec 19 14:14:00 2016 +0200

    Inititalize _fileInfo's dummy timestamp in StorageBase ctor as the epoch
    
    And not as the current time. The getLocalFileInfo() and
    getWOPIFileInfo() functions will reset it anyway.
    
    Change-Id: Ief821482cf789113cecd85e5d59afecf6ad2c3ab

diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp
index c0099d9..d44f2fe 100644
--- a/wsd/Storage.hpp
+++ b/wsd/Storage.hpp
@@ -67,7 +67,7 @@ public:
         _uri(uri),
         _localStorePath(localStorePath),
         _jailPath(jailPath),
-        _fileInfo("", "lool", Poco::Timestamp(), 0),
+        _fileInfo("", "lool", Poco::Timestamp::fromEpochTime(0), 0),
         _isLoaded(false)
     {
         Log::debug("Storage ctor: " + uri.toString());
commit 889adad09a4a5101455853efd5e44caf0ba67feb
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Dec 19 14:06:01 2016 +0200

    As the code is now, no need for StorageBase::getFileInfo() to be virtual
    
    It would be another thing if it would be abstract and overridden in
    the concrete derived classes. But now it just returns the _fileInfo
    field that is set by the separate getLocalFileInfo() and
    getWOPIFileInfo() functions. Possibly this should be re-designed
    and/or stuff re-named for clarity.
    
    Change-Id: I30d01277ac0c6bd4b9daa317aade319b6ef39342

diff --git a/wsd/Storage.hpp b/wsd/Storage.hpp
index 58d7ecb..c0099d9 100644
--- a/wsd/Storage.hpp
+++ b/wsd/Storage.hpp
@@ -80,7 +80,7 @@ public:
     bool isLoaded() const { return _isLoaded; }
 
     /// Returns the basic information about the file.
-    virtual FileInfo getFileInfo() { return _fileInfo; }
+    FileInfo getFileInfo() { return _fileInfo; }
 
     /// Returns a local file path for the given URI.
     /// If necessary copies the file locally first.
commit a275fc7922e0527239a8735ec609947666d0de14
Author: Tor Lillqvist <tml at collabora.com>
Date:   Mon Dec 19 13:21:42 2016 +0200

    Keep track of the timestamp of the actual document in DocumentBroker object
    
    Not used yet, maybe later.
    
    Change-Id: I0e342fb1f0ebb486d6bfb799831760257c9ade1f

diff --git a/wsd/DocumentBroker.cpp b/wsd/DocumentBroker.cpp
index a9211be..819c602 100644
--- a/wsd/DocumentBroker.cpp
+++ b/wsd/DocumentBroker.cpp
@@ -228,6 +228,7 @@ bool DocumentBroker::load(std::shared_ptr<ClientSession>& session, const std::st
 
     LOG_INF("jailPath: " << jailPath.toString() << ", jailRoot: " << jailRoot);
 
+    bool firstInstance = false;
     if (_storage == nullptr)
     {
         // TODO: Maybe better to pass docKey to storage here instead of uriPublic here because
@@ -241,6 +242,7 @@ bool DocumentBroker::load(std::shared_ptr<ClientSession>& session, const std::st
             LOG_ERR("Failed to create Storage instance for [" << _docKey << "] in " << jailPath.toString());
             return false;
         }
+        firstInstance = true;
     }
 
     assert(_storage != nullptr);
@@ -315,6 +317,9 @@ bool DocumentBroker::load(std::shared_ptr<ClientSession>& session, const std::st
         return false;
     }
 
+    if (firstInstance)
+        _origDocumentLastModifiedTime = fileInfo._modifiedTime;
+
     // Lets load the document now
     const bool loaded = _storage->isLoaded();
     if (!loaded)
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp
index 5c5ed68..8ea840f 100644
--- a/wsd/DocumentBroker.hpp
+++ b/wsd/DocumentBroker.hpp
@@ -325,6 +325,7 @@ private:
     std::string _jailId;
     std::string _filename;
     std::chrono::steady_clock::time_point _lastSaveTime;
+    Poco::Timestamp _origDocumentLastModifiedTime;
     Poco::Timestamp _lastFileModifiedTime;
     std::map<std::string, std::shared_ptr<ClientSession> > _sessions;
     std::unique_ptr<StorageBase> _storage;


More information about the Libreoffice-commits mailing list