Commit graph

6885 commits

Author SHA1 Message Date
Tamás Zolnai
b623aca57e Use a bigger timeout for waiting tileprocessed message
The main purpose of this time-out is to avoid waiting forever for lost
tile messages, but since it rare to loose them we can use bigger value,
so we can avoid to send new tiles to a slow network.

Note that the used time stamp does not mean the time when the tile
actually send to the client, but the time when it gets to the sender
queue.

Change-Id: I230d85c38b3a5dafd195851d0cf4caac23149e3e
2018-09-21 16:04:53 +02:00
Tamás Zolnai
0807d04934 Convert this warning to info
There valid cases when we get unknown tileID. For example we
sent some tiles, but in the meantime canceltiles arrives which
resets tiles-on-fly list, but the client still send tileprocessed
messages for earlier requested tiles.

Change-Id: If2ec015106a0e58d66ae4517b64a9552eb8c38fc
2018-09-21 16:01:44 +02:00
Tamás Zolnai
4b13430f6d Fix warning: in case of a text document part number has no meaning
In this case the part number is undefined, somewhere it is set to 0 or 1,
but has no meaning at all. Just avoid using it with text ducments.

Change-Id: Ic98217bf3ea6c86d37c34e42302bf456f7274975
2018-09-21 16:01:44 +02:00
Aron Budea
132fc22f2b Revert "loleaflet: mobile: disable scroll bars"
This reverts commit 4d5fa8f833.

Change-Id: I2938818bff98dec862ef3137aca4766dc9d1af20
Reviewed-on: https://gerrit.libreoffice.org/60872
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Tested-by: Aron Budea <aron.budea@collabora.com>
2018-09-21 14:27:02 +02:00
Aron Budea
14c6562455 Revert "loleaflet: mobile: fix row/column headers"
This reverts commit c7a62fb304.

Change-Id: Ib565080314564255c39874c38066734911348432
Reviewed-on: https://gerrit.libreoffice.org/60871
Reviewed-by: Aron Budea <aron.budea@collabora.com>
Tested-by: Aron Budea <aron.budea@collabora.com>
2018-09-21 14:25:35 +02:00
Tor Lillqvist
79934ad4b2 Use the user-defined $(LOSRCDIR) variable for the paths to the core source files 2018-09-21 10:34:07 +03:00
Tor Lillqvist
72be8e3ad7 Add some source files from core to the project
For easier setting of breakpooints in them, in advance before stepping
into their code.
2018-09-21 10:29:56 +03:00
Tor Lillqvist
26323fb92b Struggle a bit back and forth with the UTIs etc in Info.plist
This stuff is a bit fragile, and the presence of other apps on the
device that claim to support "our" file types might, or might not,
affect how it works. Also, upgrading to iOS 12 seemed to have an
effect. Anyway, now it is back to working as I need.
2018-09-21 10:29:56 +03:00
Tor Lillqvist
f3786f5cb7 Pass correct argument on iOS as pBuffer to lok::Document::paintTile()
On iOS it shouldn't actually be pointer to a pixel char buffer, but a
craphics context reference. (This is how it has been since the
experimental TiledLibreOffice app, maybe five years ago? Sadly it
wasn't documented in the LibreOfficeKit include file. But it is how
LibreOfficeLight used the API, too.)

In TiledLibreOffice we rendered tiles directly into the CALayer of the
view. In this Online-based app we of course do render tiles into pixel
char buffers, just like in real Online, but we need to create bitmap
graphics contexts for them and pass that to paintTile().

Now I get white tiles, not totally zero-filled ones. But still no
document contents rendered.

I don't yet want to change the pBuffer parameter to actually be a
buffer pointer on iOS, too, like on other platforms. Also, changing it
will mean the LibreOfficeLight app would need changing, too, and I
don't feel like doing that. But ideally, sure, that should be done.
2018-09-21 10:29:56 +03:00
Tor Lillqvist
06051c833b Comment out log.dump() call again
Change-Id: I27ecd6712e72182f3a943e7be86ef5ba7b05f746
2018-09-20 13:38:53 +03:00
Andras Timar
18751d35fa nginx and apache2 config templates
Change-Id: I1e2572617909d7aefb951d3299810f521f56062c
2018-09-20 10:18:57 +02:00
Tor Lillqvist
f4ce5df7e1 Implement the timeout parameter to fakeSocketPoll()
Adapt callers that mistakenly passed 0 assuming it meant "forever".

