Hi,
I have an MFC application and I embed CEF based browser in the application.
It supports following operations in following order:
1. Launch application .
2. Open a file/create a new.
3. View HTML page.
4. Close file.
5. Exit application.
So no CEF process is created in step 1. I am creating the window layout in step 2 and that is where I am creating the cef browser. I am able to fork all the sub processes in this step.
In step 3, View HTML , I basically create a post request and get the HTML response which is rendered.
Now my problem is, When i close file(step 4), I want cef processes to be killed by calling cef shutdown.Render process is killed but other process keep on running. If try cefshutdown, my application hangs with excepetions.. If I exit the application(step 4), I am able to close the cef processes using cefshutdown.
Why I want is cef processes to be killed in step 4:
Because I can again call step 2 after step 4. i.e close an already opened file and open a new file. When I do this way, since the cef processes were not killed in the close process, they are not being called again.
Some code for reference from the main application:
CefSettings cefsettings;
cefsettings.log_severity = LOGSEVERITY_VERBOSE;
// initialize CEF
HINSTANCE hInstance = GetModuleHandle(NULL);
CefMainArgs main_args(hInstance);
CefRefPtr<CefCommandLine> cmd_line = CefCommandLine::CreateCommandLine();
CefWindowInfo window_info;
window_info.SetAsChild(m_wndBrowser, oRect);
app = new SimpleCefApp(window_info);
CefString process_type;
app->OnBeforeCommandLineProcessing(process_type, cmd_line);
void* sandbox_info = nullptr;
cefsettings.multi_threaded_message_loop = true;
cefsettings.log_severity = LOGSEVERITY_VERBOSE;
CefString(&cefsettings.browser_subprocess_path).FromASCII("cefsimplehelper.exe");
const auto exit_code = CefExecuteProcess(main_args, app.get(), nullptr);
if (exit_code >= 0)
return exit_code;
BOOL stat = CefInitialize(main_args, cefsettings, app.get(), sandbox_info);
if (!CEFInitialized)
{
CEFInitialized = true;
}