Commit graph

315 commits

Author SHA1 Message Date
Tor Lillqvist
f3786f5cb7 Pass correct argument on iOS as pBuffer to lok::Document::paintTile()
On iOS it shouldn't actually be pointer to a pixel char buffer, but a
craphics context reference. (This is how it has been since the
experimental TiledLibreOffice app, maybe five years ago? Sadly it
wasn't documented in the LibreOfficeKit include file. But it is how
LibreOfficeLight used the API, too.)

In TiledLibreOffice we rendered tiles directly into the CALayer of the
view. In this Online-based app we of course do render tiles into pixel
char buffers, just like in real Online, but we need to create bitmap
graphics contexts for them and pass that to paintTile().

Now I get white tiles, not totally zero-filled ones. But still no
document contents rendered.

I don't yet want to change the pBuffer parameter to actually be a
buffer pointer on iOS, too, like on other platforms. Also, changing it
will mean the LibreOfficeLight app would need changing, too, and I
don't feel like doing that. But ideally, sure, that should be done.
2018-09-21 10:29:56 +03:00
Tor Lillqvist
95eb849217 Still more iOS app and related Online C++ code hacking
Re-think the plumbing between the different parts of the C++ Online
code. Do try to have it work more like in real Online on all but the
lowest socket level. Except that we don't have multiple processes, but
threads inside the same process. And instead of using actual system
sockets for WebSocket traffic between the threads, we use our own
FakeSocket things, with no WebSocket framing of messages.

Reduce the amount of #ifdef MOBILEAPP a bit also by compiling in the
UnitFoo things. Hardcode that so that no unit testing is ever
attempted, though. We don't try to dlopen any library.

Corresponding changes in the app Objective-C code. Plus fixes and
functionality improvements.

Now it gets so far that the JavaScript code thinks it has the document
tiles presented, and doesn't crash. But it hangs occasionally. And all
tiles show up blank.

Anyway, progress.

Change-Id: I769497c9a46ddb74984bc7af36d132b7b43895d4
2018-09-19 11:31:18 +03:00
Tor Lillqvist
7fd28d5676 Revert part of my iOS related commit, causes compilation warning with Clang
Won't actually be needed anyway, the way the code is going in my work
tree.

Change-Id: I4480ed59fe96ddcfad8483517f2a23452606f332
Reviewed-on: https://gerrit.libreoffice.org/60576
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-17 12:51:07 +02:00
Tor Lillqvist
87b85ff8f0 Be consistent in how we name "interface" abstract classes
We already use a suffix "Interface" for SocketHandlerInterface, so
rename IDocumentManager to DocumentManagerInterface.

Naming "interface" classes with an "I" prefix is C# and COM style.
Sure, that is a convention as good as any other, but let's try to be
consistent within this rather small code-base.

Change-Id: I9c356df327debd780f23ed2b2e6d6e630328861e
2018-09-12 19:27:23 +03:00
Tor Lillqvist
b59d160a08 Intermediate commit of work in progress on an iOS app
The app is unimaginatively called "Mobile" for now.

Runs but crashes pretty quickly after loading the document by the LO
core. Will need some heavy changes to get a ClientSession object
created in there, too, to handle the (emulated) WebSocket messages
from the JavaScript. It would then handle some of these messages
itself, and forwards some to the ChildSession, which in this case is
in the same process. Now the messsages from the JavaScript go to a
ChildSession, which is wrong. As the assertion says, "Tile traffic
should go through the DocumentBroker-LoKit WS"
2018-09-12 18:32:05 +03:00
Tor Lillqvist
290137c99b Bin unnecessary assert(loKit)
We already explicitly check earlier, after attempting to create it,
and log a fatal error and exit on failure.

Change-Id: Ia3fde4026839a255d4d19932300e16a05f9a33d2
2018-09-12 13:36:00 +03:00
Tor Lillqvist
d5f913486a Add a clarifying comment
Change-Id: Ia32b3ad65dd410e0f9f9d18c11be2d566ca0d6e0
2018-09-11 13:01:37 +03:00
Tor Lillqvist
75438baa70 More mobile app stuff, very much early state of work in progress
Re-think Linux vs mobile ifdefs a bit. Use #ifdef __linux only to
surround code that actually is Linux-specific. Use #ifdef MOBILEAPP
for code that is for a mobile version (with no separste wsd, forkit,
and kit processes, and with no WebSocket protocol used).

Bypass UnitFoo for mobile. Possibly we do want the UnitFoo stuff after
all on mobile, to run in some special testing mode? Hard to say, let's
skipt it for now.
2018-09-10 15:13:43 +03:00
Miklos Vajna
9ed7c1065c common, kit, test, wsd: these parameters are copied for each invocation ...
... but passing by const ref is enough
2018-08-13 09:26:15 +02:00
Jan Holesovsky
ac7d67f43e Fix networking in the chroot.
The needed files were not copied, and consequently the hostname
resolution did not work in the chroot.

Change-Id: Id3dccc4f70cd1deeddb83c8e672f240e06748e34
2018-08-03 05:22:03 +02:00
Tamás Zolnai
c2a5f6acb0 Store number of tiles sent to kit for rendering
and use that info also to avoid sending to much tiles on the network.

Change-Id: Iab2d7af64693047a3c1cfe9f73de80a7100bbc13
2018-07-24 20:52:53 +02:00
Michael Meeks
7e6e81eb46 Implement client websocket masking.
Disable this for easy strace debugging and a bit of perf. to the forkit.

Change-Id: Ia330582817481410d26df50db5eb42b4692ad01c
2018-06-15 14:54:19 +01:00
Miklos Vajna
d718b1c054 kit: let alphaBlend() take an std::vector<char> instead of raw pointer
So that it's more obvious that the two for loops don't read past the end
of the vector.

Change-Id: I49752c1bc316b6d73568ab334b07727ef60bdce5
2018-05-28 09:12:30 +02:00
Miklos Vajna
8f4c348be3 kit: let getPixmap() return an std::vector<char> instead of raw pointer
So the callers can know not only the address of the pixmap, but also the
size of it.