This also seems to help with the occasional hangs.
2018-09-19 20:03:24 +03:00
Tor Lillqvist
5ee96e0271 Small correction to poll semantics 2018-09-19 20:03:24 +03:00
Tor Lillqvist
8b5246b038 Bin one presumably pointless lock and unlock 2018-09-19 20:03:24 +03:00
Tor Lillqvist
9c57ffd3b3 Avoid potential deadlock 2018-09-19 17:55:14 +03:00
Tor Lillqvist
95eb849217 Still more iOS app and related Online C++ code hacking
Re-think the plumbing between the different parts of the C++ Online
code. Do try to have it work more like in real Online on all but the
lowest socket level. Except that we don't have multiple processes, but
threads inside the same process. And instead of using actual system
sockets for WebSocket traffic between the threads, we use our own
FakeSocket things, with no WebSocket framing of messages.

Reduce the amount of #ifdef MOBILEAPP a bit also by compiling in the
UnitFoo things. Hardcode that so that no unit testing is ever
attempted, though. We don't try to dlopen any library.

Corresponding changes in the app Objective-C code. Plus fixes and
functionality improvements.

Now it gets so far that the JavaScript code thinks it has the document
tiles presented, and doesn't crash. But it hangs occasionally. And all
tiles show up blank.

Anyway, progress.

Change-Id: I769497c9a46ddb74984bc7af36d132b7b43895d4
2018-09-19 11:31:18 +03:00
Tor Lillqvist
384a57092c Make the "Online" source files actually show up in Xcode 2018-09-19 11:19:25 +03:00
Tor Lillqvist
a4f19ac229 Avoid double "0x" prefix for pointer values in log output
No need for explicit "0x" and std::hex when outputting a pointer. A
pointer will be output as a hex number anyway. We used to have things
like this in the log:

TRC  #25 Connected to WS Handler 0x0x3610b60| ./net/WebSocketHandler.hpp:80
2018-09-19 10:33:41 +03:00
Tor Lillqvist
7159fcb54d Add Base64ToArrayBuffer() JavaScript function
Used for use sending tiles from the iOS app code to the JavaScript.
2018-09-19 01:06:41 +03:00
Tor Lillqvist
a149320239 Fix accidental unconditional use of iOS-specific API
Change-Id: Ia82ba76ca7b52173540c7c78522ad36fb68e0995
2018-09-18 22:49:10 +03:00
Tor Lillqvist
7ea91e1c6b More hacking on the FakeWebSocket for the iOS app 2018-09-18 18:07:59 +03:00
Tor Lillqvist
e1978621f3 No need for WOPI stuff in iOS app 2018-09-18 18:07:59 +03:00
Tor Lillqvist
763a27280a Add possiblity to force logging to stderr with environment variable
At least LOOLWSD.cpp has a couple of global variables of types that in
their constructors invoke FakeSocket APIs. If we turn on FakeSocket
logging (fakeSocketSetLoggingCallback()) only in the app's
initialization code, we will miss logging from those global variable
constructors.

Sure, the clean solution would be to turn those global variables into
members in the LOOLWSD class instead, but this will do for now.
2018-09-18 15:31:01 +03:00
Tor Lillqvist
c09dfda052 In the logging always precede FakeSocket "fd" numbers with #
Makes it easier to search log files.

Also, Online uses this convention for socket fds in many places (not
sure if consistently).
2018-09-18 13:04:16 +03:00
Tor Lillqvist
435718e9f3 Improve shutdown semantics 2018-09-18 13:04:11 +03:00
Tor Lillqvist
53416a290d Add fakeSocketShutdown() and drop fakeSocketFeed()
Not sure whether the shutdown() implementation matches real shutdown()
semantics, especially with regards to the behaviour of poll(), read(),
and write() (on both the socket itself and the connectd one)
afterwards. But let's see.

