summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimon.hong81@gmail.com <simon.hong81@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-03 02:37:45 +0000
committersimon.hong81@gmail.com <simon.hong81@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-03 02:37:45 +0000
commitb6975b9f4c1495fded60654aa96b1d544ec22a7b (patch)
tree30c87f97c058239bcaaa05b108131b79a84673c4
parenta655da9aec15cdd7fa5323294c2cbf7df0009cbd (diff)
downloadchromium_src-b6975b9f4c1495fded60654aa96b1d544ec22a7b.zip
chromium_src-b6975b9f4c1495fded60654aa96b1d544ec22a7b.tar.gz
chromium_src-b6975b9f4c1495fded60654aa96b1d544ec22a7b.tar.bz2
Add more conditions to reload when --reload-killed-tab option is used.
BUG=NONE TEST=compiles Review URL: https://chromiumcodereview.appspot.com/11342055 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165831 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--AUTHORS2
-rw-r--r--chrome/browser/ui/browser.cc38
2 files changed, 21 insertions, 19 deletions
diff --git a/AUTHORS b/AUTHORS
index b696695..be9a6d3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -157,7 +157,7 @@ Clinton Staley <clintstaley@chromium.org>
Devlin Cronin <rdevlin.cronin@gmail.com>
Junmin Zhu <junmin.zhu@intel.com>
Cem Kocagil <cem.kocagil@gmail.com>
-Simon Hong <simon.hong81@gmail.com>
+YoungKi Hong <simon.hong81@gmail.com>
Lu Guanqun <guanqun.lu@gmail.com>
François Beaufort <beaufort.francois@gmail.com>
Eriq Augustine <eriq.augustine@gmail.com>
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index ce7a5dc..8d541fb 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -246,6 +246,17 @@ chrome::HostDesktopType kDefaultHostDesktopType =
chrome::HOST_DESKTOP_TYPE_NATIVE;
#endif
+bool ShouldReloadCrashedTab(WebContents* contents) {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (!command_line.HasSwitch(switches::kReloadKilledTabs))
+ return false;
+
+ base::TerminationStatus crashed_status = contents->GetCrashedStatus();
+
+ return crashed_status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION ||
+ crashed_status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ||
+ crashed_status == base::TERMINATION_STATUS_PROCESS_CRASHED;
+}
} // namespace
@@ -645,13 +656,8 @@ void Browser::OnWindowActivated() {
// On some platforms we want to automatically reload tabs that are
// killed when the user selects them.
WebContents* contents = chrome::GetActiveWebContents(this);
- if (contents && contents->GetCrashedStatus() ==
- base::TERMINATION_STATUS_PROCESS_WAS_KILLED) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kReloadKilledTabs)) {
- chrome::Reload(this, CURRENT_TAB);
- }
- }
+ if (contents && ShouldReloadCrashedTab(contents))
+ chrome::Reload(this, CURRENT_TAB);
}
////////////////////////////////////////////////////////////////////////////////
@@ -1076,17 +1082,13 @@ void Browser::ActiveTabChanged(TabContents* old_contents,
// On some platforms we want to automatically reload tabs that are
// killed when the user selects them.
bool did_reload = false;
- if (user_gesture && new_contents->web_contents()->GetCrashedStatus() ==
- base::TERMINATION_STATUS_PROCESS_WAS_KILLED) {
- const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
- if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) {
- LOG(WARNING) << "Reloading killed tab at " << index;
- static int reload_count = 0;
- UMA_HISTOGRAM_CUSTOM_COUNTS(
- "Tabs.SadTab.ReloadCount", ++reload_count, 1, 1000, 50);
- chrome::Reload(this, CURRENT_TAB);
- did_reload = true;
- }
+ if (user_gesture && ShouldReloadCrashedTab(new_contents->web_contents())) {
+ LOG(WARNING) << "Reloading killed tab at " << index;
+ static int reload_count = 0;
+ UMA_HISTOGRAM_CUSTOM_COUNTS(
+ "Tabs.SadTab.ReloadCount", ++reload_count, 1, 1000, 50);
+ chrome::Reload(this, CURRENT_TAB);
+ did_reload = true;
}
// Discarded tabs always get reloaded.