Change-Id: I3aecc33cb354f5878364b11398c276fcabd3103e
2018-05-25 09:11:54 +02:00
Miklos Vajna
51631b4e22 kit: remove unused using declarations
Change-Id: Ide76d327b3b064180aa4eaa28f13827d665edaa5
2018-05-23 09:14:04 +02:00
Michael Meeks
c5cef26fb6 Shutdown kit process if connection dies.
Change-Id: I34e627a03a9859ccd3ae9f9925fe6ab080697b72
2018-05-18 16:06:03 +01:00
Jan Holesovsky
6c31b7793c Post the message to the poll thread.
Change-Id: Ibd28090a420b5396b64fdfe676bef8cf06991116
2018-05-18 15:16:40 +02:00
Jan Holesovsky
6996139e5f Use correct path in the client websockets.
Change-Id: Ie0bf6646ff3f6e6cf99b505143a416c86a3a33b8
2018-05-18 15:16:40 +02:00
Jan Holesovsky
98ed24257b Move the functionality from connectToMonitor() to SocketPoll.
Change-Id: Iab2ac09638323f5e59f7a2ea0d880f52989ad64d
2018-05-18 15:16:40 +02:00
Jan Holesovsky
35ec3649bb Change Kit to use the new client websocket code.
Change-Id: Ib4e62ea618da5bd8992b51165b0d7ee955c61637
2018-05-18 15:16:40 +02:00
Tamás Zolnai
ffd7151443 Writer: View jumps to cursor position even if it is moved by an other view.
Need to get the viewid which moved our visible cursor, so we can check
whether it positioned changed by the owner of the cursor or not.

Change-Id: Ie7b1fafc8d8f11fba0c0b0d5f02d755e15284514
Reviewed-on: https://gerrit.libreoffice.org/52571
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-04-10 17:00:21 +02:00
Tor Lillqvist
e9ea5e8bc7 Python is also a special snowflake
Change-Id: I1689f992494e1abe50c45b1ae975b76b00e1b080
2018-03-28 20:17:32 +03:00
Michael Meeks
ad21717498 Avoid copying most code into the chroot jail.
Last lingering bits are the xpdfimport import support and
some horrors required for NSS.

This requires a reasonably new core.

Change-Id: I2e08b841668722af0e3b947cf2b06687cca73b53
2018-03-28 16:38:10 +01:00
Tor Lillqvist
bb4c1a7fa7 Don't filter out all scripts, just Java and JavaScript ones
Change-Id: I3054a3f36ae1777b162fb5a1b9a456f1bce9248b
Reviewed-on: https://gerrit.libreoffice.org/51991
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2018-03-28 11:18:43 +02:00
Michael Meeks
8f134aa1a9 Allow running without seccomp and capabilities.
There are some significant security trade-offs here which are now
at least configurable.

Change-Id: I1d879d69e91392f4ccf5db250a2277f53df60db7
2018-03-19 20:46:17 +00:00
Michael Meeks
6803ee4087 Use a hard random /tmp directory for document intermediates.
Requires a lok tweak to reset the tmpdir globals on init.

Change-Id: I602705f20fa016ef415088be8d1ada6d465d2a8d
2018-03-15 11:01:51 +00:00
Miklos Vajna
b6e1a4e281 kit: avoid manual management for Watermark::_pixmap
A simple std::vector is enough here and results in simpler code.

Change-Id: I7e6ad268aca13c4efb445c7918a3afd14e0ed146
2018-03-14 09:04:36 +01:00
Ashod Nakashian
b834545e79 kit: makeRenderParams now static
Change-Id: I1c79991a73044a91ed9f8389e23ccffd8b2bcbce
Reviewed-on: https://gerrit.libreoffice.org/49572
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-02-11 22:17:02 +01:00
Miklos Vajna
e76485d8b9 kit: spell out non-trivial autos to improve readability
Change-Id: I69b025b08a69c8780d40b39074d7d7abb12cc3af
2018-02-07 10:18:12 +01:00
Samuel Mehrbrodt
e89584f933 Show info instead of error when linking is not possible
we still try to copy the file after this and fail if that doesn't work.

Change-Id: Ie37022b2454e71f4b1a92217e01e56e58070448b
Reviewed-on: https://gerrit.libreoffice.org/48907
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2018-01-30 14:33:51 +01:00
Michael Meeks
fbc28b91b3 Avoid copying code into the chroot if LINK_NO_CODE is set.
Change-Id: Ibba7dfa87c779b4d809cc2ac53d0802bba1c37ef
2018-01-29 15:12:05 +00:00
Pranav Kant
1d22f7bc54 kit: start spamming the logs when linking/copying is slowww
This is sometimes the case in docker when the link operation 'copies up'
things from lower layers to the working docker container's layer. In
such cases, let the admin know.

Change-Id: Ib72b67304a292c3832838379cc76bcb4a7268cb3
Reviewed-on: https://gerrit.libreoffice.org/48710
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2018-01-26 16:40:56 +01:00
Pranav Kant
c16d198560 Print humanized bytes in the logs
Change-Id: I2ebdea0c3a360be1573ae13fa9cbe6f432436f29
2018-01-26 20:03:22 +05:30
Henry Castro
90cd7791fa kit: remove unused debug code
Change-Id: Ibd69a2b451be0a075759524acff5f0e9fc820d05
2018-01-20 16:41:13 -04:00
Tor Lillqvist
217636ed44 Drop meaningless "loolnb" word from a comment, drop two related #if 0 blocks
"loolnb" used to mean the concept of using non-blocking sockets back
when that was experimental proof-of-concept work in progress, but that
work has been merged in long ago and there is no neeed for the term
any longer.

Change-Id: I4c49b625fe8be8892b82115eaaa47bcba0f29500
Reviewed-on: https://gerrit.libreoffice.org/47699
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-01-10 13:01:26 +01:00
Ashod Nakashian
95af839fd9 wsd: trace first child's startup activity
To help debug early failure, log the first
child's statup at trace-level.

Change-Id: I8a6c8fe535bbc971174c0d950a2243460f81a2c7
Reviewed-on: https://gerrit.libreoffice.org/47628
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-01-09 13:06:48 +01:00
Jan Holesovsky
053aab99e8 Avoid an unnecessary buffer in the watermark code.
Change-Id: I29b162fd9d8f43d0a2cb75853f0a3c0dc8ee92df
Reviewed-on: https://gerrit.libreoffice.org/46527
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-05 15:26:42 +01:00
Ashod Nakashian
b0a7fadcc6 wsd: improve watermark visibility on dark and grey backgrounds
The watermark text is now rendered on a blurred version
of itself, using inverted colors. This makes it
look sharp on light backgrounds, but inverted in
a blurry haze when on dark backgrounds, thereby
being readable on top of any background.

