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.

Is it in anyway possible to lazy initialize GlobalCEFApp?

Post Reply
Tomm Prami
Posts: 3
Joined: Wed Mar 03, 2021 11:50 am

Is it in anyway possible to lazy initialize GlobalCEFApp?

Post by Tomm Prami »

Hello,

I've been trying to find any info on this. But did not.

I would want to lazy initialize GlobalCEFApp on before window create, and then show web-content to user, and possibly free all resources when user is done.

initializing GlobalCEFApp in dpr takes quite long time, and also most cases for us, not necessary at all. MAybe 10% users/use cases would need use that feature on given day. So initializing it always seems like overkill. (if can avoided)

-Tee-
User avatar
salvadordf
Posts: 4040
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Is it in anyway possible to lazy initialize GlobalCEFApp?

Post by salvadordf »

Hi,

Yes, you can create GlobalCEFApp at any moment if you use a different EXE for the CEF subprocesses.
See the "SubProcess" demo for all the details.
Tomm Prami
Posts: 3
Joined: Wed Mar 03, 2021 11:50 am

Re: Is it in anyway possible to lazy initialize GlobalCEFApp?

Post by Tomm Prami »

Thanks
Tomm Prami
Posts: 3
Joined: Wed Mar 03, 2021 11:50 am

Re: Is it in anyway possible to lazy initialize GlobalCEFApp?

Post by Tomm Prami »

Made some chamges to there, also made demo that is close what I would need.

If you want to include in to the projet be my quest, also if don't like something I can do some changes,

Mainly changes are
  • Common unit and method for initialization
  • SubProcess Define to difrentiate differences in initialization
  • Some minor changes to the coding style (Make it easier to debug if then ; not on same line etc trivial)
  • Made simple demo app to have separate browser window which initializes Global object and so only when needed, seems to work OK.
You do not have the required permissions to view the files attached to this post.
Last edited by Tomm Prami on Fri Mar 05, 2021 11:52 am, edited 1 time in total.
Tomm Prami
Posts: 3
Joined: Wed Mar 03, 2021 11:50 am

Re: Is it in anyway possible to lazy initialize GlobalCEFApp?

Post by Tomm Prami »

Do I make Pull request for that demo? or will you merge it your self? Or?

-Tee-
User avatar
salvadordf
Posts: 4040
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Is it in anyway possible to lazy initialize GlobalCEFApp?

Post by salvadordf »

Thanks for the code!

I'll take a look as soon as I have more time and integrate it manually.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Is it in anyway possible to lazy initialize GlobalCEFApp?

Post by dilfich »

Demo DLLBrowser
Almost the same thing but probably better because when you close the browser will be completely destroyed. In one application, this is apparently not real.
Post Reply