Commit graph

505 commits

Author SHA1 Message Date
Tamás Zolnai
75dc61da7e MSForms: send item selection event to core.
Change-Id: I10fceb66a4f8cd777c43411ddace3456a315b5a2
2020-05-09 09:54:08 +02:00
Tamás Zolnai
d2629961e0 MSForms: handle formfieldbutton message.
Change-Id: I17243823d9bc0074b7fd015bca23de9399e0e26c
2020-05-09 09:54:08 +02:00
Jan Holesovsky
3cd1e0d439 function bar: Index the function by name, not by index.
Depends on a core change that changes the ABI of the completeFunction().

Change-Id: I27daf31d49347c4a308518e14a9b8b97f3b48991
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93667
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
(cherry picked from commit 870a7ec5620eb742bd8fb2a9680ff67101a37dd7)
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93541
Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
2020-05-08 12:03:11 +02:00
Tor Lillqvist
ba727f44dd Include <cstdlib> for free()
Change-Id: I30c9f724e6418096c35900ad95f06c36f4f61b88
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93180
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-29 23:54:36 +02:00
Pranam Lashkari
8b349716eb killpoco: removed Poco::Process completely
Change-Id: Iba67abf9342c11517c69c1d94903bf4752aa87d6
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/83770
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-04-29 14:27:54 +02:00
Marco Cecchetti
255d24ba8f forward the device form factor of the client on a new view request
This patch allows the lok core to know about the device form facor of
the client requesting the creation of a new view, immediately instead
of a later time.
When a request for a new view is sent a 'deviceFormFactor' parameter
is appended to the message.
This parameter can have one of the following values: 'desktop',
'tablet','mobile' and is forwarded to the lok core.

Change-Id: I21739ddb8c43c960164b3c625e4cf0a80f4616a4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92691
Tested-by: Marco Cecchetti <marco.cecchetti@collabora.com>
Reviewed-by: Marco Cecchetti <marco.cecchetti@collabora.com>
2020-04-29 13:18:49 +02:00
Pranam Lashkari
b67b335b50 killpoco: Removed Poco::Thread::sleep
Replaced method with std::this_thread::sleep_for

Change-Id: I26e37475d67816e4f1d68d222b1c067107c27b05
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/83200
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-04-29 10:28:53 +02:00
Gabriel Masei
d006204478 wsd: admin: send smaps fd along websocket upgrade request
Change-Id: I2c5c23284b7578f4c177ec337cc1262bf1259e96
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/93074
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-28 17:20:07 +02:00
Dennis Francis
986bcce1c9 kit: Do not broadcast cell-cursor invalidation messages
is a follow up of 217dd2de54
"Do not broadcast view-cursor invalidation messages"

But this change is implicitly Calc specific because
LOK_CALLBACK_CELL_VIEW_CURSOR is used only in Calc.

This patch fixes the following bug:

Suppose there are at least three clients each with a different zoom and the
all client's cursors are placed in same tab-view and away from A1. Now
it can be seen at once that the cursors of other clients in each client
are rendered incorrectly.

The commit c6b18508aec0e609b4c3c000faf89c21e93620bd in core.git
"lok: send other views our cursor position in their view co-ordinates"
does the right thing by sending view specific cell-cursor positions.
But the broadcast of these messages in Kit.cpp means every client will
get the messages intended for others and possibly end up using the
wrong messages to draw the cell-cursors.

Change-Id: I6e9534c2e562f34b5c1fe37242b36e076b9319c8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92916
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
2020-04-28 13:30:22 +02:00
Andras Timar
33000dfded typo fixes in comments and code
Change-Id: I6f31e050aab701e31064e1abc9429dce0a50c279
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92953
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Andras Timar <andras.timar@collabora.com>
2020-04-26 23:19:52 +02:00
Michael Meeks
3bbbc4f2af Kit: remove redundant FILE wrapper around the fd.
Change-Id: I76f00a6855c486c18fb18fbcefe93ba0072a6eea
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92890
Reviewed-by: Gabriel Masei <gabriel.masei@1and1.ro>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-04-25 14:58:18 +02:00
Gabriel Masei
6b486f229a wsd: admin: move kit memory reporting from kit to admin module
Sometimes kit process goes into a heavy processing state (or even hangs)
and is not able to report its memory usage. Thus we can't implement cleanup
of problematic kit processes based on memory information reported by kit.
By moving memory reporting to admin module we avoid this problem.