Change-Id: Ia6daf987674c484980f1fdec4f74e579ed87c213
Reviewed-on: https://gerrit.libreoffice.org/46491
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/46526
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-01-05 15:26:42 +01:00
Jan Holesovsky
525284e32d lokdialog: Set the language of the given view.
Change-Id: I54d542ff736b37c9b08c3e73f65d3fc27d095acc
Reviewed-on: https://gerrit.libreoffice.org/46385
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2018-01-05 15:26:42 +01:00
Pranav Kant
f63858433b loplugin:includeform
Change-Id: Ib62a7aa61062f00698aa3e8a144438de5c57e53d
2017-12-20 21:21:05 +05:30
Marco Cecchetti
96a2d3c36c calc: LOK_FEATURE_RANGE_ADDRESS (solving compatibility issue)
In order to make cp-5.3 compatible with online 2.1.x we introduced a
new enum which by default disables collecting the new range based
header data implementation.

This patch (re-)enable this feature on online 3.x

Change-Id: Ieab4145df9d132810bd871b1a315fd2171ba0ab5
Reviewed-on: https://gerrit.libreoffice.org/46288
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 2a2c04651c3a935a793f7710118b5945f6966ab0)
Reviewed-on: https://gerrit.libreoffice.org/46598
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2017-12-16 14:07:23 +01:00
Pranav Kant
155b3131fc Fix build; -Wunused-var
Change-Id: Iba03c7b64188c89d668aac07365fd8c706eeefdd
2017-12-05 09:38:04 +05:30
Michael Meeks
e11794da25 Disable delta generator for now.
Change-Id: I7aee52b5dc0dc0b09868170e50afc8ccb0e2f7b6
2017-12-04 22:01:16 +00:00
Pranav Kant
849eb0d500 lokdialog: Adapt to LOK dialog API changes
Change-Id: I653304e71573eb253e09a72bc87d54b8554ba7ff
2017-12-04 22:13:50 +05:30
Pranav Kant
a19121bbbc Adapt to dialog API changes in LOK
... and bypass some unncessary DocumentBroker handling of dialog
messages.

Change-Id: I378dff7a9786479baaa43f5fde9d30f35bc7f948
2017-11-28 22:18:21 +05:30
Pranav Kant
5355c52e10 Allow sending binary websocket frames from IDocument interface
Change-Id: I89f304e69e0c7b5f87bd2883a775d5c256674ef0
2017-11-28 22:18:21 +05:30
Rene Engelhard
385008947d Revert "include <sys/sysmacros.h>"
This reverts commit af7685e499.
2017-11-28 01:10:18 +01:00
Rene Engelhard
af7685e499 include <sys/sysmacros.h>
kit/Kit.cpp:1688:13: warning: In the GNU C Library, "makedev" is defined
 by <sys/sysmacros.h>. For historical compatibility, it is
 currently defined by <sys/types.h> as well, but we plan to
 remove this soon. To use "makedev", include <sys/sysmacros.h>
 directly. If you did not intend to use a system-defined macro
 "makedev", you should undefine it after including <sys/types.h>.
2017-11-26 14:15:21 +01:00
Michael Meeks
78398d4482 Move the Delta generator out into its own file.
Change-Id: I7f7553c292970b1a52879b6d6c14e67172022310
2017-11-22 15:55:03 +00:00
Michael Meeks
ed8807a1a5 Insert pixels from 'new' not 'old'.
Change-Id: I117348885073b740ed8b2df84d805854b2f00767
2017-11-22 15:55:03 +00:00
Michael Meeks
b1124c05a8 Deltas should be pixel based, add debugging.
Change-Id: I3b47b738ee71d015911e3d77b59b5f3cb34ecd75
2017-11-22 15:55:03 +00:00
Michael Meeks
0bfbbf9851 Start of delta creator.
Change-Id: Idf186cda4f11e2418d9ff9f435825832c6b10294
2017-11-22 15:55:03 +00:00
Pranav Kant
a2a72572bb lokdialog: Paint only part of the dialog when specified
Change-Id: I5543c95a48fd0192e5c654598991125bcaeb62e4
Reviewed-on: https://gerrit.libreoffice.org/44519
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-11-09 04:25:13 +01:00
Pranav Kant
f1d78c7e62 lokdialog: send invalidate rectangle in dialog command
Change-Id: Iae00498a0ead1ee65dfce0332721e0d0fd2202fb
Reviewed-on: https://gerrit.libreoffice.org/44518
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-11-09 04:24:24 +01:00
Pranav Kant
6375789611 lokdialog: Support for dialog title
Change-Id: Ie66c74290eb0583882cb9395b01c00f91df50aa0
2017-10-28 08:15:16 -07:00
Jan Holesovsky
343c5bc690 tdf#99744 SaveAs: Extend test to check that the Save As result was sent.
Change-Id: I3788b87d2599c01000af97f496ee2b840c0cae3e
2017-10-26 11:11:38 +02:00
Tor Lillqvist
a806655e59 Fix makedev warning
g++ says: In the GNU C Library, "makedev" is defined by
<sys/sysmacros.h>. For historical compatibility, it is currently
defined by <sys/types.h> as well, but we plan to remove this soon. To
use "makedev", include <sys/sysmacros.h> directly. If you did not
intend to use a system-defined macro "makedev", you should undefine it
after including <sys/types.h>.

Change-Id: If5cd1ec0ca34b00b1248e9b2650d4d13e6d3bf64
2017-10-26 11:53:35 +03:00
Pranav Kant
e9e162b35e lokdialog: Mouse/key events, canvas use & child window impl.
Change-Id: If8ae5c284e7166d4a01bd664644134f11197f988
2017-10-25 00:39:03 -07:00
Pranav Kant
374d6a197d lokdialog: pass the dialog id in dialog command
Change-Id: Ia0e76b1dc93483340361777cf21f23127bac91e1
2017-10-25 00:38:08 -07:00
Pranav Kant
e74a4e2487 lokdialog: wrap the lok dialog image in dialog container
The two test dialogs, Spelling dialog and word count dialog
appear on the screen when invoked from the menubar.

