Close browser instead of sending shutdown message

CEF now supports calling the beforeunload handler when closed
so we no longer need to send a shutdown message on the native
side.
This commit is contained in:
Kevin Sawicki
2013-04-05 08:34:04 -07:00
parent 1fcc0adf6c
commit 6e4d9508aa
3 changed files with 1 additions and 17 deletions

View File

@@ -18,7 +18,6 @@ class AtomCefRenderProcessHandler : public CefRenderProcessHandler {
CefRefPtr<CefProcessMessage> message) OVERRIDE;
void Reload(CefRefPtr<CefBrowser> browser);
void Shutdown(CefRefPtr<CefBrowser> browser);
bool CallMessageReceivedHandler(CefRefPtr<CefV8Context> context, CefRefPtr<CefProcessMessage> message);
void InjectExtensionsIntoV8Context(CefRefPtr<CefV8Context> context);

View File

@@ -30,10 +30,6 @@ bool AtomCefRenderProcessHandler::OnProcessMessageReceived(CefRefPtr<CefBrowser>
Reload(browser);
return true;
}
else if (name == "shutdown") {
Shutdown(browser);
return true;
}
else {
return CallMessageReceivedHandler(browser->GetMainFrame()->GetV8Context(), message);
}
@@ -54,17 +50,6 @@ void AtomCefRenderProcessHandler::Reload(CefRefPtr<CefBrowser> browser) {
context->Exit();
}
void AtomCefRenderProcessHandler::Shutdown(CefRefPtr<CefBrowser> browser) {
CefRefPtr<CefV8Context> context = browser->GetMainFrame()->GetV8Context();
CefRefPtr<CefV8Value> global = context->GetGlobal();
context->Enter();
CefV8ValueList arguments;
CefRefPtr<CefV8Value> shutdownFunction = global->GetValue("shutdown");
shutdownFunction->ExecuteFunction(global, arguments);
context->Exit();
}
bool AtomCefRenderProcessHandler::CallMessageReceivedHandler(CefRefPtr<CefV8Context> context, CefRefPtr<CefProcessMessage> message) {
context->Enter();

View File

@@ -246,7 +246,7 @@
- (BOOL)windowShouldClose:(NSNotification *)notification {
if (_cefClient && _cefClient->GetBrowser()) {
_cefClient->GetBrowser()->SendProcessMessage(PID_RENDERER, CefProcessMessage::Create("shutdown"));
_cefClient->GetBrowser()->GetHost()->CloseBrowser(false);
}
if (_pidToKillOnClose) kill([_pidToKillOnClose intValue], SIGQUIT);