OS: Windows
CEF: 3.2454.1344
I am using Java DockableFrame to display the browser window. In the case when I just create the CefClient and create the CefBrowser and do load the URL but doesn't load the dockableframe that contains the UI component of the browser I only get the single jcef_helper process in the Task manager. Now if I exit the main application the CefApp thread is not killed and due to that the main application stays running in the Task manager. But if I do load the dockableFrame that has the Browser component then I do get the 2 jcef_helper processes and when I exit the main application it gets properly shut down. So I am struggling why the 1st case is not cleaning up properly.
Following is the code to StartBrowser
private void startBrowser() {
System.out.println( "*********** Starting browser **************");
boolean useOSR = true;
boolean isTransparent = false;
CefSettings settings = new CefSettings();
settings.windowless_rendering_enabled = useOSR;
cefApp_ = CefApp.getInstance(settings);
client_ = cefApp_.createClient();
//Create the cookie manager
cookieManager_ = CefCookieManager.getGlobalManager();
//This sets up sqlite database for cookies.
cookieManager_.setStoragePath(cookiePath, true);
browser_ = client_.createBrowser(startURL_, useOSR, isTransparent);
browser_.loadURL(startURL_);
browserUI_ = browser_.getUIComponent();
add(browserUI_, BorderLayout.CENTER);
System.out.println("*************** Loaded Browser ****************");
}
Code to dispose the CefApp when main application calls exit.
CefApp.CefAppState cefAppState = CefApp.getState();
//Made this check over here so that if the CefApp is not initalized then no need to dispose.
if (cefAppState != CefApp.CefAppState.NONE && cefAppState != CefApp.CefAppState.SHUTTING_DOWN && cefAppState != CefApp.CefAppState.TERMINATED)
{
CefApp cefApp = CefApp.getInstance();
if (cefApp != null)
{
cefApp.dispose();
}
}
Please let me know what I have done wrong or what extra should I add so that the CefApp gets shutdown properly.
Any help will be appreciated and thanks in advance.