Commit graph

38 commits

Author SHA1 Message Date
Ashod Nakashian
773c15f710 loolwsd: consistent formatting
With the help of clang-format.
For reference, the following command was used,
but not all changes were commited:

clang-format-3.9 -style='{BasedOnStyle: WebKit,
 AlignAfterOpenBracket: Align,
 AlwaysBreakAfterReturnType: None,
 BreakBeforeBraces: Allman,
 DerivePointerAlignment: 'true',
 ExperimentalAutoDetectBinPacking: 'true',
 IndentWrappedFunctionNames: 'true',
 UseTab: Never}'

Change-Id: I0f7490c7ee38aeefeefcf9d5d4c3dab380cd63b8
Reviewed-on: https://gerrit.libreoffice.org/30416
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-31 06:06:35 +00:00
Pranav Kant
1c9e4f57d5 loolwsd: Include UserId in 'viewinfo' response
Change-Id: Ia467086343ff2308f80d873dfe0a617733036a2e
2016-10-26 21:10:15 +05:30
Pranav Kant
cccf6dcb7d loolwsd: Store UserId in ChildSession
Change-Id: I46593442f7f8c61bddf00a624977c9d32bffdf44
2016-10-26 21:10:15 +05:30
Ashod Nakashian
5802d7e8a1 loolwsd: show disconnected usernames in the document repair
By retaining the view-ID to username mapping of disconnected
users we are able to show a disconnected username in the
document repair dialog.

Change-Id: Id08790de31f92653381b6a1525caf044bd875479
Reviewed-on: https://gerrit.libreoffice.org/30216
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-23 21:20:54 +00:00
Ashod Nakashian
b44d71f0ae loolwsd: no need to create prisoner WS anymore
Change-Id: Iaebac49f47353a6848fd2232a1838e4eaadaeefc
Reviewed-on: https://gerrit.libreoffice.org/29937
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-16 22:04:31 +00:00
Ashod Nakashian
128cd73154 loolwsd: send child messages to client via unified wsd-kit WS
Change-Id: I237120e5a81a2e6d8772a2b6f1e98b1ba567f97e
Reviewed-on: https://gerrit.libreoffice.org/29647
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-10 06:29:32 +00:00
Ashod Nakashian
c542fde244 loolwsd: factor out getViewIds and broadcasting
This minimizes unlocking and relocking
on the LOK Document.

Change-Id: Ibe5045c82008df907dc329c1530cb50138b0c211
Reviewed-on: https://gerrit.libreoffice.org/29545
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-10-06 05:54:54 +00:00
Miklos Vajna
38577b74fd Refactor to be able to unit-test Document::ViewCallback()
Change-Id: If07eb89e5d2f45737a8af10803511ab2ee3a07b3
2016-09-30 15:42:50 +02:00
Miklos Vajna
3090981c8a Document repair: expose user names, not only view IDs
Also in leaflet replace the current user with "You" to be consistent
with the statusbar.

Change-Id: If2d76f078eeae3038f8ae17506ae7679f7b23023
2016-09-30 14:21:14 +02:00
Tor Lillqvist
075c487001 Fix comment. There can be several ChildSessions in a kit process 2016-09-29 00:23:09 +03:00
Pranav Kant
46107dd0c8 loolwsd: Always send the updated view info to clients
This replaces addview/remview/remallview messages in the protocol
with 'viewinfo' message which is sent whenever there is any
change in the view information.

Let the client deal with what information is redundant to it.

Change-Id: Ic470ea88a94ff281a0ae021014a9fba1b876f648
2016-09-21 12:02:27 +05:30
Tor Lillqvist
df3cc99025 Don't require the LOK_VIEW_CALLLBACK env var any more
Act as if it was always set.

The ChildSession::_multiView field will always be true, so factor it
out. Ditto for Document::_multiView.

The ClientSession::_haveEditLock will also be always true, so factor
it out. This means the ClientSession::isEditLocked() will always
return true, so factor it out, too.

ClientSession::markEditLock() always will always set _haveEditLock to
true (which it will be from the constructor already anyway) so it can
be removed.

ClientSession::setEditLock() does not need a parameter as the
parameter was actually only used for misleading logging. The msg
variable constructed in the function used isEditLocked(), not the
parameter.