Interaction with dialogs is WIP.
Mouse/key events and floating window still needs to be worked upon.

Change-Id: I2d439465c7536d0b453c8ade503ec181a96c90d2
2017-10-25 00:38:01 -07:00
Pranav Kant
de780f8253 lokdialog: wsd: first cut at lok dialog rendering api
Change-Id: Id522e0796428ed0a15ea3496e6726f51ed232e75
2017-10-25 00:37:41 -07:00
Pranav Kant
c52cc45f08 Catch unknown exceptions and log it
... before lokit thread magically dissappears because some function in
LO core threw an 'Exception'

Change-Id: I8357b18d95674af8ec4d2f57ad41087f7b7dfcff
2017-10-03 14:16:59 +05:30
Marco Cecchetti
ee6e64528d wsd: support for FSIZE and NOFILE system limits
The routine for handling the configuration for the max file size
limit, was wrongly using NOFILE. Now we handle both limits correctly.

Change-Id: Ie8b63617286f66af6d4eb1b35b9e4f4b28f3c2a6
Reviewed-on: https://gerrit.libreoffice.org/42803
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/42811
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Tested-by: Marco Cecchetti <mrcekets@gmail.com>
2017-09-26 17:40:31 +02:00
Miklos Vajna
84e4ea2c3d Kit: pass by const reference and avoid redundant initializer
Change-Id: I550334ec9392121ff9084c35b5c8c6b410917080
2017-09-13 09:13:26 +02:00
Marco Cecchetti
dee39a562c support for rendering a watermark on each tile
Change-Id: I3edccac49a3bcd3d2493d8d7ef3a1ae29307e727
Reviewed-on: https://gerrit.libreoffice.org/41898
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-09-07 17:28:44 +02:00
Tamas Bunth
b285c5f321 Copy file with linkOrCopy
So that it can create folder in jails when needed.
2017-08-16 16:14:59 +02:00
Pranav Kant
a283942b00 Fix a superfluous condition
(a != 0 || a != 1) makes no sense. Author probably meant AND, not OR.

Change-Id: If91954e9e48e5804c54380db8c99184ef0fcc1d2
2017-07-20 21:08:19 +05:30
Aditya Dewan
3a43f69116 tdf#108341 automatic editor switch and follow added
Change-Id: I5129256a0633916a3ca2cb05ccba39a5f4a5d398
Reviewed-on: https://gerrit.libreoffice.org/39299
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-07-06 09:46:49 +02:00
Andras Timar
ad8bffa04a configure option to disable SECCOMP
Change-Id: I8120674b60d388a3f85190631469a112c4af9266
Reviewed-on: https://gerrit.libreoffice.org/39408
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2017-07-03 11:43:01 +02:00
Michael Meeks
294ff36ed2 Re-factor: pass oldWid into encodePNG sub buffer.
Change-Id: I37bce07d64240aba254a0c4cbcc1804f2dd98a13
2017-06-24 13:03:28 +01:00
Michael Meeks
3f59438f62 Simplify renderid generation, and re-order.
Change-Id: I3f934fdf16b1a9cf4ea00571616d9b5568535707
2017-06-22 18:41:16 +01:00
Michael Meeks
73a87493f0 Use WireIds instead of long hashes to identify tiles efficiently.
Changes protocol to use 'wid' instead of 'hash' everywhere. Wire-ids
are monotonically increasing integers that can be mapped to hash
values for all of the hash values and tiles we cache internally.

Change-Id: Ibcb25817bab0f453e93d52a6f99d3ff65059e47d
2017-06-20 21:49:44 +01:00
Ashod Nakashian
44d8876f27 Remove data rlimit
Seems to have no effect, so gone in
favor of RLIMIT_AS (virtual memeory).

Change-Id: I210879ec9285f420c9f9839cdabf45c42d865fb3
Reviewed-on: https://gerrit.libreoffice.org/38720
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-13 06:27:12 +02:00
Ashod Nakashian
36fb1e64f0 wsd: new internal command to change config values
Change-Id: I8b4a573ba7b01ee6e7b3b91a00e12cc744f85fa8
Reviewed-on: https://gerrit.libreoffice.org/38676
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-12 06:18:53 +02:00
Ashod Nakashian
42969b732c wsd: log the relevant rlimits at Kit startup
Change-Id: I6ada56d9bda80301ab55de2c831452b21aa362c1
Reviewed-on: https://gerrit.libreoffice.org/38674
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-12 06:17:58 +02:00
Ashod Nakashian
a59f78b656 wsd: UserExtraInfo is a map, not array
Change-Id: I64ef04c96223ee74099697cb2276307d834db329
Reviewed-on: https://gerrit.libreoffice.org/38291
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-06-01 07:48:15 +02:00
Ashod Nakashian
8a2c60e5b6 wsd: avoid race during viewinfo notification
Change-Id: If2d8adc67337a5529cb6898808a84727ff1df38e
Reviewed-on: https://gerrit.libreoffice.org/38123
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:47:42 +02:00
Ashod Nakashian
da2d3cbc92 wsd: support per-user links and commands
userextrainfo is a json array that contains
extra user-specific links.

Currently 'avatar' is assumed to hold the
image url for the user's avatar.

'mail' and other links can also be added.

Change-Id: I37c4c68bfa0b7ee659e017b4867dcb8cf5c2ca2f
Reviewed-on: https://gerrit.libreoffice.org/38120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-29 06:45:18 +02:00
Ashod Nakashian
9798eafb8c wsd: random jail paths instead of pid
Jail paths are now generate from a PRNG
instead of using the PID of the kit process.

The PRN is converted to base-64 and used
as the directory name where a given
kit is jailed.

Change-Id: I8e4bc35d9ccdfdae0e542ab707c417cd29ad52f3
Reviewed-on: https://gerrit.libreoffice.org/37372
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-05-08 04:59:12 +02:00
Michael Meeks
7f4f752667 Initial seccomp work.
Add a list of unhelpful looking system calls to improve containment.

