Page 1 of 1

Is it in anyway possible to lazy initialize GlobalCEFApp?

Posted: Wed Mar 03, 2021 12:25 pm
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-

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

Posted: Wed Mar 03, 2021 12:58 pm
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.

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

Posted: Thu Mar 04, 2021 6:03 am
by Tomm Prami
Thanks

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

Posted: Fri Mar 05, 2021 11:49 am
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.

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

Posted: Wed Mar 10, 2021 6:19 am
by Tomm Prami
Do I make Pull request for that demo? or will you merge it your self? Or?

-Tee-

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

Posted: Wed Mar 10, 2021 8:22 am
by salvadordf
Thanks for the code!

I'll take a look as soon as I have more time and integrate it manually.

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

Posted: Wed Mar 10, 2021 1:23 pm
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.