Change-Id: Icf274e3a3a97b33623a93f9d2dc1e640ad9b7d99
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92752
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-25 09:11:35 +02:00
Tor Lillqvist
11eeceb87c Bin bogus comments referring to removed parameters or whatever
Change-Id: Iae8323fec099fb7805b90293628ebf20e614868f
2020-04-25 09:20:02 +03:00
Jan Holesovsky
eb88cb485c Allow running the production build under a non-lool user when necessary.
But it is insecure, so warn about that.

Change-Id: I151be64f53521e217a5498c0531c9ef2ff8db818
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92822
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
2020-04-24 20:58:43 +02:00
Ashod Nakashian
ce03253e52 wsd: linkOrCopy now uses realpath to avoid links
This is needed in case the original template
directory itself is linked, which after setting
the FTW_PHYS flag to nftw skips them.

Change-Id: I63141b64ca486e6e2e979cdf1d80fe0fd0f3990c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92104
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-04-24 16:40:14 +02:00
Ashod Nakashian
7ea8d62cf6 wsd: improved logging of jail setup
And some formatting, but no functional changes.

Reduced the maximum time before logging all
link/copy activity of jail files, which typically
takes < 200ms.

Change-Id: Ie48072314471195a5f156cb45c616a5e57d2a287
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92103
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-04-24 16:39:46 +02:00
Ashod Nakashian
5471e967b9 wsd: killpoco - reduce Poco usage where unnecessary
Poco's File::linkTo was added in version 1.8.1 and
we still support older versions. Also, symlink(2) is
far more transparent and simpler here.

Change-Id: If537cc77cd1388f3c0e2a6b16b1edcf46a60e357
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92102
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-04-24 15:40:30 +02:00
Miklos Vajna
49fa1aa1c0 Fix -Werror,-Winconsistent-missing-override
Change-Id: I734c2987b20de3dda85ce079aced3c5b90f352e1
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92667
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-04-22 09:58:26 +02:00
Dennis Francis
217dd2de54 Do not broadcast view-cursor invalidation messages
in kit as these are sent by core to specific view(s) by ultimately calling either
(as seen from the usages of LOK_CALLBACK_INVALIDATE_VIEW_CURSOR in core)

1. SfxLokHelper::notifyOtherView() where it sends to particular view.

or

2. SfxLokHelper::notifyOtherViews() where it sends to all views except
the current view.

The core makes the decision to broadcast or not, and if it does, then
the kit's broadcast of broadcasted messages can only cause a blowup of messaging
complexiity w.r.t number of views. It also does not make sense to send
view-cursor messages meant for a view to be sent to others in Calc
with clients of hetrogeneous zooms.

Change-Id: Ib07c5fbba9bb05c59048561d2c26aed00f3be598
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92633
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-22 09:48:55 +02:00
Tor Lillqvist
b94fb53d4d tdf#128502: Make _loKitDocument in class Document non-static again
It was made static in ea2b77ce07 for
Android's sake, so returning it to be per-instance is not a big thing.

Keep a separate static just for the Android app's use for now, while
the Android app supports just one open document at a time anyway. (It
is for the iOS app that I am moving towards supporting multiple open
documents at a time.)

Change-Id: I7fabeb21883eb7cd7155e880eb4cc0413124d1f8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92625
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-21 13:43:43 +02:00
Tor Lillqvist
1525f774d9 tdf#128502: Get rid of the static file-level variable 'document' in Kit.cpp
It is not a problem in the multi-process web-based Online, where the
variable exists separately in each KIT process (which handles exactly
one document). But in a mobile app, when we want to be able to handle
multiple document in the single process, we can't have such variables.

