diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2019-09-29 23:32:12 -0400 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-10-28 10:47:10 +0100 |
commit | ae8d28478b11b9228201f5157038c7632dc0086f (patch) | |
tree | a80218a63c7dd797ef8f2643667c1a8895199e72 | |
parent | wsd: allow longer timeout for child forking (diff) | |
download | online-ae8d28478b11b9228201f5157038c7632dc0086f.tar.gz online-ae8d28478b11b9228201f5157038c7632dc0086f.zip |
wsd: reduce public surface area of DocumentBroker
Reviewed-on: https://gerrit.libreoffice.org/80323
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
(cherry picked from commit 46bdda0186f98eb27d15507ce3cc63b64a106942)
Change-Id: If74bd1967f3725e81a6e381e883eac86104f9f40
Reviewed-on: https://gerrit.libreoffice.org/81561
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | wsd/DocumentBroker.hpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/wsd/DocumentBroker.hpp b/wsd/DocumentBroker.hpp index 5ab980a75b..4d66ffae32 100644 --- a/wsd/DocumentBroker.hpp +++ b/wsd/DocumentBroker.hpp @@ -240,9 +240,6 @@ public: /// Thread safe termination of this broker if it has a lingering thread void joinThread(); - /// Loads a document from the public URI into the jail. - bool load(const std::shared_ptr<ClientSession>& session, const std::string& jailId); - bool isLoaded() const { return _isLoaded; } void setLoaded(); bool isDocumentChangedInStorage() { return _documentChangedInStorage; } @@ -317,8 +314,6 @@ public: const std::shared_ptr<ClientSession>& session); void sendRequestedTiles(const std::shared_ptr<ClientSession>& session); void cancelTileRequests(const std::shared_ptr<ClientSession>& session); - void handleTileResponse(const std::vector<char>& payload); - void handleTileCombinedResponse(const std::vector<char>& payload); enum ClipboardRequest { CLIP_REQUEST_SET, @@ -343,26 +338,13 @@ public: /// Ask the document broker to close. Makes sure that the document is saved. void closeDocument(const std::string& reason); - /// Called by the ChildProcess object to notify - /// that it has terminated on its own. - /// This happens either when the child exists - /// or upon failing to process an incoming message. - void childSocketTerminated(); - /// Get the PID of the associated child process Poco::Process::PID getPid() const { return _childProcess ? _childProcess->getPid() : 0; } std::unique_lock<std::mutex> getLock() { return std::unique_lock<std::mutex>(_mutex); } - std::unique_lock<std::mutex> getDeferredLock() { return std::unique_lock<std::mutex>(_mutex, std::defer_lock); } void updateLastActivityTime(); - std::size_t getIdleTimeSecs() const - { - const auto duration = (std::chrono::steady_clock::now() - _lastActivityTime); - return std::chrono::duration_cast<std::chrono::seconds>(duration).count(); - } - /// Sends the .uno:Save command to LoKit. bool sendUnoSave(const std::string& sessionId, bool dontTerminateEdit = true, bool dontSaveIfUnmodified = true, bool isAutosave = false, @@ -382,6 +364,28 @@ public: private: + /// Loads a document from the public URI into the jail. + bool load(const std::shared_ptr<ClientSession>& session, const std::string& jailId); + bool isLoaded() const { return _isLoaded; } + + std::size_t getIdleTimeSecs() const + { + const auto duration = (std::chrono::steady_clock::now() - _lastActivityTime); + return std::chrono::duration_cast<std::chrono::seconds>(duration).count(); + } + + std::unique_lock<std::mutex> getDeferredLock() { return std::unique_lock<std::mutex>(_mutex, std::defer_lock); } + + /// Called by the ChildProcess object to notify + /// that it has terminated on its own. + /// This happens either when the child exists + /// or upon failing to process an incoming message. + void childSocketTerminated(); + void handleTileResponse(const std::vector<char>& payload); + void handleDialogPaintResponse(const std::vector<char>& payload, bool child); + void handleTileCombinedResponse(const std::vector<char>& payload); + void handleDialogRequest(const std::string& dialogCmd); + /// Shutdown all client connections with the given reason. void shutdownClients(const std::string& closeReason); |