This is an overview of the JxBrowser architecture.

Overview

The architecture of the JxBrowser library consists of the multiple processes such as Java application process and different Chromium processes: JxBrowser Architecture The following sections provide details for each of the processes, the main components of the library, and describe how it all works.

Processes

Java Process

This is a standard Java process where your Java application runs.

Chromium Main Process

The main process of the Chromium engine. This process is started by JxBrowser when you create an Engine instance.

For each Engine instance a separate Chromium Main process is used.

Chromium Renderer Process

In this process the Frame instances which manage DOM and JavaScript of the loaded web page are running. The process is started by the Chromium engine when you navigate Browser to a web page with a different domain.

Chromium GPU Process

In this process the content of the web pages loaded in different Chromium Renderer processes is rendered by Chromium using the GPU.

Inter-Process Communication

Communication between different processes is done via Inter-Process Communication (IPC). IPC transfers data between two processes on a local machine.

To transfer data between Java and Chromium processes JxBrowser uses its own IPC implementation based on sockets and shared memory. Communication between Chromium processes is done via Chromium IPC implementation.

Main Components

Engine

Manages life cycle of the Chromium Main process and provides access to the core Chromium functionality such as zoom, proxy, cache, cookies, plugins, downloads, etc.

To work with the engine please use the Engine class. It is a top-level object in the objects hierarchy of the library. Working with the library begins with creation of an Engine instance.

For detailed instructions on creation and usage of the Engine instance please see the Engine guide.

Browser

This is a web browser control which is responsible for loading web pages or local HTML files, finding text on the loaded web page, modifying zoom, working with audio, getting notifications about loading progress, dispatching keyboard and mouse events, and more.

To work with this control please use the Browser class. Each Browser instance belongs to an Engine instance. The Browser instance is closed automatically if its Engine instance is closed or crashed.

The Browser guide provides details on how to create and use the Browser.

Frame

Each web page loaded in the Browser has a main Frame. The Frame itself may have child frames. You can use Frame to access and work with DOM and JavaScript. When a web page is unloaded, its Frame and all child frames are closed automatically.

How it Works

Creating Engine

When you create an Engine instance, the library performs the following actions:

  1. Start the Chromium Main and GPU processes.
  2. Initialize Chromium engine in the Chromium Main process.
  3. Setup IPC connection between Java and the Chromium Main process.

Creating Engine

If you create two Engine instances, separate Chromium Main and GPU processes will be started for each instance. For example: Creating Engines

Creating Browser

When you create a Browser instance, the library automatically loads an about:blank web page. It leads to the creation of the Chromium Renderer process where the DOM and JavaScript of this web page are running: Creating Browser

If you navigate the Browser instance to a web page, the page will be loaded in this Chromium Renderer process. If you then load a web page with a different domain, it will be loaded in a new Chromium Renderer process which will be started automatically. And the Chromium Renderer process created for the previous web page will be closed.

Closing Browser

When you close the Browser instance, the corresponding Chromium Renderer process is terminated automatically. It means that all the Frame instances running in the terminated process will be automatically closed as well: Creating Engine

Closing Engine

When you close the Engine, the library performs the following actions:

  1. Close IPC connection between Java and the Chromium Main processes.
  2. Dispose Chromium engine in the Chromium Main process.
  3. Terminate the Chromium Main and GPU processes.
Go Top