Change-Id: I2e4bf3e0a6a752d427299728663d17120586bb10
2017-04-28 14:26:21 +01:00
Michael Meeks
9ea75f974c Re-allocate vector storage to compressed size. 2017-04-07 22:33:01 +01:00
Jan Holesovsky
1585cbdb6b Merge document size changes callbacks in the message queue.
Change-Id: I1a540b17f2a72c374568db834a30b814878e9032
2017-04-07 12:13:45 +02:00
Jan Holesovsky
69d3671e4e More logging of the rendering time.
Change-Id: Iecaab7150b0f9751c2d53813e29d5ca115115980
2017-04-07 11:30:12 +02:00
Ashod Nakashian
fa753e5e06 wsd: time lok_preinit and log when finished
Change-Id: I2ea3dc226c84870690bbf9b041263650c923d5bd
Reviewed-on: https://gerrit.libreoffice.org/36112
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-05 04:45:03 +00:00
Ashod Nakashian
95d51493aa wsd: remove nextmessage
This was a workaround to Poco's limitation
of requiring socket receiveFrame be given
preallocated buffer, which couldn't be
exceeded by a larger payload. This meant
the receiver had to know the maximum
payload in advance.

Since only the Kit uses Poco sockets,
and the Kit never receives large payloads,
this preamble is now obsolete.

100% (94/94) of old-style tests PASS.

Change-Id: I76776f89497409e5755e335a3e25553e91cf0876
Reviewed-on: https://gerrit.libreoffice.org/36037
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:18:09 +00:00
Ashod Nakashian
c9365ad679 wsd: log the DocBroker ID in the Kit as well
This matches the document between WSD and kit,
making logs much easier to read.

Change-Id: If55a9eb84b4a22d2dc4dd53f5f6ab322ebc3646e
Reviewed-on: https://gerrit.libreoffice.org/36028
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-04-03 05:11:23 +00:00
Pranav Kant
ce1084b74f wsd: Send readonly info to clients
With this every other client would be able to know about other client's
permission i.e whether they have opened the document as readonly. This
could be important eg: to hide the cursor overlay of readonly users in
the UI or to mark these users as readonly in the userlist.

Change-Id: I5dcb1b4e5a22c9b546d16b69b9216cc7653cff04
2017-03-31 12:20:09 +05:30
Samuel Mehrbrodt
fd5df2f1da Revert "Don't try to copy the file when it already exists"
This reverts commit 0b91533abb.

Change-Id: Ic672cca1ba26cd926923632d27ea8bb9a64495b5
Reviewed-on: https://gerrit.libreoffice.org/35758
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2017-03-27 13:06:09 +00:00
Samuel Mehrbrodt
0b91533abb Don't try to copy the file when it already exists
Without this, 'make run' fails for me

Change-Id: I7fd3c39a0443d9f5d70af2382e498cd5c10435d8
Reviewed-on: https://gerrit.libreoffice.org/35649
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
2017-03-27 08:41:14 +00:00
Jan Holesovsky
9f17050a7d Pass the locale settings from loleaflet to wsd/kit.
Change-Id: Ie530db73cfbdb62787f16eae0f4b07fbf8b8acb4
2017-03-24 12:34:32 +01:00
Ashod Nakashian
2e2f62edde wsd: improved logging
Change-Id: I6c4a5bcd54c0748cc413afbfcfb34c365b347669
Reviewed-on: https://gerrit.libreoffice.org/35118
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-03-13 04:11:24 +00:00
Michael Meeks
0eaef6c896 config.h - get includes right: must always be the first include. 2017-03-10 10:47:43 +01:00
Jan Holesovsky
a1a46c240e nb: Use the non-blocking socket in the loolwsd.
This so far only builds, but I did not even try to run it yet.

Change-Id: Iceacb5fc5c8994726508e8ea00bd495d758391a8
2017-03-10 10:47:39 +01:00
Ashod Nakashian
404111877a wsd: broadcast client messages from WSD not from the Kit
Change-Id: I9c179a2f41a0aaeef35b84208be8ab91af9ee53a
Reviewed-on: https://gerrit.libreoffice.org/34051
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-09 04:27:27 +00:00
Jan Holesovsky
963aeb5d1f Don't leak children that did not manage to send their PID to wsd. 2017-02-09 00:09:21 +01:00
Jan Holesovsky
ad20adce1a fuzzer: Don't handle signals when fuzzing.
Change-Id: I2febdf96bcbbd5c6edaf791d99a77674e6f0b0a9
2017-02-08 21:39:55 +01:00
Jan Holesovsky
cd90d8adfe fuzzer: Add --dummy-lok command line option that bypases LibreOffice.
When provided, the DummyLibreOfficeKit is used instead of the real one that
calls LibreOffice.

Change-Id: Ic170d7b4adb72ba17a2b066c509c2b1e657dbccf
2017-02-08 12:34:16 +01:00
Jan Holesovsky
5873d15c62 fuzzer: Use the dummy LOK implementation when fuzzing.
Now it is possible to use:

  ./loolwsd_fuzzer --config-file=loolwsd.xml --o:storage.filesystem[@allow]=true --o:logging.level=fatal --fuzz=/tmp/looltrace

Ie. no need to specify the LibreOffice install location.  Ideally worth
disabling the logging output too, to gain higher performance.

Change-Id: I4fa5f275cd4f4a52fe2cd07e658cea726f6f31c2
2017-02-08 11:54:50 +01:00
Jan Holesovsky
04d7ed9d09 fuzzer: Make the shared loolwsd and loolforkit binary actually work.
Change-Id: If6ee9f22d93aa040f94df86b30fdc8a0a1ad68e2
2017-02-07 13:27:14 +01:00
Jan Holesovsky
0dac1c4321 fuzzer: Compile a separate binary that contains both loolwsd and loolforkit.
Change-Id: I158e4b19d0929de03f09645c106aebfdbc44ea74
2017-02-07 13:27:14 +01:00
Ashod Nakashian
d7a9a76ddb wsd: report PSS of kit processes
Each Kit process now reports its own PSS,
which is much more accurate as they share
a significant ratio of their pages with
one another.

Admin tracks the PSS values of the Kits
and reports to the console.

