Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1298)

Unified Diff: chrome/browser/ui/gtk/browser_window_gtk.cc

Issue 17571018: Reland fast tab closure behind a flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, 2nd attempt to land. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/gtk/browser_window_gtk.cc
diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc
index cbcbeefecc44f7b111a31149d087a7d760c0e00a..d3ab2c8ffca83d8cc75c3a94de025ee2f62fafbc 100644
--- a/chrome/browser/ui/gtk/browser_window_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_window_gtk.cc
@@ -1443,12 +1443,25 @@ bool BrowserWindowGtk::CanClose() const {
if (!browser_->ShouldCloseWindow())
return false;
+ bool fast_tab_closing_enabled =
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableFastUnload);
+
if (!browser_->tab_strip_model()->empty()) {
// Tab strip isn't empty. Hide the window (so it appears to have closed
// immediately) and close all the tabs, allowing the renderers to shut
// down. When the tab strip is empty we'll be called back again.
gtk_widget_hide(GTK_WIDGET(window_));
browser_->OnWindowClosing();
+
+ if (fast_tab_closing_enabled)
+ browser_->tab_strip_model()->CloseAllTabs();
+ return false;
+ } else if (fast_tab_closing_enabled &&
+ !browser_->HasCompletedUnloadProcessing()) {
+ // The browser needs to finish running unload handlers.
+ // Hide the window (so it appears to have closed immediately), and
+ // the browser will call us back again when it is ready to close.
+ gtk_widget_hide(GTK_WIDGET(window_));
return false;
}

Powered by Google App Engine
This is Rietveld 408576698