Commit graph

78 commits

Author SHA1 Message Date
Pranav Kant
2c3739bdc2 loolwsd: Fix a memory leak
Change-Id: I9a48c2846f74cb7cee8430dd4e72ba0580a7e7f2
2016-03-13 01:09:52 +05:30
Tor Lillqvist
e7e1ef58ae Cosmetics: Sort and prune #include and 'using' lines 2016-03-08 09:44:04 +02:00
Tor Lillqvist
9f67eecadd Improve exception logging
Always try to identify *where* we caught the exception. It is not that
useful to have half a dozen places that all just log "Exception:".
2016-03-07 18:36:01 +02:00
Tor Lillqvist
6859c85543 Factor out function to get the symbolic name for a LibreOfficeKitCallbackType 2016-03-04 11:49:46 +02:00
Tor Lillqvist
28fd1ace0c Make it clearer in the logging which callback is which 2016-03-04 11:32:25 +02:00
Jan Holesovsky
2590cd186e loolwsd: LOK_CALLBACK_PARTS_COUNT_CHANGED was removed from the API. 2016-03-03 11:13:34 +01:00
Tor Lillqvist
02913dcbfc Use std:: consistently for cstdlib functions 2016-03-02 08:47:13 +02:00
Tor Lillqvist
4f701d5d84 Avoid aligning equal signs on sequential lines in a few arbitrary places
If we would use such style, we would need to do it consistently.
2016-03-01 17:28:47 +02:00
Miklos Vajna
f46a43b5f5 loolwsd: fix -Werror,-Wunused-parameter 2016-03-01 09:53:37 +01:00
Miklos Vajna
a010c01bd7 loolwsd: fix -Werror,-Wunused-private-field 2016-03-01 09:51:09 +01:00
Tor Lillqvist
9d655cbcc0 Don't pretend this will work on anything except Linux 2016-02-29 14:25:12 +02:00
Tor Lillqvist
b4387a535a Bin some superfluous using declarations and includes, and actually use others
Sorry, could not resist. Obviously not very important.

In retrospect, maybe it would have been better to have as policy to
*not* use any 'using Poco::Foo'. Now there is an inconsistent mix of
writing out the complete type and using a 'using'. Plus copy-pasted
long lists of 'usings'. And of course, one should never have 'using'
in an include file. Oh well.
2016-02-22 11:37:47 +02:00
Henry Castro
c2413998be loolwsd: add partscountchanged protocol 2016-02-20 16:45:40 -04:00
Pranav Kant
b71ebb8dfc loolwsd: Ask for password for multiple views also
This is possible by moving all the password handling logic to
Document container class. When a user opens a password protected
document the first time, it saves all possible data such as
password, password type etc. Upon opening the same document
again, password is matched with the cached password saved in the
document container class before allowing the new view access to
this document.

Change-Id: Id1f2b6e06de806564bf865e83fed51b01c9a0fbc
Reviewed-on: https://gerrit.libreoffice.org/22208
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 22:00:46 +00:00
Pranav Kant
10db02c208 loolwsd: Move document related callback logic to Document class
There are 5 LOK callbacks currently that are triggered on LOKit,
and not on LOKitDocument. These include status indicators, and
document password callbacks during document load. Lets move all
the callbacks called during document load in the Document container
itself, and keep the callbacks called after document load in the
Child session.

Change-Id: I8e43c2baaa12023b34822954dd494780ee6dd7ca
Reviewed-on: https://gerrit.libreoffice.org/22206
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:56:50 +00:00
Pranav Kant
3667bef9a6 loolwsd: Handle password protected documents
Change-Id: Iceb5bb598ef1517bf640994c27bad4ca36bd72c1
Reviewed-on: https://gerrit.libreoffice.org/21894
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-02-19 21:49:45 +00:00
Miklos Vajna
e3cc05ddcd loolwsd: fix indentation 2016-02-19 08:38:02 +01:00
Pranav Kant
9cf0cbf3a6 loolwsd: Allow sending 'tilecombine' messages with 'timestamp'
... and revert back with this parameter in 'tile:' response
messages so that client can identify the response.

This is also required to make client-side tile benchmarking tests
work again.

