From: Cheng Zhao Date: Tue, 28 May 2013 08:01:44 +0000 (+0800) Subject: Add BrowserWindow.restart() to restart renderer process. X-Git-Tag: v0.1.0~133 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=9cf890bb61d0e565e3ebf4d9a3c2c3b38d05e76d;p=electron.git Add BrowserWindow.restart() to restart renderer process. --- diff --git a/browser/api/lib/browser_window.coffee b/browser/api/lib/browser_window.coffee index 7f21575f..2e06ebcb 100644 --- a/browser/api/lib/browser_window.coffee +++ b/browser/api/lib/browser_window.coffee @@ -14,6 +14,9 @@ BrowserWindow::toggleDevTools = -> @openDevTools() v8Util.setHiddenValue this, 'devtoolsOpened', true +BrowserWindow::restart = -> + @loadUrl(@getUrl()) + BrowserWindow.getFocusedWindow = -> windows = objectsRegistry.getAllWindows() return window for window in windows when window.isFocused() diff --git a/browser/atom_browser_client.cc b/browser/atom_browser_client.cc index df60109e..8b66167a 100644 --- a/browser/atom_browser_client.cc +++ b/browser/atom_browser_client.cc @@ -38,6 +38,14 @@ void AtomBrowserClient::OverrideWebkitPrefs( prefs->enable_scroll_animator = false; } +bool AtomBrowserClient::ShouldSwapProcessesForNavigation( + content::SiteInstance* site_instance, + const GURL& current_url, + const GURL& new_url) { + // Restart renderer process if navigating to the same url. + return current_url == new_url; +} + brightray::BrowserMainParts* AtomBrowserClient::OverrideCreateBrowserMainParts( const content::MainFunctionParams&) { return new AtomBrowserMainParts; diff --git a/browser/atom_browser_client.h b/browser/atom_browser_client.h index 22f08d2e..196329d3 100644 --- a/browser/atom_browser_client.h +++ b/browser/atom_browser_client.h @@ -18,6 +18,10 @@ class AtomBrowserClient : public brightray::BrowserClient { virtual void OverrideWebkitPrefs(content::RenderViewHost* render_view_host, const GURL& url, webkit_glue::WebPreferences* prefs) OVERRIDE; + virtual bool ShouldSwapProcessesForNavigation( + content::SiteInstance* site_instance, + const GURL& current_url, + const GURL& new_url) OVERRIDE; private: virtual brightray::BrowserMainParts* OverrideCreateBrowserMainParts( diff --git a/vendor/brightray b/vendor/brightray index 6b9c1b67..e2c74cd6 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 6b9c1b6761ff164173e4f7fdebc478af99e411e5 +Subproject commit e2c74cd6631fa7289e36e34f5c6e286bb1e961c2