Page 1 of 1
Why all demos is single process?
Posted: Sat Nov 25, 2017 6:57 pm
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?
Re: Why all demos is single process?
Posted: Sat Nov 25, 2017 7:27 pm
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.
Re: Why all demos is single process?
Posted: Sat Nov 25, 2017 7:48 pm
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.
Re: Why all demos is single process?
Posted: Sat Nov 25, 2017 8:28 pm
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.
Re: Why all demos is single process?
Posted: Tue Jan 16, 2018 12:38 pm
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 !
Re: Why all demos is single process?
Posted: Tue Jan 16, 2018 1:01 pm
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.
Re: Why all demos is single process?
Posted: Tue Jan 16, 2018 5:58 pm
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 !
Re: Why all demos is single process?
Posted: Tue Jan 16, 2018 6:08 pm
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 .