Change-Id: I307aabf622b17f4dce727d1faf3c83eb566ba905
2016-02-19 00:32:03 +05:30
Pranav Kant
da729a2b74 loolwsd: Add missing callbacks
We have a new callback now in LO core.

Change-Id: I560e5e31d08cf2b9969b8c5f9614630c29ee89c6
2016-02-17 16:24:13 +05:30
Jan Holesovsky
93b65fc92f loolwsd: For the legacy loleaflet, default to the left button pressed. 2016-02-09 09:22:11 +01:00
Jan Holesovsky
7c96094c42 loolwsd: Make the mouse command in loolwsd compatible with older loleaflet. 2016-02-08 16:42:49 +01:00
Jan Holesovsky
32ecdb8ab6 loolwsd, loleaflet: Handle the ERROR callback.
This introduces a new error id 5 - "document save failed".
2016-02-03 11:24:21 +01:00
Miklos Vajna
aa450a0c38 loolwsd: add clientvisiblearea client -> server command 2016-02-02 11:49:22 +01:00
Miklos Vajna
4b3c5ea8ff loolwsd: doxygenize class comments 2016-01-28 19:16:32 +01:00
Miklos Vajna
1312211f71 loolwsd: -Werror,-Wswitch 2016-01-28 18:17:13 +01:00
Ashod Nakashian
65e06c1db7 loolwsd: per ChildProcessSession callback queue and thread
By giving dedicated queue to each session we eliminate
the bottleneck that a slow client will introduce
on every other session on the same document.

Change-Id: I715b80a8cd7bbef1268dc472d0b32e35f3dd6444
Reviewed-on: https://gerrit.libreoffice.org/21763
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 23:57:54 +00:00
Ashod Nakashian
904bf929f1 loolwsd: throttle traffic for inactive sessions
Sessions that have been inactive for a certain duration,
currently set at 120 seconds, will not receive updates.

A new statistics class tracks the activity of every
session and blocks callback updates from reaching
inactive clients.

