Commit graph

99 commits

Author SHA1 Message Date
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)