Change-Id: Ifa66d17749c224f0dc211db80c44f7c913f2d6c4
Reviewed-on: https://gerrit.libreoffice.org/33864
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-03 07:12:31 +00:00
Ashod Nakashian
b9a7e1ef03 wsd: improved test and cosmetics
Change-Id: I25a0a27c12394f41af8e021b72627b1c0537a166
Reviewed-on: https://gerrit.libreoffice.org/33862
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-02-03 07:08:43 +00:00
Ashod Nakashian
8519586674 wsd: manually generate the viewinfo json string
Change-Id: Ia1c1d8752fe134a43be2859db0eb8e87fe5d83f6
Reviewed-on: https://gerrit.libreoffice.org/33684
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-30 08:08:41 +00:00
Ashod Nakashian
7f15ef7ba0 wsd: minimize locking when generating viewinfo
Change-Id: I48b9465a3813aeabb0229c46f210771b82b1f8d1
Reviewed-on: https://gerrit.libreoffice.org/33683
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-30 08:07:04 +00:00
Ashod Nakashian
f33f014f98 wsd: simplify tracking of user info
Change-Id: Iac860c5c1862fa3bbb1b6dd39e827712eb34ed9a
Reviewed-on: https://gerrit.libreoffice.org/33682
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-30 08:06:31 +00:00
Ashod Nakashian
1ba7c0209a wsd: cosmetics
Change-Id: I58a9e579e228d7b4a1e1b5686988aeff8da9922f
Reviewed-on: https://gerrit.libreoffice.org/33674
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-30 02:11:13 +00:00
Pranav Kant
440ca8e2f7 Initial support for comments lok api
Change-Id: I1fc48e245a47f7b8d4260009d8c377c30d0b8820
2017-01-27 23:36:24 +05:30
Jan Holesovsky
c44f7b8a76 Revert "loolwsd: improved MessageQueue"
Now we don't get a situation where there would be a tremendous amount of
invalidates & tile render requests piled in the queue, so we can do it
deterministic again.

The only thing that could potentially pile in the queue are the keypresses
events sent from the clients, but that is a different problem anyway.

This reverts commit c326228774.

Change-Id: I98e199eab0187bf5f47ce322ac1b1b2e3b976b85
2017-01-26 11:49:29 +01:00
Jan Holesovsky
68e597b512 Merge the LOK_CALLBACK_INVALIDATE_VIEW_CURSOR messages together.
And LOK_CALLBACK_CELL_VIEW_CURSOR too - though that ones are not that
expensive.

Change-Id: I5f116c66b1ce4426694d5d58851e104f9061bf53
2017-01-26 11:49:29 +01:00
Jan Holesovsky
e1b4088810 Make the broadcasting actually work.
Change-Id: I35ba20a45fdfe9fc0182c30648693d76a3e10f8a
2017-01-26 11:49:29 +01:00
Jan Holesovsky
1b9e34a3f9 Squash the invalidation messages coming from various view into one.
Change-Id: I65f7e4eb0b82a8c76eef372548ad3298ac70bdd7
2017-01-26 11:49:29 +01:00
Jan Holesovsky
b5128d061d Revert "wsd: batched user-input processing"
This reverts commit 27e1428088.
2017-01-26 11:49:22 +01:00
Jan Holesovsky
febbb570c6 Revert "wsd: cap batches by duration"
This reverts commit 0fe580d9ab.
2017-01-26 11:40:53 +01:00
Ashod Nakashian
0fe580d9ab wsd: cap batches by duration
Batched loKit calls are now capped by time
to limit the maximum latency.

Change-Id: Ife354228f9837dbc4c2e4f216e7f9d85487bac14
Reviewed-on: https://gerrit.libreoffice.org/33423
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:40:34 +00:00
Ashod Nakashian
27e1428088 wsd: batched user-input processing
User input is batched together to reduce
overheads. This initial implementation
will batch all input of the same type
together.

Change-Id: Ia0069de9cf5acecf637941543267f86518c04640
Reviewed-on: https://gerrit.libreoffice.org/33422
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 05:36:48 +00:00
Ashod Nakashian
7f8ffcfab5 wsd: check for malformed callback messages
Change-Id: I991480ea0f7d588c2e9a4e31eaada23fc1da1ffa
Reviewed-on: https://gerrit.libreoffice.org/33419
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 04:37:48 +00:00
Ashod Nakashian
25be7f0ab6 wsd: use own tokenizer
Change-Id: Ia6e58767e3a138d086d4e0ae287782d3ed558076
Reviewed-on: https://gerrit.libreoffice.org/33418
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-23 04:37:21 +00:00
Ashod Nakashian
6246e74433 wsd: copy jail files when symlinking fails
Change-Id: I1f56d1489820a0689495e09151101d41a2322b82
Reviewed-on: https://gerrit.libreoffice.org/33143
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-16 06:27:45 +00:00
Ashod Nakashian
6b3d2bd7ce wsd: notify the user when document loading fails
Also do not segfault in the event.

Change-Id: I80c4c5c0d1d5f1a4cde9a6a3458f69a3df9dc647
Reviewed-on: https://gerrit.libreoffice.org/33140
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-16 06:26:04 +00:00
Ashod Nakashian
e0dcc7a972 wsd: retain the Core callback object
Since we have no control over when Core might
use the callback object, we should retain it
indefinetely. This is safer and has no impact.

Because Core uses a timer to flush callbacks,
it can issue the callbacks for a view after
it had been destroyed, thereby segfaulting.

Change-Id: I2ef87234d0b4dff83ded320b480abce53188fec4
Reviewed-on: https://gerrit.libreoffice.org/33116
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-16 01:44:39 +00:00
Ashod Nakashian
6bcd793a8b wsd: don't exit Kit process when new sessions exist
When a new session is created in Kit, it means
a new view is about to be created. However if
in the interim the last session closes and
view is destroyed, Kit should not exit.

Instead, we unload the document and
prepare to reload it again.

Change-Id: Idbc3a663b4d6921440736499f2d439fc2b7e33dc
Reviewed-on: https://gerrit.libreoffice.org/33115
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-16 01:43:20 +00:00
Ashod Nakashian
0e5a75c46b wsd: exit the kit only when no more sessions exist
Change-Id: I26cd8876fd564f537dac4fb1748aee5b4dbdff04
Reviewed-on: https://gerrit.libreoffice.org/33114
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-16 01:43:08 +00:00
Ashod Nakashian
dea8c03912 wsd: no need to have the lock when notifying
Change-Id: If19aac3d52b45b0b0efc143885b933669d8a1198
Reviewed-on: https://gerrit.libreoffice.org/33113
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-16 01:36:00 +00:00
Tor Lillqvist
3d18b6558d Revert "I assume these plus signs were accidental slips of the finger"
Thet are intentional.

