Commit graph

269 commits

Author SHA1 Message Date
Tor Lillqvist
10c302f047 Make std::chrono usage more portable
Add a std::chrono::time_point_cast to get it to compile against libc++
(for iOS).
2018-09-04 12:12:35 +03:00
Tamás Zolnai
14537846a8 Handle unset client visible area case while calculating tiles-on-fly limit
Change-Id: I25ea6f1efdc8115304d5449cfccdbb5c0c15fb1f
2018-09-03 16:35:00 +02:00
Tamás Zolnai
dce6c18fb4 Calculate tiles-on-fly limit a bit more precisely
Change-Id: Id012a83d6ccd226d1b66e3cd48a9caeafd849fc5
2018-08-30 18:42:55 +02:00
Tamás Zolnai
759d1fe722 Drop too old tileID's from tiles-on-fly list
So we can avoid that tile sending stop working because server is
waiting for tileprocessed messages which will not arrive.

Change-Id: I545346c50d49340999608aadac32b5190ede43c5
2018-08-23 12:47:52 +02:00
Tamás Zolnai
54596dbcf9 Reset also the wireId map by canceltiles 2018-08-22 16:53:07 +02:00
Tamás Zolnai
fd87e1e315 Crash: Check whether we still have requested tiles
Change-Id: I2a8b9ced09ff624ce925b52a60352e6fa50af25e
Reviewed-on: https://gerrit.libreoffice.org/59334
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Tested-by: Aron Budea <aron.budea@collabora.com>
2018-08-20 18:19:54 +02:00
Tomaž Vajngerl
cfab70c48b get rid of boost::optional
We don't check if boost is available in the configure phase so we
can't use it. It is possible to add it but as we only use it in
one place and it is actually not really needed, it is better to
remove the usage.

This change also moves the std::list to std::deque.

Change-Id: I4c661a2fb8995bf756a0815a6e30bb304f22d3c8
Reviewed-on: https://gerrit.libreoffice.org/58640
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-08-20 17:43:44 +02:00
Tamás Zolnai
7d98b5f015 Revert "Get back "Cancel tiles also in wsd's senderqueue""
This reverts commit f1a385be98.

It's not easy, it can interfere the tile tracking.

Change-Id: I1e4ec9b4d66e5e912873f673fd5cb71ba55a9332
Reviewed-on: https://gerrit.libreoffice.org/59326
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
2018-08-20 15:13:59 +02:00
Tamás Zolnai
f1a385be98 Get back "Cancel tiles also in wsd's senderqueue"
This reverts commit ec8b7bc012.

Change-Id: I0a4f3f529c86522261085d4feec45e4b56a7e0e6
2018-08-17 23:47:10 +02:00
Tamás Zolnai
3bc8821bb0 Enough to have smaller tiles-on-fly limit
Change-Id: I7e9e1b2c117cb8938b6f0fb2eac8ab3e2c8fef30
2018-08-10 17:49:48 +02:00
Tamás Zolnai
cec718d0f1 Fix TileCacheTests::testCancelTilesMultiView failure
Change-Id: I9d05a1f041611a30f598c18c13525e807851604d
2018-08-03 12:26:10 +02:00
Tamás Zolnai
ec8b7bc012 Revert "Cancel tiles also in wsd's senderqueue"
This reverts commit 0bb96131c4.

Change-Id: Iffea072aabc88e5150e6ec069917b7965850683a
2018-08-03 12:21:29 +02:00
Tamás Zolnai
165e5b4e1c Use a bigger number as a tiles-on-fly limit
So scrolling can be more smooth.

Change-Id: I7b029c0ccc2de6883db54493a9188ae54a346a1d
2018-07-31 17:19:12 +02:00
Tamás Zolnai
8d95ca7165 Make client tilesBeingRendered tracking more robust
Store the tile cache names and drop outdated tiles
times to times, so we can avoid tile rendering / sending to
stuck.

Change-Id: Ibff001307c7c660cbc57ab20c29c430e0090444d
2018-07-31 15:44:15 +02:00
Tamás Zolnai
0bb96131c4 Cancel tiles also in wsd's senderqueue
Change-Id: I683b3cacee2f87d0dc0f28ad9ac3e122bcd043f1
2018-07-31 13:18:44 +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
Tamás Zolnai
b014804ce2 Trace sent tiles when they are actually sent
SenderQueue might drop some tiles, so we were waiting for
tileprocessed message for a tile which was not sent at all.

Change-Id: I7c502966f656e46df7c22002dee19aeabbf97774
2018-07-24 20:52:45 +02:00
Tamás Zolnai
8d92b0809d Store wiredIDs on the server side
So we can use this information in tile requests.

Change-Id: I87ba420ec0fd699353d48a228268e546ace21921
2018-07-19 14:13:03 +02:00
Tamás Zolnai
e1b22eaac3 Calculate TilesOnFly limit based on visible area
Use 10 as a minimum value.