Change-Id: I1d3da48316eb3a8c72ff4957cc3fcba8f6870f16
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92582
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-21 12:15:07 +02:00
Tor Lillqvist
927f77354c Bin unused variable
Change-Id: I382e8bd8f2430dbab7f9ec623299c461b747e0a4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92512
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-19 23:28:53 +02:00
Michael Meeks
3e4ac31c7c killpoco: remove WebSocket includes from a couple of places.
Change-Id: I06740cd978bec8e6a74beb8ed9ef8f4f970a2535
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92470
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-18 18:29:04 +02:00
Tor Lillqvist
378a2b5295 Bin a couple of unintentionally committed LOG_TRC() calls
Change-Id: Ieadc06a38d71aed723191f1738f8f39154978091
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92476
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-18 16:35:15 +02:00
Tor Lillqvist
2a16f34812 Don't use "kitbroker" as part of the thread name in a 'kit' process
It just causes confusion with the name "DocumentBroker".
DocumentBroker objects exist only in the WSD process. Instead just use
"kit".

Change-Id: I3d9915c4759899ea6ed9084cf3ec6dc0f3b88ee5
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92474
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-18 16:33:56 +02:00
Tor Lillqvist
4eb598711c Use #pragma once
LibreOffice core uses that, too, and we support an even more
restricted set of compilers.

Change-Id: I0d0e2c8608e323eb5ef0f35ee8c46d02ab49a745
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92467
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-18 15:00:18 +02:00
Michael Meeks
eab1832b06 tdf#132100 - don't copy debugsource into jails.
gdb will take it from the system anyway, so it's just amazingly
excessive weight wrapped in a performance problem.

Change-Id: Ie8d7d2be97da64233a6d7cb4864d6ee88ea8c337
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92207
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-14 18:57:38 +02:00
Tomaž Vajngerl
1e97fdf799 handle tabstop callback and send it as "tabstoplistupdate"
Handle LOK_CALLBACK_TAB_STOP_LIST and send the payload to the
loleaflet side under "tabstoplistupdate" identifier.

Change-Id: I4bf8c48bd825dec81ef766b7bce536dd399e8b86
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92141
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-04-14 15:41:07 +02:00
Tor Lillqvist
a4eecb790d Fix log message: The LOK function is called saveAs, not downloadAs
Change-Id: I94a0e9d8a25a4a2bf6b1d7c545ed89d6f6007e2e
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92113
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-13 16:25:40 +02:00
Tor Lillqvist
909734e261 Implement the "download as" functionality properly in the iOS app
We need to catch the downloadas message already in
-[DocumentViewController
userContentController:didReceiveScriptMessage:] and use an
UIDocumentPickerViewController to let the user choose where to
download (or export) the document. The iOS-specific code in
ChildSession::downloadAs() can go away.

Change-Id: I626b9986ec6156f7e83bda02b04e65f7819f8017
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92112
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-13 15:35:13 +02:00
Michael Meeks
a7dc2d1467 kill IoUtil - obsolete & unused.
The switch away from LOOLWebSocket and the use of a websocket
for talking to forkit removes the need for the pipe code.

Change-Id: Ifb0c6c88681289e7a1709d9bc3281532935c7be4
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92033
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-10 16:38:25 +02:00
Michael Meeks
28a9c4dc05 Poll - cleanup method naming, and fix merge issues.
This mends several problems from commit
5710c86323.