This reverts commit c31425e4e2.
2017-01-13 17:47:49 +02:00
Tor Lillqvist
c31425e4e2 I assume these plus signs were accidental slips of the finger
Change-Id: Ic227f40d1ba71cef388719ef10dfcf4d9f172caf
2017-01-13 16:23:18 +02:00
Tor Lillqvist
11ae90cfcb No Hungarian notation please
Change-Id: Ia624de45a792db7e39f2245aaea7d940b30b0db2
2017-01-13 14:52:08 +02:00
Tor Lillqvist
bc19f90dd4 Don't send a tile that hasn't changed even if client asks for it
The server tells the client the hash of each tile it sends (calculated
from the contents of the tile, not its PNG encoding). When the client
asks for a tile to be refreshed, it tells the server what the hash of
the existing tile is. If the server notices that the tile contents
hasn't actually changed, it doesn't PNG encode it and doesn't send it
to the client.

The intent is that this will reduce load on the server and also avoid
unnecessary tile traffic.

Change-Id: Ia06ca68655ea984ed4319f24f4470afda322eccf
2017-01-11 23:25:21 +02:00
Tor Lillqvist
3f7cca78eb Indentation fixes
Change-Id: I72010aeff7fb65f9dc18613d0cfc53b5154e07c1
2017-01-11 13:44:57 +02:00
Ashod Nakashian
b2160ee3a7 wsd: improved logging
Change-Id: I9c10803f451b6226c6a15d89acd4758c04042f28
Reviewed-on: https://gerrit.libreoffice.org/32864
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-09 06:20:33 +00:00
Ashod Nakashian
dfcada64b8 wsd: tilecombine now includes the versions of the tiles
Previously tilecombine had its own version, which is
nonesensical, since it's not really a tile.

Now it passes the version to the tiles when
parsing and serializes version per-tile.

Change-Id: I5db8d94880431e3d2a40b6787c6fe51a05771305
Reviewed-on: https://gerrit.libreoffice.org/32633
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-09 06:09:05 +00:00
Henry Castro
4641c922ea kit: use a second stage init after fork call 2017-01-06 15:49:33 -04:00
Henry Castro
22b80e285b kit: remove unused typedef function pointer 2017-01-06 15:35:57 -04:00
Tor Lillqvist
3f948ab333 Bin duplicate #include
Change-Id: Ic1bf34549b2ee081534aef5f0a77a1bd6023e36e
2017-01-05 12:08:37 +02:00
Tor Lillqvist
a36d4b0fc3 Reanme png namespace to Png for consistency
As far as I see, we tend to use the same namespace name as the
basename of the corresponding include file, and this stuff is defined
in a file called Png.hpp.

Change-Id: Id859e13e94568abd9f1d5b4ef3bfbbb0c156db11
2017-01-04 13:35:26 +02:00
Ashod Nakashian
f0524b3ac9 wsd: must have document lock when accessing LoKit instance
Change-Id: Ie26178448fb513ed08acc61ec34c1af97e76eda8
Reviewed-on: https://gerrit.libreoffice.org/32617
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:06:16 +00:00
Ashod Nakashian
7f08cf5387 wsd: cleanup TileQueue accessing in Kit
Change-Id: I50ff5bea0e0b193baef2abfaa1a866a7e20f9ab8
Reviewed-on: https://gerrit.libreoffice.org/32616
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:05:45 +00:00
Ashod Nakashian
1a6098b925 wsd: TileQueue should be fully threadsafe
There should be no need to take a lock to
access it. However there were cases where it
wasn't thread-safe. Now we can remove unncessary
locking before invoking it.

Change-Id: I90d2c6940610a59aa6c749491ea85fb80b0acbcd
Reviewed-on: https://gerrit.libreoffice.org/32615
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:04:18 +00:00
Ashod Nakashian
d907c6b554 wsd: exit Kit immediately after unloading last view
Also kill canDiscard and hasSessions, instead call
purgeSessions directly.

Change-Id: I437fd3620299bc7f694c6c8e9c55fb6dccbe34a0
Reviewed-on: https://gerrit.libreoffice.org/32609
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 06:00:48 +00:00
Ashod Nakashian
9de86cc0ae wsd: refactor render options handling
Change-Id: I378ed6b76c236d9878c721a579c2b2296ff8144a
Reviewed-on: https://gerrit.libreoffice.org/32608
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 05:59:48 +00:00
Ashod Nakashian
b4c4b29ecc wsd: remove unnecessary checks of _loKitDocument
Since load() returns _loKitDocument, there is no
point in checking it again.

Change-Id: Ice511ba3f42cf9411918397a73497d3a07bbdfe5
Reviewed-on: https://gerrit.libreoffice.org/32607
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 05:58:48 +00:00
Ashod Nakashian
02b69738ca wsd: always lock documentMutex around loKitDocument
The _documentMutex used to be a member of _loKitDocument,
so it couldn't be locked when _loKitDocument was null.

However this has long since changed and is independent.
So no good reason not to lock it at every access point
of _loKitDocument, which is simpler and safer.

Change-Id: I82bdff5f94b5eaf68365d8cdb3ef5779e6c6cc87
Reviewed-on: https://gerrit.libreoffice.org/32606
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 05:58:26 +00:00
Ashod Nakashian
2fcf6220f1 wsd: log documentLoad call and duration
Change-Id: Ia1633ee6d57de5c13926a808f9adc2a85a9c839c
Reviewed-on: https://gerrit.libreoffice.org/32603
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 05:57:38 +00:00
Ashod Nakashian
ad2a9b90e4 wsd: lock when accessing session container
Change-Id: I3216036ee7ad4cf86b27dea35de97dae1baf67c7
Reviewed-on: https://gerrit.libreoffice.org/32605
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 05:57:21 +00:00
Ashod Nakashian
a1dd40eaad wsd: cleanup renderopts json creation and merging
Change-Id: I84e49938cc390cc9e6421e79903c7a8935f9775e
Reviewed-on: https://gerrit.libreoffice.org/32604
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 05:56:48 +00:00
Ashod Nakashian
c4d368149e wsd: simplify session purging
Change-Id: Ied5206dc524c8ff772c175ec4c78c23b9a305a32
Reviewed-on: https://gerrit.libreoffice.org/32602
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 05:55:43 +00:00
Ashod Nakashian
9d49e1595d wsd: check session before releasing lock
By the time load() is invoked, _mutex is already
unlocked in onLoad(), so it is no longer safe
to access _sessions.

