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.

Slow Loading CEF files

jsperry
Posts: 7
Joined: Mon Mar 18, 2024 11:47 am

Slow Loading CEF files

Post by jsperry »

We have an application "A" which we do not own and application "B" which we do own. "A" exists either on a local box or on a server somewhere. There is a shortcut set up to call "A".

From "A" we can call "B" with a shell execute. "B" has the embedded web browser and will be on a server somewhere not necessarily where "A" is located. The supporting CEF files can reside with "A" in the same folder but we cannot place those files with "A" because we do not own "A". So using the GlobalCEFApp path settings we pointed to the server where "B" resides and placed the supporting files in a folder there. This worked but it takes too long for these files to load.

We could probably place these files in a folder somewhere else where "A" resides but can we make it work? We did try the following settings and the files could not be found and I'm assuming "B" did not know how to look back to where "A" is located to find the files. Any ideas?

These settings did NOT work:

GlobalCEFApp.FrameworkDirPath := '%USERPROFILE%\AppData\Local\Microsoft\WindowsApps\CEF';
GlobalCEFApp.ResourcesDirPath := '%USERPROFILE%\AppData\Local\Microsoft\WindowsApps\CEF';
GlobalCEFApp.LocalesDirPath := '%USERPROFILE%\AppData\Local\Microsoft\WindowsApps\CEF\locales';
GlobalCEFApp.EnableGPU := True; // Enable hardware acceleration
GlobalCEFApp.cache := '%USERPROFILE%\AppData\Local\Microsoft\WindowsApps\CEF\cache';
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Slow Loading CEF files

Post by salvadordf »

Hi,

The initialization of CEF browsers from network directories is very slow.

It's recommended to copy the CEF binaries from the network directory to the local hard drive and configure GlobalCEFApp to use the local copies before initializing CEF.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Slow Loading CEF files

Post by salvadordf »

I forgot that you might also need to set GlobalCEFApp.SetCurrentDir := True; before the GlobalCEFApp.StarMainProcess call if the application is launched from another app.
jsperry
Posts: 7
Joined: Mon Mar 18, 2024 11:47 am

Re: Slow Loading CEF files

Post by jsperry »

I am still experimenting but it appears GlobalCEFApp is getting created multiple times. Is that normal or am I doing something wrong.
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Slow Loading CEF files

Post by salvadordf »

Chromium uses several processes to render web contents, handle network connections, etc.
https://www.chromium.org/developers/design-documents/multi-process-architecture/

With the default GlobalCEFApp property values CEF will use the same executable to create all those processes.

It's necessary to adapt the applications and/or the GlobalCEFApp properties in some cases.
For example, the database connections shouldn't be established in the initialization section to avoid conflicts between all Chromium processes.
Another example, the applications running as plugins usually require a different executable for the CEF subprocesses.

Read this document for more information :
https://www.briskbard.com/index.php?lang=en&pageid=cef
jsperry
Posts: 7
Joined: Mon Mar 18, 2024 11:47 am

Re: Slow Loading CEF files

Post by jsperry »

Thank you for your response!

Are there any files or dlls I can elimnate such as some of the .pak files?
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Slow Loading CEF files

Post by salvadordf »

You can delete cef_sandbox.lib, libcef.lib and the pak files of unused languages but you MUST always keep en-US.pak because Chromium has that dependency.
jsperry
Posts: 7
Joined: Mon Mar 18, 2024 11:47 am

Re: Slow Loading CEF files

Post by jsperry »

I removed the pak language files but I received the error message CEF binaries missing! so maybe that is not possible?
User avatar
salvadordf
Posts: 4056
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Slow Loading CEF files

Post by salvadordf »

I forgot that you have to set GlobalCEFApp.CheckCEFFiles to False if you delete any of the pak files.
jsperry
Posts: 7
Joined: Mon Mar 18, 2024 11:47 am

Re: Slow Loading CEF files

Post by jsperry »

Thank you!

One other question. I seem to have a hard time getting the URL to open. I get the browser intiailized, set a default URL then load the URL. Still seems to take up to a minute for the web page to appear. I must not be doing that right. Any more suggestions. Thanks
Post Reply