[6099] Implement OnAlreadyRunningAppRelaunch() for cefsimple

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

[6099] Implement OnAlreadyRunningAppRelaunch() for cefsimple

Postby linuxcef07 » Tue Jan 02, 2024 11:55 am

I have checked out Cefsimple code for version 120.0.6099.109.
As per cef docs, starting from version 120, singleton behavior applies to all CEF-based applications
Now this requires you to customize root_cache_path for your application and implement CefBrowserProcessHandler::OnAlreadyRunningAppRelaunch().

I have set root_cache_path as well as cache_path to local absolute directory path and implementing OnAlreadyRunningAppRelaunch() in cefsimple code (as I don't see any code for CefBrowserProcessHandler::OnAlreadyRunningAppRelaunch() in cefsimple code)
https://bitbucket.org/chromiumembedded/cef/src/11b97c11bc5eb3bc09605901e3b5ed724361848b/tests/cefsimple/simple_app.cc?at=6099

I overridden the OnAlreadyRunningAppRelaunch() in SimpleApp class and returning true (as browser is already created in OnContextInitialized()) but it fails in rendering.
I am bit confused with the explanation for OnAlreadyRunningAppRelaunch - https://cef-builds.spotifycdn.com/docs/121.0/classCefBrowserProcessHandler.html#a052a91639483467c0b546d57a05c2f06

Is there any plan to update cefsimple with implementation for OnAlreadyRunningAppRelaunch()?
If not, can someone please share it here for better understanding?
linuxcef07
Techie
 
Posts: 34
Joined: Wed Dec 20, 2023 11:57 am

Re: [6099] Implement OnAlreadyRunningAppRelaunch() for cefsi

Postby ndesktop » Tue Jan 02, 2024 1:00 pm

What does it means "but it fails in rendering." ?
The documentation states: "This method will be called on the browser process UI thread."
ndesktop
Master
 
Posts: 756
Joined: Thu Dec 03, 2015 10:10 am

Re: [6099] Implement OnAlreadyRunningAppRelaunch() for cefsi

Postby linuxcef07 » Tue Jan 02, 2024 1:05 pm

What does it means "but it fails in rendering." ?

there is no video for given url (there is blank screen on browser window) and I can see following logs:
    [0103/202400.965648:warning:sandbox_linux.cc(400)] InitializeSandbox() called with multiple threads in process gpu-process.
    [0103/202401.034712:warning:child_thread_type_switcher_linux.cc(27)] Could not find tid

I am just returning true and no other code changes in OnAlreadyRunningAppRelaunch(). Is it correct way to handle this callback? If not, what exactly need to be handled on callback side (as browser is already created in OnContextInitialized())?
Code: Select all
bool CefPlayerApp::OnAlreadyRunningAppRelaunch(CefRefPtr<CefCommandLine>    commandLine,
   const CefString& currentDirectory) {
   CEF_REQUIRE_UI_THREAD();
   return true;
}
linuxcef07
Techie
 
Posts: 34
Joined: Wed Dec 20, 2023 11:57 am

Re: [6099] Implement OnAlreadyRunningAppRelaunch() for cefsi

Postby linuxcef07 » Mon Jan 08, 2024 7:49 am

For now, I have fixed issues by using unique cache path (instead of implementing OnAlreadyRunningAppRelaunch()).
I will try to implement this callback by activating (setting focus using WINAPI) the browser window created in OnContextInitialised(). Will update post once done.
linuxcef07
Techie
 
Posts: 34
Joined: Wed Dec 20, 2023 11:57 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 191 guests

cron