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.
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
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>
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
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"
We already explicitly check earlier, after attempting to create it,
and log a fatal error and exit on failure.
Change-Id: Ia3fde4026839a255d4d19932300e16a05f9a33d2
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.
The needed files were not copied, and consequently the hostname
resolution did not work in the chroot.
Change-Id: Id3dccc4f70cd1deeddb83c8e672f240e06748e34
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>
Last lingering bits are the xpdfimport import support and
some horrors required for NSS.
This requires a reasonably new core.
Change-Id: I2e08b841668722af0e3b947cf2b06687cca73b53
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>
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>
"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>
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>
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>
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>
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>.
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
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
... before lokit thread magically dissappears because some function in
LO core threw an 'Exception'
Change-Id: I8357b18d95674af8ec4d2f57ad41087f7b7dfcff
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>
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
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>
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>
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>
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>
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>
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
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>
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
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>
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
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>
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>
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>
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>
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>
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
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>
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
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>
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>
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>
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>
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>
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>
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>