Change-Id: I9442a427fd25e1a7a32c3d1d06aa34d2c4ca2472
2018-07-19 14:12:52 +02:00
Tamás Zolnai
2fda5f7d92 Use an upper limit for number of tiles we push to the network
I used number 25 as this limit. It's an approximate value. It's enough
to handle the first 5-10 character input without waiting for tileprocessed
messages. After the first 5-10 characters the tileprocessed messages are
arriving continuously (same frequency as the typing speed), so for the later
character inputs we always have some tileprocessed messages arrived so
we can push new tiles to the network again.
This 25 upper limit also seems enough to send all tiles when a whole page is
requested (e.g. zoom os scroll).

We store the requested tiles in a list, used as a queue. I don't use std::queue
because sometimes we need to do deduplication (replace older versions of the
same tile with a newer version).

Change-Id: I22ff3e35c8ded6001c7fc160abdc1f1b12ce3bae
2018-07-19 14:12:41 +02:00
Tamás Zolnai
4e2b50dc0f Check whether tile rendering request was already sent
Change-Id: Iceb559106dcd95d6ff7db67df76cdfb04f9fb7e0
2018-07-19 14:12:27 +02:00
Tamás Zolnai
85f96bc281 Store sent tiles's id instead of using a simple counter
Change-Id: I8cbf84923a53fb6b294bd4039eb7382326f8c445
2018-07-19 14:11:18 +02:00
Tamás Zolnai
464dd72e1c We might need to rerequest tile rendering when we are at sending them
Change-Id: I0551e51c5f5023931dad13435b4ac3517fc48931
2018-07-19 14:11:02 +02:00
Tamás Zolnai
15afe2c0fb Wait tileprocessed message from client to send new bunch of tiles
We always  one bunch of tiles (e.g. all tiles invalidated) and we
are waiting until client send tileprocessed message back for all
tiles before sending the new tiles.
By canceltiles message we drop every previously requested tiles and
make wsd ready to send new tiles, which will be requested by the client
in theory.

Change-Id: I9901420ada549e962ffaf5e6bd58e52b86bd129d
2018-07-19 14:10:08 +02:00
Ashod Nakashian
b3bdd5786d wsd: support optional forcing tracking changes at load
Since changing the tracking state is done by toggling,
we need to wait to get the current state at load time
before we can tell whether we need to toggle it or not.

Change-Id: Ib5a2639b2acf3874c191971eedf9a3bebcefebad
Reviewed-on: https://gerrit.libreoffice.org/53415
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
2018-06-14 17:00:39 +02:00
Jan Holesovsky
432a1c7d78 Split close(bool) into close() and terminate().
The bool flag was causing 2 complete separate code paths anyway.

Also remove stop(), calling stop() followed by close() made no
difference.

Change-Id: Ica4c887b0324390d4e006a26eb4119bd5ab08723
2018-05-18 15:16:40 +02:00
Marco Cecchetti
6a0fcdf15f wopi flag for hiding the change tracking controls from UI
Change-Id: I1b9aa4f8111d77ae12093022205fad1cbee850ac
Reviewed-on: https://gerrit.libreoffice.org/53335
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-04-24 18:15:44 +02:00
Andras Timar
dde84d1706 wsd: encode '#' character in file name
Change-Id: I4d10f38c9025f18a0d0f0f5599892b436b9d002c
Reviewed-on: https://gerrit.libreoffice.org/49919
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2018-02-19 18:15:42 +01:00
Pranav Kant
595ed1c6b1 wsd: DocumentBroker: Don't initiate the document close
Just broadcast the message and let clients deal with it. This is similar
to how we do it when we find the document conflict via CheckFileInfo

Change-Id: I52855fcb96a359b3915afe71d481321f79b4554b
2018-02-08 12:30:23 +05:30
Pranav Kant
5476774af1 wsd: Use a close request flag to break out of doc broker poll thread
... instead of directly stop()ing it. The close request approach also
makes sure that outgoing document is saved to storage.

Change-Id: I44f61db00dbd326dec80f59f4a2cbb617048aa94
Reviewed-on: https://gerrit.libreoffice.org/49122
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-02-07 14:30:33 +01:00
Miklos Vajna
1dde430bcf wsd: spell out non-trivial autos to improve readability
Change-Id: I0e1f169fc39e5c722704e1cae487147d929f7350
2018-02-07 10:18:12 +01:00
Pranav Kant
28ea409a45 wsd: Don't save if document is unmodified
This also prevents saving the document back to storage.

Without this patch, in case of document conflict (when the document is
changed behind our back in the storage), the unmodified document end up
being saved to storage, hence overwriting the document which was changed
behind our back.

Change-Id: Ie027f5b49c37e7df3f36499e0fef3eca78173969
Reviewed-on: https://gerrit.libreoffice.org/49114
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-02-01 19:47:08 +01:00
Michael Meeks
d3c17510ed Implement an improved fork/exec wrapper.
* logs helpful messages for various error corner-cases.
* optimized file descriptor closing for large fd counts.

Change-Id: I8cba9ecb3d71ddc6e22e20d89368d8c6b9b5097f
2018-01-29 15:20:10 +00:00
Ashod Nakashian
c06376cc1d wsd: cleanup logging and remove unused helpers
Now all logging is done after checking if the
level in question is enabled or not (thanks to
the macros LOG_XXX), which saves unnecessary
conversions and stringification when said level
is disabled.

