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

Unified Diff: chrome/browser/ui/tabs/tab_strip_model.cc

Issue 10937028: Do not discard selected tab (Closed) Base URL: http://git.chromium.org/chromium/src.git@new
Patch Set: Created 8 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/tabs/tab_strip_model.cc
diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc
index c622f87da28b953a5db28644bbfea2f0403e8e31..00094c2cc2429af724a57fce616d3a0475db7d3e 100644
--- a/chrome/browser/ui/tabs/tab_strip_model.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model.cc
@@ -217,8 +217,14 @@ TabContents* TabStripModel::DiscardTabContentsAt(int index) {
old_contents->web_contents()->GetController());
// Replace the tab we're discarding with the null version.
ReplaceTabContentsAt(index, null_contents);
- // Mark the tab so it will reload when we click.
- contents_data_[index]->discarded = true;
+
+ // Only mark tabs that are not selected. When selected tab is discarded, it is
sky 2012/09/19 17:06:59 Write a test for this.
simonhong_ 2012/09/20 10:26:29 This can be verified by OomProirotyManager::Discar
sky 2012/09/20 15:24:08 Can't you call what OOMPriorityManager is invoking
simonhong_ 2012/09/20 16:07:59 Modified tab_strip_model_unittest. And Added some
+ // the last tab. After discarding last tab, it is reloaded again. So, do not
+ // mark the tab. It is active tab.
+ if (!IsTabSelected(index)) {
+ // Mark the tab so it will reload when we click.
+ contents_data_[index]->discarded = true;
+ }
// Discard the old tab's renderer.
// TODO(jamescook): This breaks script connections with other tabs.
// We need to find a different approach that doesn't do that, perhaps based
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698