Embedding/IPCLiteAPI

From MozillaWiki
< Embedding
Revision as of 20:03, 30 January 2012 by Romaxa (talk | contribs)
Jump to navigation Jump to search

Lite-weight Embedding IPC API for Mozilla based applications with native UI.

Basic architecture is very close to WebKit2, and MicroB

Benefits of new architecture comparing to default mozilla embedding:

* No XUL/XPCOM heavy content in UI process (Best memory footprint, fast startup)
* IPC use current Mozilla Chromium/IPDL implementation (mostly tested with current FF/Mobile)
* Rendering based on Shadow/Shadowable layers tree (same as content rendering in XUL Mobile FF)
* IPC provide ability to load memory greedy content in child process and kill it without increasing memory usage for Main UI application process

New embedding expected initialization sequence

1. Native UI startup (android UI thread view or Gtk/Qt event loop)
2. Create XRE_InitIPCEmbedding
3. Chromium message loop started
  a) Child process created and IPDL channel established
4. Create embed view using embedding API
  a) TabParent/Child, DOMWindow initialization
  b) PLayers protocol created
6. Render data from UI process LayerManager (SW/HW rendering) to Native UI GC.
7. Load content in remote view (HTML, XUL)

Communication between UI and content process

* Load remote content JS (privileged script with full access) and interact using MessageMessenger (send/receive JSON messages)
* Use embed messaging API (observe broadcast messages)
* Build Application specific IPC serialization library, load XPCOM component in child process linked with this IPC library.

Source code path queue

BMO Bug 713681

Build instructions:

hg clone http://hg.mozilla.org/users/romaxa_gmail.com/mozilla_ipcembed
cd mozilla_ipcembed
cd .hg
hg clone http://hg.mozilla.org/users/romaxa_gmail.com/embedipc_queue patches
cd ..
hg update -C embedipc
hg qpush -a
cp .hg/patches/mozconfig.gtkdesktop  mozconfig
# or
# cp .hg/patches/mozconfig.qtdesktop mozconfig
MOZCONFIG=$(pwd)/mozconfig make -f client.mk build_all

Run test examples:

cd obj-build/dist/bin
./testCoreEmbedXul
or GRE_HOME=xul-distpath ./testCoreEmbedXul
 this works for GTK and Qt port.

Qt only, qml based UI with scrolling and zooming (no clicks):
./qtMozQmlEmbed -url slashdot.org

Basic view of new architecture:

EmbedIPC-basic.png