The feed() API turned out to be not needed. (And in any case, it was
suposed to be completely equivalent to writing to the peer socket.)
2018-09-17 20:44:18 +03:00
Tor Lillqvist
64c9115a75 Remove stray #include <ftw.h>
Change-Id: I1838ae1c40a6ddc8357963c32f5ccf2040e7da10
2018-09-17 18:05:43 +03:00
Tor Lillqvist
7fd28d5676 Revert part of my iOS related commit, causes compilation warning with Clang
Won't actually be needed anyway, the way the code is going in my work
tree.

Change-Id: I4480ed59fe96ddcfad8483517f2a23452606f332
Reviewed-on: https://gerrit.libreoffice.org/60576
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
2018-09-17 12:51:07 +02:00
Tor Lillqvist
3bcde388ed FakeSocket poll fix and minor hacking
fakeSocketPoll() needs to return a correct return value.

Use notify_all() instead of notify_one(). Just to see if it makes any
difference.
2018-09-16 22:39:44 +03:00
Tor Lillqvist
8d42e09559 Introduce LOG_TRC_NOFILE() that doesn't output __FILE__ and __LINE__
For use in callback type situations where the location of the
LOG_TRC() call as such is uninteresting.
2018-09-16 13:43:08 +03:00
Tor Lillqvist
7399a86f6a Use optional logging callback in FakeSocket.cpp instead of hardcoded writes
It's easier to either call the function to set the logging callback,
or not, in one place in client code, than to comment in and out all
the logging lines in FakeSocket.cpp as needed.

Change-Id: Id17f7e461c7df817440b47cb3124fcece13b189b
2018-09-16 13:39:43 +03:00
Tor Lillqvist
30ec64566b Attempt to fix various FakeSocket problems
Also add a bit of internals documentation.
2018-09-16 10:42:01 +03:00
Tor Lillqvist
0a2868b8d4 More FakeSocket hacking
As we use #ifdefs at all call sites anyway (because we don't dare use
the generic overrides of close() etc), we can leave out the parameters
related to actual BSD sockets that we ignore anyway.