We still generate and handle editlock messages. Not sure whether that
makes any sense, though.
2016-09-19 12:13:00 +03:00
Henry Castro
7243e485d0 loolwsd: assign view id after loading
When session, it is not assigned, ViewCallback thread
will not enqueue the message
2016-09-17 18:13:05 -04:00
Tor Lillqvist
941f400e71 Minor comment fix 2016-09-16 12:03:57 +03:00
Tor Lillqvist
4799bcc73e Clarify comments about the meaning of the three LOOLSession subclasses
Be careful in using the definite article for classes that are
instantiated as singletons in a process, and otherwise an indefinite
article. Also mention in which process objects of the type in question
exist.
2016-09-16 11:24:35 +03:00
Pranav Kant
76884fc020 loolwsd: Remove unused method
Change-Id: I9fcd2610c9cd27a32a9a835801ef627a631a85da
Reviewed-on: https://gerrit.libreoffice.org/28485
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2016-08-30 07:46:18 +00:00
Pranav Kant
7d48cd6f17 loolwsd: Echo back view information to clients
View information as of now includes viewid and username
associated with the view.

Change-Id: If0c4957eb56962eb4b1b1d0c1189dc300fa6b857
Reviewed-on: https://gerrit.libreoffice.org/28482
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2016-08-30 07:45:47 +00:00
Pranav Kant
67444eeb80 loolwsd: Pass sessions' usernames to core
Change-Id: I8c81c02fafd2cb9d0048729401e082bb422e299b
Reviewed-on: https://gerrit.libreoffice.org/28481
Reviewed-by: pranavk <pranavk@collabora.co.uk>
Tested-by: pranavk <pranavk@collabora.co.uk>
2016-08-30 07:45:37 +00:00
Pranav Kant
f6217133f4 loolwsd: view ids - unsigned -> int
Change-Id: I4bc2aa109143dd4cfd88a49c1988b66ae134d647
2016-08-29 17:57:23 +05:30
Pranav Kant
178808f989 loolwsd: Notify other views when new view is added
... but no need to notify the one which is just added.

Earlier behavior was notifying only the one which is just added,
which is redundant as same is accomplished by 'status' message.

Change-Id: Ib09424d186c49527b7b9c36fdabf90c31518ee04
Reviewed-on: https://gerrit.libreoffice.org/28395
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-25 18:26:31 +00:00
Ashod Nakashian
0d395f18b5 loolwsd: cleanup of ChildSession
Change-Id: I63bd6ff24a54b0ba3e0361ea385bf866f98faf76
Reviewed-on: https://gerrit.libreoffice.org/28306
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-22 05:49:45 +00:00
Ashod Nakashian
a28b832309 loolwsd: proper ChildSession cleanup
ChildSession cleanup is tricky because it needs
to be cleaned up when the connection is dropped.
The ChildSession itself needs to initiate this
cleanup from Document.

A new approach simplifies the design and correctly
broadcasts remview to all other connections so
they would be able to cleanup visual elements.

Change-Id: I78fd01fb42b801913534c858324c16dd7ad6451d
Reviewed-on: https://gerrit.libreoffice.org/28302
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-22 05:44:24 +00:00
Ashod Nakashian
59b88dab49 loolwsd: don't expose ChildSession mutex publicly
The only usecases for using the ChildSession mutex
are during tile rendering in Document. For these
the lok::Document mutex is perfectly fine.