Change-Id: I64296488b2c0be0598b218ba89a6d02f057a5f7e
Reviewed-on: https://gerrit.libreoffice.org/21760
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 21:14:57 +00:00
Ashod Nakashian
55f2105f00 loolwsd: logging improvements
Change-Id: I77844a2b549c1f497c2d44f054169bf11d9227d8
Reviewed-on: https://gerrit.libreoffice.org/21752
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-24 21:00:34 +00:00
Ashod Nakashian
41da8f144e loolwsd: unload command added
Change-Id: I30c42e24aa38c676e4bc6c7e6a2715d9e72430b9
Reviewed-on: https://gerrit.libreoffice.org/21686
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 16:07:54 +00:00
Ashod Nakashian
dd374d8aec loolwsd: disconnect command to gracefully shutdown a socket
Change-Id: I8beb4c14fc95bdb2a98c7e5da44408511bce5e28
Reviewed-on: https://gerrit.libreoffice.org/21683
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-21 16:05:55 +00:00
Miklos Vajna
93eccfad98 ChildProcessSession::_mutex -> Mutex
As it's a static member.
2016-01-18 09:43:49 +01:00
Miklos Vajna
1977f07d5c paste: handle data containing newlines
By changing the protocol, so that instead of "paste ... data=<data>",
the client is now expected to send "paste ...\n<data>".
2016-01-15 14:43:59 +01:00
Ashod Nakashian
bdd3f73bd5 loolwsd: misc child cleanup
Change-Id: I5ed100e053925264db2cb8f60de67cf6a536a65b
Reviewed-on: https://gerrit.libreoffice.org/21470
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-14 13:40:40 +00:00
Tomaž Vajngerl
721cbbcbb3 Add "tilecombine" command to render more tiles in one call
When invalidating we need to rerender more tiles at once.
This change optimizes that with a new command which rerenders a
larger area once and then separates the rendered buffer into more
tiles. This generally decreases the invalidation time by 2-4 times
and in some cases (when invalidating images in document) up to 9
times.
2016-01-14 13:11:57 +01:00
Tomaž Vajngerl
9071f7c9bc encode PNG from buffer at arbitrary buffer position
This commit add 2 methods to encode a buffer to PNG: the "old"
method which encodes the whole buffer to a PNG, and a new method
to encode a part of a buffer (sub image) to PNG. The first method
is only added for convenience.
2016-01-14 12:34:01 +01:00
Ashod Nakashian
ecc35dcdb2 loolwsd: using recursive_mutex since callbacks invoke public functions
Change-Id: Iddcf342cf59c4bd534be52a4b4661bc630f07007
Reviewed-on: https://gerrit.libreoffice.org/21378
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-12 04:34:23 +00:00
Ashod Nakashian
37a4d8ec10 loolwsd: uniqueLock -> lock, lock() -> getLock()
Change-Id: I3ea58a1ee0f8c0d7a153b78a2a03104d07416760
Reviewed-on: https://gerrit.libreoffice.org/21377
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-12 04:33:42 +00:00
Miklos Vajna
d08b1ff7e2 loolwsd: -Werror=shadow 2016-01-11 11:17:36 +01:00
Miklos Vajna
1fbe0580e1 loolwsd: -Werror,-Wunused-private-field 2016-01-11 09:18:37 +01:00
Ashod Nakashian
55f857e17c loolwsd: Poco::Mutex -> std::mutex and callback locks on session
Change-Id: I9c7d16352110566e5fc31c280784ded30cd3a9be
Reviewed-on: https://gerrit.libreoffice.org/21333
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:12:11 +00:00
Ashod Nakashian
7e02316034 loolwsd: prevent the user from killing our window with ctrl+w
Change-Id: I77f004bc131ce5b469e76089efddd9e2e99ea526
Reviewed-on: https://gerrit.libreoffice.org/21331
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:10:42 +00:00
Ashod Nakashian
5130aa214d loolwsd: better locking in Document
Change-Id: Ia6cef55201f5505e703026a8461282b5fb79fd85
Reviewed-on: https://gerrit.libreoffice.org/21330
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:10:04 +00:00
Ashod Nakashian
96c7fdd0f8 loolwsd: onUnload takes Session ID
Change-Id: I63dd21441a11981f09f6b4c2d36560094fc81f1f
Reviewed-on: https://gerrit.libreoffice.org/21327
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:08:32 +00:00
Ashod Nakashian
9b5a94b018 loolwsd: callbacks use shared_ptr to avoid race with destructors
Change-Id: I19e06850764c6dbd1cfcc15dcd9a64029ab4fc0c
Reviewed-on: https://gerrit.libreoffice.org/21326
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:07:30 +00:00
Ashod Nakashian
910b34de58 loolwsd: destroy ChildProcessSessions
Change-Id: I58e9f58047162e842e155b70284fe55a45af35c9
Reviewed-on: https://gerrit.libreoffice.org/21324
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:06:02 +00:00
Ashod Nakashian
9523769e94 loolwsd: better callback handling and shutdown
Change-Id: Id9cc9f748d2dac3afb7d7d002062f8c423bce775
Reviewed-on: https://gerrit.libreoffice.org/21321
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:04:27 +00:00
Ashod Nakashian
b3d06869f5 loolwsd: centralized document loading in Document
Change-Id: I1ff7e0a53cc415958e46aea74c775d7f265b8b8e
Reviewed-on: https://gerrit.libreoffice.org/21319
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:03:38 +00:00
Ashod Nakashian
efb1fecbf1 loolwsd: control multiview api via env
Change-Id: Ic385188a4d57e10a260827709d4666857fd8aae5
Reviewed-on: https://gerrit.libreoffice.org/21317
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 04:02:05 +00:00
Ashod Nakashian
a66a12004d loolwsd: better handling of multiple connections
Change-Id: I3acd9810b63426ea4b811bf2f4f4341ba70e4ba0
Reviewed-on: https://gerrit.libreoffice.org/21316
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 03:57:58 +00:00
Ashod Nakashian
4b028e1506 loolwsd: localized lokit lock and other cleanups
Change-Id: I16453924d90ab22e57f8b6a3bbb937fef853ea2c
Reviewed-on: https://gerrit.libreoffice.org/21315
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-01-11 03:57:18 +00:00