Embedding/IPCLiteAPI: Difference between revisions

Line 9: Line 9:


== New embedding expected initialization sequence ==
== New embedding expected initialization sequence ==
  1. Native UI startup (android UI thread view or Gtk/Qt event loop)
  1. Native UI startup (android UI thread view or Gtk/Qt/UIKit event loop)
  2. Create XRE_InitIPCEmbedding
  2. Load EmbedLite library and start point API (can be called in parallel thread)
  3. Chromium message loop started
    LoadEmbedLite(argc, argv);
  a) Child process created and IPDL channel established
 
  4. Create embed view using embedding API
  3. Get EmbedLite application object, which allow to start Gecko in Child-Thread/Process, and create rendering views
  a) TabParent/Child, DOMWindow initialization
    EmbedLiteApp* embedapp = XRE_GetEmbedLite();
  b) PLayers protocol created
  4. Setup EmbedLite application listener (Some notifications about main app lifecycle)
  6. Render data from UI process LayerManager (SW/HW rendering) to Native UI GC.
    EmbedLiteAppListener[Derived]* listener = new EmbedLiteAppListener[Derived]();
  7. Load content in remote view (HTML, XUL)
    embedapp->SetListener(listener);
  5. Startup Embedding, blocking call, better to start UI first, and call this in some main loop event
    EmbedLite will not freeze application here, and continue native events processing along with Chromium Messages.
    embedapp->Start(EmbedLiteApp::EMBED_THREAD/PROCESS);
 
  [https://github.com/romaxa/mozilla-central/blob/embedlite/embedding/embedlite/tests/embedLiteCoreInitTest.cpp Core Embed Initialization example]
 
  6. After EmbedLiteAppListener[Derived] received "Initialized" notification, new EmbedLiteView can be created with:
    EmbedLiteView* view = embedapp->CreateView();
    And setup related EmbedLiteViewListener in order to receive notifications from View actions (title,progress,invalidate et.c.)
    view->SetListener(MyEmbedLiteViewListener);
  [https://github.com/romaxa/mozilla-central/blob/embedlite/embedding/embedlite/tests/embedLiteViewInitTest.cpp View Embed Initialization example]
 


=== Communication between UI and content process ===
=== Communication between UI and content process ===
  * Load remote content JS (privileged script with full access) and interact using MessageMessenger (send/receive JSON messages)
  * Load remote content JS (privileged script with full access) and interact using MessageMessenger (send/receive JSON messages)
  * Use embed messaging API (observe broadcast 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.
  * Build Custom Gecko C++/JS extensions


== [http://hg.mozilla.org/users/romaxa_gmail.com/embedipc_queue Source code path queue] ==
== [http://hg.mozilla.org/users/romaxa_gmail.com/embedipc_queue Source code path queue] ==
Confirmed users
180

edits