If we have all default values of imgSize, wid, old-wid then we
should simply not serialize these out to save space and improve
readability.
Unfortunately, this means that we need to catch the mutation of
the TileCombined's content in two places; now just one. Building
the queue of rendered tiles to send back is now moved and
wrapped into a TileCombinedBuilder class - this also lets us
stop serialize taking a random vectors of TileDescs. However
the DocumentBroker::handleTileCombinedRequest method needs to
set the force-keyframe oldWid=0 flag on individual tiles and
then update the TileCombined.
Ideally we would have a nice visitor API and drop the non-const
getTiles() method that returns a reference to our internal vector.
Update tests, to not have redundant attributes, and add more tests
to ensure redundant attributes are removed.
Change-Id: Id76d3ae14d459d73bbae8112d840dea27f66588b
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
So it behaves similar to other hello/hello-world documents.
Signed-off-by: Aron Budea <aron.budea@collabora.com>
Change-Id: I529b5bec81c1bf5085300f8c52311db023c6b09a
- add new LOK callback for vertical & horizontal ruler update
Signed-off-by: Darshan-upadhyay1110 <darshan.upadhyay@collabora.com>
Change-Id: I3c0e26f22072de4612e128d58ac41b629be82807
Add vertical ruler and implement margin calculation
- Added new vertical ruler file to separate it from horizontal ruler calculation
- For vertical ruler we do not need tab stops so removed it.
- next stpe will be to implement add top and bottom margin by drag
Signed-off-by: Darshan-upadhyay1110 <darshan.upadhyay@collabora.com>
Change-Id: I8186c874ff59571db7a75ec4c31f81fc655ef301
This stops a huge amount of parsing, re-parsing and conversion
from strings and back, making our few N^2 loops over the tiles
much more efficient.
Retain queue tests with the same strings via using a helper
to convert back to something expected.
Replace TileDesc::getId() with isPreview().
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: If40fc45f1fb474d37371e4b949da5fdfc594fdc8
Leave them as strings for now; this should be a pure re-factor.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ibad2bc343afe3fe32ea729623f6b03575c7b0121
Enable Caolan's unit test, pass the proper 'disconnect' message
to the Kit so it can close the underlying window / resource for
the view.
Potentially this also removes 'phantom' users in the user-list
which might be another symptom of this issue.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ib0d0c5cefa7033fff5827d0a825a932cc12f8323
If we had a tilecombine processed in the same queue and before
a save - the 'render tiles at the end' state would be inherited by
the background save process and result in excess work, and also
binary messages where only text messages are expected returning.
The rest of the queue is cleared post fork.
Add unit test - plus hook to hold queue processing.
Change-Id: Iee937897000bc3ac149599844f1eab005affb131
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Now we always send callbacks as soon as possible back to wsd from the
kit. This has several implications:
1. even when InputProcessing is disabled we will send outbound
progress updates.
2. we should send callbacks much more quickly without waiting for
other queue events to be processed eg. tilecombine:
We also drastically simplify storage of callbacks, avoiding lots of
re-parsing of the same strings, and allow much more efficient
comparison and merging at a small space cost in queue size.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ia1ede5406767f895616a52775316ee6ab1c5db09
This is not common code, it's used only in the Kit.
Rename TileQueue -> KitQueue as well as unhelpful member variable naming.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: If158597f99f302cbc27e8eab139972f57a2fc3bb
The MessageQueue is not a generic message queue, it has much more
un-anticipated functionality; so don't use it where we don't need to.
In particular unexpected re-writing and merging of messages
during tests is probably not a great idea.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I657738307e611be18f5f83e11c055bf8a88826da
Force background saving in the config for this test.
Use stamp files to force sequencing between Unit test and Kit.
Change-Id: Ia2c60c3dcfdad87c9c9754e8f20a3c36dbcf74d5
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
We need to get more helpful structure into this message, and add a
type=bg flag to handle background progress messages.
Add unit test for merging progress: setvalue commands.
Simplify ProtocolHandler sendTextMessage with a std::string wrapper.
Android code needs manual testing.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I54ce807e2fc5de80118905e68557a95e637fbd18
a normal case, where user#2 joins the document successfully and then
their connection closes; where the remaining client gets the
notification that there is only one client in the session.
an abnormal case, failing test currently disabled, where user#2 joins
the document, "load url" is launched, but the connection is immediately
dropped; the other client gets a notification that a user has joined to
make it a 2 user session, but no notification that the user has dropped.
Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Change-Id: I8271fb3d4def917acdff0fae6a3a52b5d02ef7af
Otherwise forkit tends to loop aggressively re-starting that for the
duration of the test wastefully.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Ia1c684a5d995f54f29290c9631b1ee14266445d7
Simple example to re-instate previous unit test.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I26da1178bc897797a656eb5ae9f838d17cbaf75f
This added 200+ lines of code, made things harder to
understand, and was used only in a single test that can be
covered in another way.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I4ed8d1d52d533f8b24be7dd5e12dbb7702ef1a80
Some tests are designed to exercise the reconnection
logic. Once the test validates that the correct
reconnection logic is used, the test is considered
finished. In those cases, we need to break the
test framework's retry logic.
Change-Id: Ie0bb5dcc430a954910c2af4817a500f5b576bd4c
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Presumably originally introduced to protect the static FileDeleter,
which has internal protection of its own now; cf. commit
1ae9ce8ad2
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: Id3266d7f08a9f7bd620df49850242a250fc73903
When the last connection is closed, we flag the
document for unloading, until we save and
unload and have nothing further to do. However,
if during that time a new client joins the
document, we reset the unloading state and
recover.
A previously failing and disabled test is now
re-enabled and passes.
Change-Id: I425a9286ec5df56064132e5e4227227761c65830
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Initial background save implementation from the Kit perspective.
To do a background save we:
1. join known threads - we can't fork with >1 thread.
2. check all is well: one thread, nothing unusual...
3. create a socketpair to communicate with the child
4. fork
5. child: cleanup duplicated sockets
6. child: setup LOK to not damage our shared file-system
7. child: save
8. child: report status back to parent & _Exit
There is still a substantial TODO, but this can be built on.
Change-Id: Ibf2c492372e2b5133932773e230ad05e18521794
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Since we have a more accurate reason
for failing to load, that's what we
should always return.
Change-Id: If9d38cf6de6d41310ba94857efcd073e3f4ef8b7
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Visit the
/cool/clipboard?WOPISrc=...&MimeType=text/html,text/plain;charset=utf-8
endpoint, you get a JSON with HTML and plain text. Visit
/cool/clipboard?WOPISrc=...&MimeType=text/html, you get HTML with a
custom header that is only possibly to skip easily because HTML itself
has as well-known header.
This is decied in ChildSession::getClipboard(), which has 3 cases: 1)
single specific format 2) multiple specific formats and 3) all formats.
So far only 2) used JSON, but the new async clipboard copy will want to
(als) request just plain text, where skipping our own custom header is
hard, given that the text itself has no well-known header (unlike HTML).
Solve the problem by always using JSON when a specific format is
requested, so both the HTML and HTML+plaintext case gives JSON.
The client side of this is the recently introduced Clipboard.js
parseClipboard(), which can cope with JSON already.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I8298f3f82d2a3871777c369f5aee6bb81d66a553
In-line and specialize helper used just once.
Simplify code-flow, and reduce duplication.
Reduce duplicate logging.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I1ed68fdff5edfb10466d8bd13e88e5d2a5a71a63
With faster starting spare kits we can end up waiting for a state
where there are no live or spare kits, but the spare kit has already
beaten us to the punch:
[testCrashKit] (+1124ms): Killing coolkit instances.| httpcrashtest.cpp:151
[killPid] (+1124ms): Killing 1650047| httpcrashtest.cpp:257
[killPid] (+1124ms): Killing 1650071| httpcrashtest.cpp:257
[waitForKitProcessCount] (+1124ms): Waiting for kit process count: Doc Kits: 0 Spare Kits: 0 | KitPidHelpers.cpp:70
[waitForKitProcessCount] (+1124ms): Current kit processes: Doc Kits: [1650047, ] Spare Kits: [1650071, ]| KitPidHelpers.cpp:80
...
Forking a coolkit process with jailId: 09X67pOy1HAgSk9G as spare coolkit #5.| kit/ForKit.cpp:406
...
[waitForKitProcessCount] (+1558ms): Current kit processes: Doc Kits: [] Spare Kits: [1650083, ]| KitPidHelpers.cpp:94
... fail ...
Avoid this by intersecting before & after to ensure are all before are
dead.
Cleanup exposing the more problematic wait-for-zero-spare method.
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Change-Id: I6f0ba87139b58f9bf1770ebbc5cac95b5063679e
WebSocketSession is used exclusively for tests,
so it's best that it is located in the test
directory.
Change-Id: I88333d619902df7991c3f26b94ed309246446ae0
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
In case the selection is complex (not simple), we used to just request
HTML, and then the browser converted that to plain text, which has the
downsides already mentioned in commit
7f9de46688 (cool#8465 clipboard: improve
handling of plain text copy, simple case, 2024-03-08).
Steps to support this:
1) Clipboard.js now asks for the text/html,text/plain;charset=utf-8 MIME
types.
2) wsd: ClientRequestDispatcher::handleClipboardRequest() now maps this
to DocumentBroker::CLIP_REQUEST_GET_HTML_PLAIN_ONLY
3) ClientSession::handleClipboardRequest() maps this to the HTML+plain
text MIME type list.
4) kit: ChildSession::getClipboard() is now improved to take a list of
MIME types, not just 1 or everything.
5) kit: ChildSession::getClipboard() now emits JSON in case not all, but
multiple MIME types are requested.
6) wsd: ClientSession::postProcessCopyPayload() now knows how to
postprocess clipboardcontent messages, which may or may not be JSON
(it's JSON if more formats are requested explicitly, leaving the 1
format or all format cases unchanged)
7) Control.DownloadProgress.js now handles the case when we get JSON and
sets the core-provided plain text next to the HTML.
Leave the handling of non-JSON case in, because this means we can
copy from an old COOL server to a new one.
Note that this approach has the benefit that once the clipboard marker
is inserted, the length of the text/html format would change, which
means we can't parse the clipboard data till the marker is removed.
Emitting JSON for html+text means adding the marker keeps the ability to
parse the HTML and the plain text part of the clipboard in JS.
Signed-off-by: Miklos Vajna <vmiklos@collabora.com>
Change-Id: I67a1f669e8a638d34cc25a2f288a7b30884b9892
Removed all MOBILEAPP preprocessor conditionals from Util.hpp/.cpp
Added isMobileApp function to help remove further conditionals.
Signed-off-by: Jaume Pujantell <jaume.pujantell@collabora.com>
Change-Id: I038a4db47ec2a2c7bb10f5696df5571b13bd9a61
4 seconds proves too short in some cases
and times out occassionally. 10 seconds
seems more reasonable.
Change-Id: Icede882355a66bf383ebdd87858f1ded77825c5f
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Also encapsulate png types more in Png.hpp
Change-Id: Ia0789405149cb00723f0da96d56eac7a30c2ef3f
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
Wait for doc kits or spare kit counts specifically. This removes the chance of
race conditions between waiting for doc kits to shutdown and the spare kit to
start back up.
Signed-off-by: Neil Guertin <neil.guertin@collabora.com>
Change-Id: If28da4b786d3e2b429acb5840dfcdb7bb5a3f948
StateRecorder.hpp split from ChildSession.cpp
KitWebSocketHandler.[ch]pp split from Kit.cpp.
ThreadPool.hpp split from RenderTiles.hpp
Expose headers for KitSocketPoll and Document
at the same time.
Not clear we need the DocumentManagerInterface anymore.
Conditionally compile out Document::createSession for unittest
dependency breaking, and avoid Rlimit::handleSetrlimitCommand
likewise.
Make makePropertyValue a private method of Kit.cpp.
clang-format new files.
Change-Id: I47a1d6afe20165f156b477a931b94c916cff4b9d
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>