"Real" Online always uses non-blocking sockets. We don't need to take
flags for that or check it. We can hardcode such behaviour always.
(Assuing that is what we want; let's see once something works.)

Change-Id: I6863907d71c5599b00ce1f8305a44d41bbaf7bee
2018-09-15 12:35:23 +03:00
Tor Lillqvist
55a2f804a6 Change the FakeSocket to be record-oriented
That is how Online uses the sockets for communication between the
processes anyway: It send and receives complete WebSocket frames.
Sure, in the mobile case there is just one process, but (I think) we
want to keep the same basic structure anyway, even if "wsd" and "kit"
are just threads. (We probably also want to drop the WebSocket framing
of the messages.)

Change-Id: I2397f321029c1cbbbc448a9b2403ad185a51cf14
2018-09-15 12:34:29 +03:00
Tor Lillqvist
6d81ebcfeb Add FakeSocket
Intended as a replacement for the real sockets used for WebSocket IPC
in Online on Linux. The idea is that in a mobile app we don't want to
bother with any actual sockets or WebSocket protocol (because we are
running as a single process after all), but keep much of the code that
thinks it is using such mostly unmodified. Just an idea so far, let's
see how this turns out.

Change-Id: I7878b0db99d9cbf70650227186c1fec9677fa74b
2018-09-15 12:30:50 +03:00
Tor Lillqvist
83a7a6f744 s/StaticNames/StaticNameHelper
It is a container for one name (and used just once even), not several,
so no need for the plural.

Change-Id: I6d8b22f071d5136fb854e6f2c5a6be8b4572b535
2018-09-13 12:06:23 +03:00
Tor Lillqvist
4841ee4f47 Move SocketPoll::pollingThreadEntry() implementation to cpp file
Makes it easier to put a breakpoint in it in Xcode...

Not sure if we have any consistent convention around here anyway about
which member functions should be defined inline in the class
definition in the hpp file, and which ones should be in the cpp file.
2018-09-13 09:33:40 +03:00
Tamás Zolnai
5fdc049a79 Create a method which invalidates and requests all the tiles
Used after reconnection for example.

Change-Id: Ie9a15ec1fdec71ca8aba7d9b7417b05005c6c69a
2018-09-12 22:18:34 +02:00
Tor Lillqvist
87b85ff8f0 Be consistent in how we name "interface" abstract classes
We already use a suffix "Interface" for SocketHandlerInterface, so
rename IDocumentManager to DocumentManagerInterface.

Naming "interface" classes with an "I" prefix is C# and COM style.
Sure, that is a convention as good as any other, but let's try to be
consistent within this rather small code-base.

Change-Id: I9c356df327debd780f23ed2b2e6d6e630328861e
2018-09-12 19:27:23 +03:00
Tor Lillqvist
b59d160a08 Intermediate commit of work in progress on an iOS app
The app is unimaginatively called "Mobile" for now.

Runs but crashes pretty quickly after loading the document by the LO
core. Will need some heavy changes to get a ClientSession object
created in there, too, to handle the (emulated) WebSocket messages
from the JavaScript. It would then handle some of these messages
itself, and forwards some to the ChildSession, which in this case is
in the same process. Now the messsages from the JavaScript go to a
ChildSession, which is wrong. As the assertion says, "Tile traffic
should go through the DocumentBroker-LoKit WS"
2018-09-12 18:32:05 +03:00
Henry Castro
c7a62fb304 loleaflet: mobile: fix row/column headers
Change-Id: I126ec8108b8d043477b96616f048bf12a2ce3b0f
2018-09-12 07:35:37 -04:00
Henry Castro
b29f75f49f loleaflet: delegate clip container to show the cursor
Change-Id: I80d556d9e29cfa2ced0afcf985d41862ecd98ba5
2018-09-12 07:15:15 -04:00
Tor Lillqvist
290137c99b Bin unnecessary assert(loKit)
We already explicitly check earlier, after attempting to create it,
and log a fatal error and exit on failure.

Change-Id: Ia3fde4026839a255d4d19932300e16a05f9a33d2
2018-09-12 13:36:00 +03:00
Tor Lillqvist
b636098cae Some minor iOS (or mobile in general) app tweaks 2018-09-12 13:34:27 +03:00
Tamás Zolnai
53cb932bbb loleaflet: Need to call _update after invalidatetiles-all
Earlier invalidatiles was requested the new tiles too, but now
invalidatetiles + _update makes to request all the visible tiles.

Change-Id: Ib3a07f748d270056d5f30cdb1731b6cf4e63c3ef
2018-09-12 11:23:22 +02:00
Tor Lillqvist
d5f913486a Add a clarifying comment
Change-Id: Ia32b3ad65dd410e0f9f9d18c11be2d566ca0d6e0
2018-09-11 13:01:37 +03:00
Tor Lillqvist
5f779e0295 Revert "Just define these static const int members in-class"
Can't say I understand why, but this turned out to not be a good idea
after all. And no, using constexpr did not work either, so I won't
waste any more time on this triviality, but just revert.

This reverts commit 195b88ac8d.

Change-Id: I49f737dc6a36fa4808841cb8e0335246ad8c6d03
2018-09-11 11:39:56 +03:00
Tor Lillqvist
3110bea2ea Add two missing values to kitCallbackTypeToString() 2018-09-10 19:55:29 +03:00
Tor Lillqvist
195b88ac8d Just define these static const int members in-class 2018-09-10 16:10:53 +03:00
Tor Lillqvist
75438baa70 More mobile app stuff, very much early state of work in progress
Re-think Linux vs mobile ifdefs a bit. Use #ifdef __linux only to
surround code that actually is Linux-specific. Use #ifdef MOBILEAPP
for code that is for a mobile version (with no separste wsd, forkit,
and kit processes, and with no WebSocket protocol used).

Bypass UnitFoo for mobile. Possibly we do want the UnitFoo stuff after
all on mobile, to run in some special testing mode? Hard to say, let's
skipt it for now.
2018-09-10 15:13:43 +03:00