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.

get all the processes that this browser uses

Post Reply
dvbss11
Posts: 28
Joined: Sat Oct 26, 2019 6:30 pm

get all the processes that this browser uses

Post by dvbss11 »

Tell me how to get all the processes that use this particular browser because using only GlobalCEFApp.ChildProcessesCount is not enough.



I get this log but

Code: Select all

MAIN
szExeFile  Project1.exe
cntUsage  0
dwSize  556
th32ProcessID  2788
th32DefaultHeapID  0
th32ModuleID  0
cntThreads  21
th32ParentProcessID  8408
pcPriClassBase  8
dwFlags  0
===================================
szExeFile  Project1.exe
cntUsage  0
dwSize  556
th32ProcessID  7276
th32DefaultHeapID  0
th32ModuleID  0
cntThreads  10
th32ParentProcessID  2788
pcPriClassBase  10
dwFlags  0
===================================
szExeFile  Project1.exe
cntUsage  0
dwSize  556
th32ProcessID  6352
th32DefaultHeapID  0
th32ModuleID  0
cntThreads  12
th32ParentProcessID  2788
pcPriClassBase  8
dwFlags  0
===================================
szExeFile  Project1.exe
cntUsage  0
dwSize  556
th32ProcessID  6696
th32DefaultHeapID  0
th32ModuleID  0
cntThreads  1
th32ParentProcessID  2788
pcPriClassBase  8
dwFlags  0
===================================
4
but it’s not clear which process refers to which browser



There are two components of Chromium1
and
Chromium2
both have a page loaded

Chromium1 I want to close and then
restart

But sometimes the process does not have time to close and an error occurs about the launch where it asks to close the application and start again, although all the events on the burial were worked out correctly.
I set a delay for opening, but this is not a solution because sometimes the process does not want to close within a minute or two or five



This is extremely rare but still occurs. And therefore, you would like to know the id of the process that should be checked for this browser before starting it.
dvbss11
Posts: 28
Joined: Sat Oct 26, 2019 6:30 pm

Re: get all the processes that this browser uses

Post by dvbss11 »

maybe this event will help
just to know which browser calls it and some parameter to write there so that you can recognize it when the process is running
TCefApplicationCore.BeforeChildProcessLaunchEvent (const commandLine: ICefCommandLine) ;
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: get all the processes that this browser uses

Post by salvadordf »

All the demos have a "Destruction steps" section in the code comments.

If your application follows those steps then CEF/Chromium should close all those child processes automatically.

In theory you shouldn't need to check if there are still child processes running but as you can see, I added TCEFSentinel to delay the application shutdown a few months ago because there was a shutdown issue in CEF. However, that issue is now fixed.

If you want a list of the child processes you can create a custom version of the TCefApplicationCore.GetUsedMemory function.
dvbss11
Posts: 28
Joined: Sat Oct 26, 2019 6:30 pm

Re: get all the processes that this browser uses

Post by dvbss11 »

But TCEFSentinel cannot track which browser has ended because there is only a check on the number of processes. And if you need to find out which browser belongs to which process, then nothing will work. How to betray the browser object itself to TCEFSentinel so that it only checks its processes for completeness?
User avatar
salvadordf
Posts: 4016
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: get all the processes that this browser uses

Post by salvadordf »

The processes are handled internally by Chromium and we shouldn't have to check if they are still running.

The right way to fix that error would be to check if the browser is destroyed following the right destruction steps and not checking the running processes.

TCEFSentinel was created as a desperate last resort "fix" that only worked partially while the real issue was fixed in the CEF libraries.

Consider using the TabbedBrowser2 demo as a template for your application. It can create and destroy as many browsers as you need using frames.
Post Reply