Change-Id: I1b29f29ca81679608a2692488fa1ef22b2e62dfd
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92032
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-10 13:58:00 +02:00
Michael Meeks
5710c86323 Poll - switch to ppoll for closer to microsecond accuracy.
Change-Id: Ib8a2bb6f60302df8631edadbbb8db626894c457c
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92000
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-10 10:06:23 +02:00
Gabriel Masei
0ac330f599 Add segmentation fault metric for Kit processes
Change-Id: Ifb0de004274213ef512f601e4419f98f456c7288
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91857
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-08 15:06:39 +02:00
Tor Lillqvist
5270284701 Further re-work of document saving in the iOS app
Now, finally, I think it works as it should, knock on wood. After an
auto-save (or explicit save by tapping the button), the edited
document does show up with its auto-saved contents if you open it from
iCloud Drive or Nextcloud while it is still open in the iOS app.

What I was missing was that the document hadn't actually been saved by
the core (to the temporary copy) until we get the
LOK_CALLBACK_UNO_COMMAND_RESULT for the .uno:Save. We must call the
-[UIDocumentsaveToURL:forSaveOperation:completionHandler:] only upon
receiving that callback.

Change-Id: I10486f3bc587c871ee2644a0c097493f33baf420
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91880
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-08 12:19:38 +02:00
Gabriel Masei
70af76e28c Replaced pipe with websocket based on Unix socket in communication with ForKit
Change-Id: I80f1a4e84ca6820503966a8ee5d9958a150eac14
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91585
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-07 15:04:47 +02:00
Martin Milata
c571d9286d tdf#129895: handle symlinks when populating chroot
In linkOrCopy, the nftw() function is used without the FTW_PHYS flag to
populate child roots from systemplate. From man nftw:

  FTW_PHYS
    If set, do not follow symbolic links.  (This is what you want.)
    If not set, symbolic links are followed, but no file is reported twice.

Because the order in which directory entries are visited is not defined,
having multiple symlinks to a file results in only one of the paths
being created in the chroot.

This is not really a problem because loolwsd-systemplate-setup creates
systemplate without symlinks. Fixing it might prevent unpleasant
surprises in the future though, and might possibly allow to make
systemplate and chroots smaller (also the manpage says that you want
it:)).

The commit adds FTW_PHYS flag to the call as well as symlink handling.

Change-Id: I01354f529b5d340185988ed026f266caf17a6881
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87749
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-04-07 13:22:42 +02:00
Tor Lillqvist
01509b4087 Tweak the (normally commented-out) experimentation code a bit
Change-Id: I58b9c83a87e6e07421b5a29c13b3b00034c87a1a
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91543
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-04-02 11:47:09 +02:00
Tor Lillqvist
59fc10bcd6 Add some (ifdeffed-out) experimentation with file service providers
Kept in #if 0 in case some similar experimentation needed in the
future.

It might be interesting to be able to tweak behaviour based on knowing
on what kind of storage the doument is located, but alas, that seems
not possible.

Change-Id: I877c96fcea3a350faa58a934485714d15b01141d
2020-04-01 13:42:54 +03:00
Jan Holesovsky
120000347e Log every error we send to the JS.
So that it is easy to find it in the log.

Change-Id: I1b367db9e97d7215c46e824998e99048531acb07
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/91413
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-03-31 20:15:25 +02:00
Tor Lillqvist
2154306e57 Make the iOS (and Android?) app work again
Now one can open another document after closing the first one. Turns
out that throwing an exception to return through the call stack to
SocketPoll::poll() is not necessary after all. But doing
document.reset() as before a86508d815 is
essential.

Change-Id: I248df78bd9b0d3f0962df2126ca394cb746542b8
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90456
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-03-13 10:50:36 +01:00
Tor Lillqvist
d4e0835043 Make closing the document work again in the iOS (and Android?) app
But opening a second document now hangs.

Sigh, the plumbing in the mobile apps is so extremely fragile. But
that is to be expected when turning a multi-process structure (where
one class of processes exit as soon as they have done their job) into
a single process running forever.

