Page 1 of 1
Is it possible to let two TChromium components use the same render process?
Posted: Fri Apr 26, 2019 8:27 am
by tad.chen
When One TChromium component is created, its render process will be created too. Sometimes one render process only serves for one TChromium component, sometimes serves for several TChromium components. It's random! Is it possible to control it ? For example, let two TChromium components use the same render process?
Re: Is it possible to let two TChromium components use the same render process?
Posted: Fri Apr 26, 2019 9:19 am
by salvadordf
Hi,
The number of processes is managed internally by Chromium. There are several process models supported by Chromium but if I remember correctly, CEF only supports the default model.
Read this for more information about the process models :
https://www.chromium.org/developers/des ... ess-models
You can try these switches :
- --process-per-site
- --process-per-tab
For example, add this line before the GlobalCEFApp.StartMainProcess call in the DPR file :
Code: Select all
GlobalCEFApp.AddCustomCommandLine('--process-per-site');
I haven't tested those switches and some people use this instead to enable the "process per site" model :
Code: Select all
GlobalCEFApp.AddCustomCommandLine('--process-per-site', 1);
You can also set GlobalCEFApp.SitePerProcess to FALSE or use the
--renderer-process-limit switch to limit to the number of renderer processes.
The full list of switches is here :
https://peter.sh/experiments/chromium-c ... -switches/
Re: Is it possible to let two TChromium components use the same render process?
Posted: Fri Apr 26, 2019 10:25 am
by tad.chen
Thank you for your information! I'll think about it.
Re: Is it possible to let two TChromium components use the same render process?
Posted: Wed May 01, 2019 10:25 am
by tad.chen
salvadordf,
I made a test of JSExtension and found It doesn't support concurrency in one render process.
Browser process must sends JSExtension request one by one. If send the next request before last request's callback comes, it will be discarded.
This is found not only in one TChromium instance, but also in several TChromium instances running in one render process. For example, there are two TChromium instances A and B running in one render process. Sending JSExtension request to B must wait for the finish of Sending JSExtension request to A. I think the reason is that one render process only has one thread to handle all V8 javascript.
If A and B are running in different render process. It support concurrency.
Re: Is it possible to let two TChromium components use the same render process?
Posted: Wed May 01, 2019 10:46 am
by salvadordf
Each render process handles IPC messages in its main thread and GlobalCEFApp.OnProcessMessageReceived is executed in the render process main thread.
If there's only one render process then all IPC messages will be handled sequentially by one thread.
Read this for more details about Chromium's multi-process architecture :
http://www.chromium.org/developers/desi ... chitecture

Re: Is it possible to let two TChromium components use the same render process?
Posted: Wed May 01, 2019 11:08 am
by salvadordf
A quote from the JavaScript integration document :
With CEF3 Blink (WebKit) and JS execution run in a separate renderer process. The main thread in a renderer process is identified as TID_RENDERER and all V8 execution must take place on this thread.
https://bitbucket.org/chromiumembedded/ ... ntegration
Re: Is it possible to let two TChromium components use the same render process?
Posted: Wed May 01, 2019 1:43 pm
by tad.chen
OK! Thank you for your information.