mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
@@ -90,6 +90,9 @@ bool AtomCefClient::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
else if (name == "crash") {
|
||||
__builtin_trap();
|
||||
}
|
||||
else if (name == "restartRendererProcess") {
|
||||
RestartRendererProcess(browser);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
@@ -252,3 +255,11 @@ bool AtomCefClient::Save(const std::string& path, const std::string& data) {
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
void AtomCefClient::RestartRendererProcess(CefRefPtr<CefBrowser> browser) {
|
||||
// Navigating to the same URL has the effect of restarting the renderer
|
||||
// process, because cefode has overridden ContentBrowserClient's
|
||||
// ShouldSwapProcessesForNavigation method.
|
||||
CefRefPtr<CefFrame> frame = browser->GetFocusedFrame();
|
||||
frame->LoadURL(frame->GetURL());
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ class AtomCefClient : public CefClient,
|
||||
void EndTracing();
|
||||
|
||||
bool Save(const std::string& path, const std::string& data);
|
||||
void RestartRendererProcess(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
protected:
|
||||
CefRefPtr<CefBrowser> m_Browser;
|
||||
|
||||
Reference in New Issue
Block a user