Change-Id: I0fdb751f44e16efb42843189969e049bf14816f0
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90443
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-03-13 00:28:19 +01:00
Tor Lillqvist
47d22d538a Fix build for MOBILEAPP
Change-Id: I0903f13438493d167c263020d923536b4de71e5d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90385
Tested-by: Tor Lillqvist <tml@collabora.com>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
2020-03-12 17:08:19 +01:00
Henry Castro
316a011c08 kit: fix download action when server is running with no capabilities
Downloading pdf file does not work because the kit process is not jailed

Change-Id: I1e67840eb58997f6de10948c8d8e260888abe326
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90338
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Henry Castro <hcastro@collabora.com>
2020-03-12 13:33:19 +01:00
Ashod Nakashian
a0cdafca41 wsd: some logging improvements
Change-Id: Icf4c4845e10f44fe1518e58ea598c2d1053b40c1
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90357
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-03-12 13:23:57 +01:00
Ashod Nakashian
a86508d815 wsd: kit now exits immediately when wsd send exit
The 'exit' command from DocBroker to Kit is processed
immediately. It set the termination flag and destroyed
the Document instance in Kit. Unfortunately, this is
highly problematic. There are a number of races here.

Normal disconnection procedure from DocBroker is to
first send 'disconnect'. This tells Kit to unload
and close the view in question, and when 0 views
are left, it simply exits the process.

However, since 'disconnect' is processed in the
message queue, the 'exit' (and indeed the socket
disconnection that follows 'exit') may be handled
before the message queue is drained, and so the
'disconnect' wouldn't have been processed yet.
The end result of these two races is that Kit
tries to exit the Core main loop, which fails
a number of assertion (f.e. that no LOK Windows
remain, which is presumably a leak check, which
we care not about as we don't attempt to cleanup
the sidebar).

The fix here is to process 'exit' immediately,
because DocBroker is gone, there is absolutely
nothing for Kit to do anymore.

Change-Id: I5c09fcfdb1713f4e0b56b717c747d919d0c6728f
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90356
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2020-03-12 13:20:47 +01:00
Michael Meeks
e924625cc1 re-factor: Socket / WebSocketHandler.
Essentially we want to be able to separate low-level socket code
for eg. TCP vs. UDS, from Protocol handling: eg. WebSocketHandler
and client sessions themselves which handle and send messages
which now implement the simple MessageHandlerInterface.

Some helpful renaming too:

s/SocketHandlerInterface/ProtocolHandlerInterface/

Change-Id: I58092b5e0b5792fda47498fb2c875851eada461d
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90138
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
2020-03-11 16:48:03 +01:00
Miklos Vajna
7ecae1b66d Document::sendFrame: vector -> unique_ptr
Open Writer, insert a multi-MP JPEG, select it.

Before:

ChildSession::renderShapeSelection: finished in 74.67 ms

After:

ChildSession::renderShapeSelection: finished in 67.33 ms (90.17% of baseline)

Change-Id: I495e9fcf0c42b0bcfc7987a402a13f5d8664b1e1
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90291
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-03-11 09:08:25 +01:00
Miklos Vajna
893b7d880d ChildSession::renderShapeSelection: vector -> unique_ptr
Open Writer, insert a multi-MP JPEG, select it.

Before:

ChildSession::renderShapeSelection: finished in 81.33 ms

After:

ChildSession::renderShapeSelection: finished in 74.67 ms (91.81% of baseline)

This is with an --enable-symbols core with a -O2 online, with libstdc++.

The cost on the Android profile with its libc++ looked even more,
spending time in the std::vector dtor.

Change-Id: I50af2e13fd24569dc32304420b8f3e70d15803eb
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90262
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-03-10 17:04:16 +01:00
Miklos Vajna
a7d3efdd4e Introduce StringVector::equals()
Allows comparing tokens with C strings without a heap allocation. Do the
same when comparing two tokens from two different StringVectors.

And use it at all places where operator ==() has an argument, which is a
StringVector::operator []() result.

Change-Id: Id36eff96767ab99b235ecbd12fb14446a3efa869
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90201
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
2020-03-09 09:46:33 +01:00