Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Why all demos is single process?

Post Reply
User avatar
xpert13
Posts: 39
Joined: Wed May 31, 2017 5:26 pm

Why all demos is single process?

Post by xpert13 »

I noticed that all your demos is in single process mode. It's happening when GlobalCEFApp.BrowserSubprocessPath value is empty.

Did you do this accidentally?
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Why all demos is single process?

Post by salvadordf »

I checked several demos and I see several processes when I open different websites, specially in the tabbedbrowser and toolboxbrowser demos.

Many javascript demos open a file and you'll only see a couple of processes.

The default value of the GlobalCEFApp.SingleProcess property was not modified in the latest update. It's still False.
User avatar
xpert13
Posts: 39
Joined: Wed May 31, 2017 5:26 pm

Re: Why all demos is single process?

Post by xpert13 »

Look at this function:

Code: Select all

function TCefApplication.StartMainProcess : boolean;
begin
  if not(FSingleProcess) and (length(FBrowserSubprocessPath) > 0) then
    Result := MultiExeProcessing
   else
    Result := SingleExeProcessing;
end;
As you can see MultiExeProcessing is used when FBrowserSubprocessPath is not empty. But by default it is empty.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Why all demos is single process?

Post by salvadordf »

I should have used less confusing names for some internal functions. :?

When you set GlobalCEFApp.SingleProcess to True the application will only create one process with your application's executable.

However, if you set GlobalCEFApp.SingleProcess to False your application will create several processes.
To create all those processes CEF can use your application's executable or a different EXE for the subprocesses.

In the first case you will see your application's EXE several times in the task manager, for example :

Code: Select all

SimpleBrowser.exe
SimpleBrowser.exe
SimpleBrowser.exe
SimpleBrowser.exe
But in the second case you will see your application's executable one time and one or more processes using a different EXE :

Code: Select all

SimpleBrowser.exe
SubProcess.exe
SubProcess.exe
SubProcess.exe
SingleExeProcessing is called when you want CEF to use your application's executable for all the subprocesses or in single process mode.

MultiExeProcessing is called when you want CEF to use a different EXE for the subprocesses. The SubProcess demo shows how to use a SimpleBrowser.exe as the main executable and a SubProcess.exe for all the subprocesses.

To use a different EXE for the subprocesses you have to set the GlobalCEFApp.BrowserSubprocessPath property with the name of the executable (e.g. subprocess.exe) and create a crash_reporter.cfg file as described here :
https://bitbucket.org/chromiumembedded/ ... porting.md

The Subprocess demo also includes a sample crash_reporter.cfg file.
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: Why all demos is single process?

Post by thefunkyjoint »

Hello,

Does this 'SubProcess.exe' file needs to exist or it's only a name to the subprocesses be created ? I just want the subprocesses don't have the name of my app.

Thanks !
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Why all demos is single process?

Post by salvadordf »

Hi,

SubProcess.exe must exist and it's a very small application that you can build using the SubProcess.dpr project in the SubProcess demo or creating a new project and using this code in the DPR file :

Code: Select all

program SubProcess;

uses
  Windows, uCEFApplication;

{$SetPEFlags $20}  

begin
  GlobalCEFApp := TCefApplication.Create;
  GlobalCEFApp.StartSubProcess;
  GlobalCEFApp.Free;
end.
This SubProcess application doesn't have a form and it must have the same settings for GlobalCEFApp.cache, GlobalCEFApp.cookies, GlobalCEFApp.UserDataPath, GlobalCEFApp.FrameworkDirPath, GlobalCEFApp.ResourcesDirPath and GlobalCEFApp.LocalesDirPath as your main application.

Your main application must set GlobalCEFApp.BrowserSubprocessPath := 'SubProcess.exe'; before the GlobalCEFApp.StartMainProcess call in the DPR file.

For more details, read the code comments in the SubProcess demo.
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: Why all demos is single process?

Post by thefunkyjoint »

Salvador,

Thanks again, i could make it work by following your instructions ! I will make some tests with singleprocess := false in order to available how stable the app will be now.

Thank you !
thefunkyjoint
Posts: 513
Joined: Thu Aug 10, 2017 12:40 pm

Re: Why all demos is single process?

Post by thefunkyjoint »

salvadordf wrote: Tue Jan 16, 2018 1:01 pm Hi,

SubProcess.exe must exist and it's a very small application that you can build using the SubProcess.dpr project in the SubProcess demo or creating a new project and using this code in the DPR file :

Code: Select all

program SubProcess;

uses
  Windows, uCEFApplication;

{$SetPEFlags $20}  

begin
  GlobalCEFApp := TCefApplication.Create;
  GlobalCEFApp.StartSubProcess;
  GlobalCEFApp.Free;
end.
This SubProcess application doesn't have a form and it must have the same settings for GlobalCEFApp.cache, GlobalCEFApp.cookies, GlobalCEFApp.UserDataPath, GlobalCEFApp.FrameworkDirPath, GlobalCEFApp.ResourcesDirPath and GlobalCEFApp.LocalesDirPath as your main application.

You main application must set GlobalCEFApp.BrowserSubprocessPath := 'SubProcess.exe'; before the GlobalCEFApp.StartMainProcess call in the DPR file.

For more details, read the code comments in the SubProcess demo.
Just to add an information, in my tests only with your code the app worked normally ; it was not necessary to set this parameters in the subprocess project : GlobalCEFApp.cache, GlobalCEFApp.cookies, GlobalCEFApp.UserDataPath, GlobalCEFApp.FrameworkDirPath, GlobalCEFApp.ResourcesDirPath and GlobalCEFApp.LocalesDirPath .
Post Reply