Change-Id: Icde31e067f60269563896f04f8b0d65643720766
Reviewed-on: https://gerrit.libreoffice.org/47885
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-01-19 00:33:40 +01:00
Ashod Nakashian
f7fc3f494c wsd: save before stopping
We don't force saving unconditionally now. Only
when the doc is reasonably expected to be modified
do we force saving (to circumvent the minimum duration
between auto-saves).

We invoke auto-saving before stopping the DocBroker
polling loop, whether due to idleness or server recycling.

Change-Id: I257d55f190d3df6a3ba82f2666c7602da0581d0c
Reviewed-on: https://gerrit.libreoffice.org/47887
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-01-15 15:04:14 +01:00
Ashod Nakashian
b5baf3672f wsd: stop DocBroker using only stop() member
Now always given a proper reason too.

Also, stop polling thread and cleanup when
failing to acquire/spawn a child process.

Change-Id: I7ddee01dd47b8ee72f2d9134c0f1b264634d8611
Reviewed-on: https://gerrit.libreoffice.org/47886
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-01-15 15:03:21 +01:00
Ashod Nakashian
8ad29ee050 wsd: separate lastSaveTime from lastSaveResponseTime
Previously we assumed we are saving based on
lastSaveTime, which is incorrect because it
is set only upon successful saving and storing,
which might fail.

Now lastSaveResponseTime is used to track whether
there are saving requests in flight. And lastSaveTime
is only used when we do store the document in storage.

Change-Id: I73e5c04432981d0cca11b8cf854414738bd894de
Reviewed-on: https://gerrit.libreoffice.org/47884
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-01-15 15:02:40 +01:00
Ashod Nakashian
a3a8551f2d wsd: remove lastEditableSession flag
Maintaining a flag is problematic, at least the way
it was reset on adding new sessions. Luckily there
should be no reason for having it, since we should
check it only when removing sessions. Also, we
need to check for every case of removal, and not, as
was, just on disconnection, which is incomplete.

Change-Id: I878766701228c41fc93eeaff21852fa887de9eff
Reviewed-on: https://gerrit.libreoffice.org/47883
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
2018-01-15 15:02:27 +01:00
Ashod Nakashian
d53ce5511d wsd: const and cosmetics
Non-functional changes.

Change-Id: I7c52386e2f870d29fd62c6dae6f37f4a58c2396b
Reviewed-on: https://gerrit.libreoffice.org/47882
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-15 08:06:56 +01:00
Michael Meeks
9335f6ff12 Warn if we exit with a modified document around.
Change-Id: Ie38ab49c66358f674e14820a6ffa993c25aa9e92
2018-01-12 16:17:12 +00:00
Ashod Nakashian
5f175c5120 wsd: save documents before recycling
Change-Id: I24afc5c1bceca272f23a129609f73fc5a8d3caf2
Reviewed-on: https://gerrit.libreoffice.org/47739
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-11 08:13:16 +01:00
Ashod Nakashian
040a211d60 wsd: set modified flag on the storage when set on the DocumentBroker
Change-Id: Ieb4eb02f68f2d02ad88d6f59ad61de8f1e309670
Reviewed-on: https://gerrit.libreoffice.org/47365
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2018-01-06 22:14:23 +01:00
Ashod Nakashian
d96cb94d02 wsd: set modified flag on the storage when set on the DocumentBroker
Reviewed-on: https://gerrit.libreoffice.org/47367
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 752e3b7002f2199438aa81d5b660088da3faac44)

Change-Id: I13e25b2edff33d6fd9999dec5eb34d7847fbbd2e
Reviewed-on: https://gerrit.libreoffice.org/47400
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit e9ce36f26ea3f007e00efbf9012bbbe8f93ccc9d)
2018-01-05 14:38:34 +01:00
Pranav Kant
f63858433b loplugin:includeform
Change-Id: Ib62a7aa61062f00698aa3e8a144438de5c57e53d
2017-12-20 21:21:05 +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
Tor Lillqvist
7c77a6c3a3 Add handling of "prefilter" plug-ins
When the name of a document to be edited ends with an extension
matching that mentioned in a prefilter plug-in's configuration file,
the command specified is run and it is the output file that is
actually edited.
2017-11-13 16:27:53 +02:00
Jan Holesovsky
61ce9c38e6 Save: Inform the user when saving has failed in LOK.
Change-Id: Ie3bcdf9f6ca898b2763c31e6eb05c3a20be5859f
Reviewed-on: https://gerrit.libreoffice.org/44399
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2017-11-10 11:08:53 +01:00
Jan Holesovsky
513ffe36c1 Save As: UI for changing the document name.
Change-Id: I23aba95ff0f8d867b021ba3cf0a6bc5eb4754f9d
Reviewed-on: https://gerrit.libreoffice.org/44282
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
2017-11-10 11:08:53 +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
Tor Lillqvist
4ab070ec38 Sort #include and using lines for consistency
... but did not have the time or energy to do it in all files.

Change-Id: I92ea101cae1ad7be0fd2f31ce5a8d4b4149332c9
2017-11-08 10:34:37 +02:00