Hi everyone, my name is Balazs Vargo and I'm working at Allotropia GMBH and this presentation
I would like to talk about WebAssembly, M-scripten technology running the colabora online in
WebAssembly and headless conversion stuff in WebAssembly as well.
So let's get started with the colabora online in WebAssembly stuff.
So it was a common project with the colabora, we were together with Tor and Mihail Stahl.
The goal was to approach offline document editing.
On this slide there is a sketch design for this.
The goal was that when the connection is breaks and in a browser the application is activated
and that contains the colabora online server functionality and when the connection is restored
the document will be edited in the colabora online server again.
I think Tor will talk about it a bit more.
But to make it work first we had to build it in WebAssembly.
For that we are using the M-scripten compiler toolchain.
So let's talk about that.
The M-scripten is a complete open source compiler toolchain to WebAssembly.
Using M-scripten you can compile C and C++ code or any other languages that uses LLVM
into WebAssembly and you can run it on the web or Node.js or any other runtimes.
The M-scripten generates small and fast code and the default output format is a WebAssembly
and highly optimisable executable format that runs almost as fast as the native code.
A little bit about the M-scripten toolchain.
The main tool is the M-scripten compiler frontend.
This is a drop-in replacement for a standard compiler like QCC or CLANG.
The EMCC uses KLANG and LLVM to compile to WebAssembly.
EMCC also emits JavaScript that provides API support to the compiled code and the JavaScript
can be executed by Node.js or from within HTML in a browser.
There are more information there but you can read that about porting code to use M-scripten.
Support for portable C and C++ code is fairly comprehensive and supported for the C standard
library, the C++ standard library and the exception and etc.
It's a very good and also the OpenGL supports.
The multistrading is supported but depends on the shad array buffer which is still being
standardized and implemented by browsers.
Now let's see the porting how it worked in the case of Kolobora online.
The building for Wasm with M-scripten is a bit immature and some projects needed patching
to make it work.
First, we need to build a LibreOffice core with M-scripten earlier.
The best was to use the feature branch but now it's working with the upstream.
Master without the Qt5 framework and then it needed to build the Kolobora online.
This is the ZSTD libraries, the Poco library, it's required to patches to make it work.
And then it's necessary to build the Kolobora online code and then linking or the binaries
and executables together.
Everything was executable, uses a lot of memory, without optimizations or with O1 flags.
It should work anywhere but there are different kind of flags like the O2, LDF flags which
is the default and some link time optimization happens that uses very much RAM and because
of that it causes segmentation error, so we are using the O1 flag in case of online and
also in case of the LibreOffice core.
A little bit about running but we'll talk about it more, its structure is quite similar
to the Kolobora office iOS and Android applications, there are one difference is that in case of
mobile app the C++ code is what transfers and then loads the HTML page into WebKit in
which the JavaScript trans in the WebAssembly application, the other way around the WebPages
naturally the one that is loaded and then the JavaScript code then starts running the
C++ code as a WebAssembly.
You can see an image about it, it's a documentile in the browser, it's running in WebAssembly,
there are some depth tools where you can debug, it's working but still needs some optimization
work which is in progress, if we have an image in the document it's quite slow but we are
working on that as well.
Let's talk about a little bit some another WebAssembly work at Allotropia, we have also
worked on a headless conversion, the last time in LibreCom with a little demo about
it but it wasn't completely a headless conversion but now I make a video about it and let's
see how it works now, we are not using the Qt5 framework anymore and we are also using
a unique HTML which is created in the LibreOffice core by M-Scripten, so let's hope the video
works, it's working, so this is the very basic HTML page but it can make it any kind of
HTML, there is just a button, you can select multiple files and using the convert to arguments
convert to the document and you can convert it any kind of format so that the LibreOffice
core can do and then you can document it, download it and you can see it in the browser
as well and there is a common line in the browser where you can see the results but the
HTML page can be edited and that's a future plan to make it much more nicer.
Also some future plans at Allotropia we would like to calling Unia API function cause from
JavaScript and scripting for that also UI, M-Scripten provides various options for connecting
normal JavaScript and CompileCode which range from functions to call CompileC++ from JavaScript
and V-Aversa so to access environment variables from CompileCode, these options are the Web
Ideal Binder and M-Bind, it's creating binding between C++ and JavaScript and also C++ code
entities to be used in a measure manner from JavaScript.
This was our future plan, I think that's all, thank you for your attention and thank you
for that.
We'll see you in the next one, bye for now.