So we need to get the session and pass it to load.

Change-Id: I671647f6df4128b8595082af2355fbef33994cdd
Reviewed-on: https://gerrit.libreoffice.org/32601
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-02 05:55:01 +00:00
Ashod Nakashian
a5440a4ab2 wsd: kit logging improvements
Change-Id: I12e0b82a45193f7a3633175667e842627be52ba5
Reviewed-on: https://gerrit.libreoffice.org/32563
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 04:21:32 +00:00
Ashod Nakashian
de4a7a139e wsd: Kit comments and cosmetics
Change-Id: Ie6abd479cfce77b41597dd793687e3f862d3dbba
Reviewed-on: https://gerrit.libreoffice.org/32559
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 04:18:51 +00:00
Ashod Nakashian
94ed8393c5 wsd: improved document/view loading logs in Kit
Change-Id: I51a86b73463dbbaa1875dde14be3745f69e097ef
Reviewed-on: https://gerrit.libreoffice.org/32555
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2017-01-01 03:58:06 +00:00
Noel Grandin
d6b767b840 loplugin:cstylecast
Change-Id: I5a0524aca89b16ba336d69028faf76cccab22d59
Reviewed-on: https://gerrit.libreoffice.org/32371
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:46:57 +00:00
Noel Grandin
05f88bf9a5 loplugin:redundantcast
Change-Id: I14945f34d3ab6d3c148b40e95069159bf40bd99e
Reviewed-on: https://gerrit.libreoffice.org/32370
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:45:42 +00:00
Noel Grandin
f53669cf9d loplugin:unreffun
Change-Id: I06b13a5c035f6ae4dd4b414f49a0987c019feea5
Reviewed-on: https://gerrit.libreoffice.org/32365
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-27 10:26:23 +00:00
Noel Grandin
4ed820d3d5 add a configure option for using clang compiler plugins
and apply the nullptr plugin.

Lots of hacking in my LO tree required to make this work, will probably
end up needing to add an extra parameter to the LO side.

Change-Id: I02ae1dcdece9d9ddf05f7757f6696e3a5d7d1f14
Reviewed-on: https://gerrit.libreoffice.org/32339
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-22 14:23:42 +00:00
Noel Grandin
4199efc91c convert enums to scoped
Change-Id: Ic3d4c09dbcec28b4638bb8888f812f970f40a1c5
Reviewed-on: https://gerrit.libreoffice.org/32331
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Tested-by: Tor Lillqvist <tml@collabora.com>
2016-12-22 09:51:56 +00:00
Henry Castro
f0c5e907ab kit: debug, simulate loading document
Very useful when the bug is reproducible in the preinit, init lokit stages,
so the scenario can be isolated.
2016-12-17 08:32:49 -04:00
Henry Castro
20f6d8cdc7 kit: cosmetic
Required to custom lokit process debug
2016-12-16 23:39:53 -04:00
Miklos Vajna
645049e081 Kit: clean up redundant member initializers
Change-Id: I3a320d9647ab729e71ce93ce90fb63eb3b39ae35
2016-12-06 14:05:49 +01:00
Ashod Nakashian
c326228774 loolwsd: improved MessageQueue
Tiles no longer hog the queue ahead of all else.

We now give priority to callback events, so clients
get to know the document state sooner.

Since tiles take long to render, an equal time
is given to non-tiles (capped at 100ms).

Finally, Impress preview tiles are given
the lowest priority and rendered only when
the queue is drained.

Change-Id: I922c1e11200e5675f50d86b83baee1588cbbf66f
Reviewed-on: https://gerrit.libreoffice.org/31394
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-30 04:42:40 +00:00
Ashod Nakashian
b35725ab70 loolwsd: support more efficient full-buffer hashing
Change-Id: Ie30929ad4665b51e280c1126adde645742814dad
Reviewed-on: https://gerrit.libreoffice.org/31294
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:03:17 +00:00
Ashod Nakashian
da30dc3df3 loolwsd: factor out the png cache lookup
Change-Id: Id287b136b687d9bc4f49a3583e18cb820f4eb21e
Reviewed-on: https://gerrit.libreoffice.org/31293
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 05:02:34 +00:00
Ashod Nakashian
ef9ab94580 loolwsd: less aggressive png cache eviction
The overall hit-rate improves significantly
when we don't remove entries too soon.
Here we give entries more time to show their
merrit.

There are now two limits, soft and hard.
The former is used to remove entries with no
hits at all, while the latter is used to
avoid overflowing the cache footprint too
much. Entries also get started with a single
hit, which prevents them getting evicted
too soon (i.e. right after getting added).

Finally, there is no longer need to reduce
the hit count of entries too agressively
since we have two tiers (soft and hard limits)
and zero-hit entries are removed before others.

The average cache size while auto-typing in
Writer doc is less than 180kb, which is 1.4x
the original size of 128kb.

Change-Id: I946318151638c9c64c714190084c492f9098852b
Reviewed-on: https://gerrit.libreoffice.org/31291
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:58:51 +00:00
Ashod Nakashian
9608935a7c loolwsd: png cache hit rate and cosmetics
Change-Id: I66ab1738503618002bb05504c608969d5aa7b9a9
Reviewed-on: https://gerrit.libreoffice.org/31290
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-11-28 04:57:45 +00:00
Michael Meeks
85583f0a89 Avoid PNG compression for un-changed tiles. 2016-11-25 15:48:56 +00:00
Michael Meeks
c1a398977f Adapt makefiles, includes etc. to new locations. 2016-11-25 09:58:57 +00:00
Michael Meeks
cca657c8f2 Apply the pre-branch rename script to re-organize the source. 2016-11-25 09:58:48 +00:00
Renamed from loolwsd/LOOLKit.cpp (Browse further)