Change-Id: I888e51d7885b05081858bcd55212abe45925e732
Reviewed-on: https://gerrit.libreoffice.org/28295
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-22 05:04:53 +00:00
Ashod Nakashian
006a49007c loolwsd: sync re-activating views by replaying state messages
Change-Id: I0ce37ca75f10493a90107e93c253edf084a15f7f
Reviewed-on: https://gerrit.libreoffice.org/28284
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-22 04:13:54 +00:00
Ashod Nakashian
daad00812d loolwsd: refresh views on UI re-activation
Change-Id: I78d04abe939a91e56cb06f89184e651e7946b28b
Reviewed-on: https://gerrit.libreoffice.org/28134
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:19:15 +00:00
Ashod Nakashian
5af1f18e36 loolwsd: convert function-object callbacks to abstract interface
Change-Id: Ia2e832659f8deddd55b8be6507c2d7406f110085
Reviewed-on: https://gerrit.libreoffice.org/28133
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:18:26 +00:00
Ashod Nakashian
08909b2a3d loolwsd: doxygen comments added to all classes
Change-Id: Ia485c2dcec20a6840d46836a61f75a8e7e8762ed
Reviewed-on: https://gerrit.libreoffice.org/28128
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:12:31 +00:00
Ashod Nakashian
e3507552b7 loolwsd: one thread and queue per document
Each ChildSession had its own thread and queue,
which was an overkill. By moving the LOK callback
handler into Document and handling all events in the
same order that we receive them we reduce resource
consumption without affecting performance.

In fact, performance could improve by avoiding
unnecessary overheads.

Change-Id: Ic2bac0f08c28e91acabd512a704966c6b761fc7c
Reviewed-on: https://gerrit.libreoffice.org/28124
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:09:57 +00:00
Ashod Nakashian
58468c76be loolwsd: cleaned up ChildSession public members
Change-Id: I4bfc008859edb979688ece89d99af227ea3d0416
Reviewed-on: https://gerrit.libreoffice.org/28123
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:07:44 +00:00
Ashod Nakashian
ae5f47234c loolwsd: per-session callbacks
Callbacks from Core are now per-session and not
shared among all. A new descriptor is used to
help get from the callback to the respective
session.

Change-Id: Ie72771da05eef4760cf01351f7c06c034abf5109
Reviewed-on: https://gerrit.libreoffice.org/28122
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:06:59 +00:00
Ashod Nakashian
10737fdeab loolwsd: payload as std::string
Change-Id: Icee8a16fd18489da87e22955f3126851261332e5
Reviewed-on: https://gerrit.libreoffice.org/28120
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-08-15 03:05:53 +00:00
Ashod Nakashian
6536ba2fe2 loolwsd: correct multiview creation
Change-Id: Id6675f6410793b743aec53182a4b5756b7cffa23
Reviewed-on: https://gerrit.libreoffice.org/27272
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-07-18 02:49:45 +00:00
Ashod Nakashian
74304fc08e loolwsd: ChildSession error propegation and cleanup
Change-Id: I8e5c87b6989fd090c98ca35e2584a7dd6d1c6a60
Reviewed-on: https://gerrit.libreoffice.org/25267
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-21 16:34:54 +00:00
Ashod Nakashian
c6454ff9ed loolwsd: protect against null lok::Document
Change-Id: Iffa9c7f708d04bede5d98ba311e499a0874605fc
Reviewed-on: https://gerrit.libreoffice.org/25237
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-21 03:22:34 +00:00
Ashod Nakashian
5a8b3c8169 loolwsd: LibreOfficeKitDocument* -> shared_ptr<lok::Document>
Change-Id: Ie94882482729e4d6bb69c9f92badd375231fece2
Reviewed-on: https://gerrit.libreoffice.org/25094
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-18 11:31:10 +00:00
Ashod Nakashian
a21bcc2341 loolwsd: LibreOfficeKitDocument* -> shared_ptr<lok::Document>
Change-Id: Iafc48317c225f93b7d58708dd26f04d6bb13988e
Reviewed-on: https://gerrit.libreoffice.org/25092
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-18 11:29:05 +00:00
Ashod Nakashian
b41f0a6ea3 loolwsd: ChildProcessSession -> ChildSession
Change-Id: I24f001cb4d17d1ddc5cbd4f48134ec4eb8777afb
Reviewed-on: https://gerrit.libreoffice.org/25062
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-17 13:56:45 +00:00
Ashod Nakashian
7ce6e67731 loolwsd: ChildProcessSession.{cpp,hpp} -> ChildSession.{cpp,hpp}
Change-Id: Ic0c7f0992c9024d8fb8478b41205394372094af8
Reviewed-on: https://gerrit.libreoffice.org/25061
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Tested-by: Ashod Nakashian <ashnakash@gmail.com>
2016-05-17 13:56:21 +00:00
Renamed from loolwsd/ChildProcessSession.hpp (Browse further)