Unload libcef on TChromium destroy

625 views
Skip to first unread message

Anderson Dapper

unread,
Mar 14, 2012, 4:24:12 PM3/14/12
to delphichrom...@googlegroups.com
I need unload libcef.dll on TChromium destroy event, not when I close my application.

How I can do this??


Att,
Anderson Dapper Rocha

Henri Gourvest

unread,
Mar 15, 2012, 6:14:10 AM3/15/12
to delphichrom...@googlegroups.com
Hi,

I just added CefShutDown public function, you can use it to unload CEF libs.
you must be sure all browsers à closed before calling this function.

--
Henri Gourvest

Anderson Dapper

unread,
Mar 15, 2012, 9:47:24 AM3/15/12
to delphichrom...@googlegroups.com
Thanks... 

I have code a function to do this, but now I only update my source and work with this new function.
Att,
Anderson Dapper Rocha

Anderson Dapper

unread,
Mar 15, 2012, 10:46:43 AM3/15/12
to delphichrom...@googlegroups.com
I use your method, CefShutDown, on TChromium.Destroy method after inherited.

But on create a new form with TChromium component, in function CreateBrowser of TCustomChromium always get FBrowser = nil.

Henri, you have a trick to do this safely?

Att,
Anderson Dapper Rocha



Em 15 de março de 2012 07:14, Henri Gourvest <hgou...@gmail.com> escreveu:

Christian Sciberras

unread,
Mar 15, 2012, 10:54:56 AM3/15/12
to delphichrom...@googlegroups.com
Anderson, why are you expecting TChromium to run after you pulled the plug (with CefShutDown)?

I'm trying to understand what you need. Am I right in thinking that you want to run your program with libcef.dll?

I don't see this possible, libcef.dll must exist somewhere if you want to use chromium.


Chris.

Steven Christy

unread,
Mar 15, 2012, 11:34:27 AM3/15/12
to delphichromiumembedded
I am thinking he wants to unload libcef when his program is not
needing a web browser. Presumably to save on memory.

Just a guess. But in addition to a manual shutdown he would also need
a manual start up.

-Steven

Christian Sciberras

unread,
Mar 15, 2012, 11:50:35 AM3/15/12
to delphichrom...@googlegroups.com
I just realized about my typo in my earlier message. I meant to ask Anderson why he expected to have his program run with libcef.dll not being loaded.

With regards to Steven's email, I'd like to point out that dlls loaded in Windows are quite efficient - memory is not duplicated etc. So this shouldn't be of concern.

On the other hand, if you want a lightweight web browser (uhm...smaller than Chrome's), then you will need to do something completely different.


Chris.

Anderson Dapper

unread,
Mar 15, 2012, 12:02:21 PM3/15/12
to delphichrom...@googlegroups.com
I understand this point but...
I have a application to control business routines and I use the TChromium only in two forms. but I use only one at time.

Because this I want unload libcef after use and I don't wan't keep alive objects like class to JavaScript extensions.

Att,
Anderson Dapper Rocha

Christian Sciberras

unread,
Mar 15, 2012, 12:14:10 PM3/15/12
to delphichrom...@googlegroups.com
I would advise against that.
See, an application is slow while loading, not unloading.

As such, the second time someone tries your form, he ends up waiting while it loads resources back again.

I think destroying TChromium should be enough. This "reloading the dll" practice may be beneficially in an application with *a lot* of TChromium instances.

Anderson Dapper

unread,
Mar 15, 2012, 12:45:43 PM3/15/12
to delphichrom...@googlegroups.com
wel... let's try change the question... 

If I register a extension how I can unregister this?

Because I have objects linked at the class extension and if I try to register again, when I open form, my javascritp access a old instance of this class.

It's result in access violation.


Att,
Anderson Dapper Rocha

Steven Christy

unread,
Mar 15, 2012, 1:26:05 PM3/15/12
to delphichromiumembedded
Hello Anderson,

If you are using dynamic linking and a BPL for your chromium, have you
considered LoadPackage/UnloadPackage on the BPL file?

Like: http://edn.embarcadero.com/article/27178

I have never had a need to do something like this myself, but it seems
reasonable: Something like:

Handle := LoadPackage('DCEF_2010.bpl');
.... load a form with chromium
UnloadPackage(Handle);

Regarding unregistering your CEF extension, I have no idea how to do
this.

-Steven

Anderson Dapper

unread,
Mar 15, 2012, 1:32:24 PM3/15/12
to delphichrom...@googlegroups.com
Thanks everybody for explain your comments.

But this thread give another way...


Att,
Anderson Dapper Rocha
Reply all
Reply to author
Forward
0 new messages