Page 2 of 2

Re: Tuning external message pump performance

Posted: Sat Jan 27, 2018 10:11 am
by petko
salvadordf wrote: Sat Jan 27, 2018 8:04 am If you can't find a way to load all of your web pages correctly at the same time you can also delay some of them.
For example, load 2 at a time and then the next 2 pages.

Also check that the code in the BeforeResourceLoad and GetResourceHandler events can work correctly under heavy load.
Probably I will just check if a page was loaded correctly (all resources were loaded) and if not, I will reload it.

Re: Tuning external message pump performance

Posted: Sun Jan 28, 2018 3:20 pm
by petko
petko wrote: Fri Jan 26, 2018 8:08 pm The problem was that I was setting Chromium events after calling CreateBrowser (I use ChromiumWindow and not CEFWindowParent) and for some reason none of these events was fired. I now set the events before creating the browser and the events work.
What could be the reason for this behavior? I am now having trouble with some events that I need to assign after creating the TChromium component.. Could it be the CEF scheduler thread?

Re: Tuning external message pump performance

Posted: Sun Jan 28, 2018 4:29 pm
by salvadordf
Hi,
petko wrote: Sun Jan 28, 2018 3:20 pm
petko wrote: Fri Jan 26, 2018 8:08 pm The problem was that I was setting Chromium events after calling CreateBrowser (I use ChromiumWindow and not CEFWindowParent) and for some reason none of these events was fired. I now set the events before creating the browser and the events work.
What could be the reason for this behavior? I am now having trouble with some events that I need to assign after creating the TChromium component.. Could it be the CEF scheduler thread?
TChromium only creates the handlers that you're going to use and the handlers execute the events only if they are created.

That feature was introduced in this update as a workaround for a CEF3 bug and because it's an efficient use of resources :
https://www.briskbard.com/forum/viewtopic.php?f=8&t=234

TChromium checks what events where assigned to know which handlers have to be created in the CreateBrowser function.

In case you need to use an event after the CreateBrowser call you can do this :
  • Implement the event and assign it to TChromium before you call CreateBrowser.
  • Use a boolean variable with an if..then clause inside that event to execute your code only when you set that boolean variable to True outside that event.
On Friday 26th I updated CEF4Delphi to always create a couple of handlers in all cases : Request handler and Life Span handler.

Those handlers generate these events :
  • OnBeforePopup
  • OnAfterCreated
  • OnBeforeClose
  • OnClose
  • OnBeforeBrowse
  • OnOpenUrlFromTab
  • OnBeforeResourceLoad
  • OnGetResourceHandler
  • OnResourceRedirect
  • OnResourceResponse
  • OnGetResourceResponseFilter
  • OnResourceLoadComplete
  • OnGetAuthCredentials
  • OnQuotaRequest
  • OnProtocolExecution
  • OnCertificateError
  • OnSelectClientCertificate
  • OnPluginCrashed
  • OnRenderViewReady
  • OnRenderProcessTerminated
If you were having difficulties with any of these events download the latest version of CEF4Delphi. You can assign any of those events at any time because the handlers are always created.

Posted: Sun Jan 28, 2018 4:57 pm
by petko
OK, I will create dummy events before using CreateBrowser and later set the proper event handlers.

P.S.: I guess it is not possible to create and assign handlers after CreateBrowser is called? If it was, it would've been much more convenient to create them on the fly - when you try to assign an event handler for a non-existing handler..

Re: Tuning external message pump performance

Posted: Sun Jan 28, 2018 5:37 pm
by salvadordf
It's not possible to create the handlers after the CreateBrowser call.

CEF3 uses the default handler implementation if no custom handler is provided in the CreateBrowser function.