Index: chrome/browser/ui/browser.cc |
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc |
index a5a5fddc227c379179104ddf9186a828403384b3..c33f3709292c7790c9f4d184a9dbe011136f253f 100644 |
--- a/chrome/browser/ui/browser.cc |
+++ b/chrome/browser/ui/browser.cc |
@@ -246,6 +246,16 @@ chrome::HostDesktopType kDefaultHostDesktopType = |
chrome::HOST_DESKTOP_TYPE_NATIVE; |
#endif |
+bool IsTabCrashed(WebContents* contents) { |
sky
2012/10/31 21:30:15
Name this ShouldReloadCrashedTab and have it inclu
simonhong_
2012/10/31 22:06:43
Done.
|
+ base::TerminationStatus crashed_status = contents->GetCrashedStatus(); |
+ |
+ if (crashed_status == base::TERMINATION_STATUS_ABNORMAL_TERMINATION || |
sky
2012/10/31 21:30:15
Make this a single return statement, eg:
return c
simonhong_
2012/10/31 22:06:43
Done.
|
+ crashed_status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED || |
+ crashed_status == base::TERMINATION_STATUS_PROCESS_CRASHED) |
+ return true; |
+ else |
+ return false; |
+} |
} // namespace |
@@ -647,10 +657,9 @@ 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 (contents) { |
if (CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kReloadKilledTabs)) { |
+ switches::kReloadKilledTabs) && IsTabCrashed(contents)) { |
chrome::Reload(this, CURRENT_TAB); |
} |
} |
@@ -1078,10 +1087,10 @@ 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) { |
+ if (user_gesture) { |
const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
- if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) { |
+ if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs) && |
+ IsTabCrashed(new_contents->web_contents())) { |
LOG(WARNING) << "Reloading killed tab at " << index; |
static int reload_count = 0; |
UMA_HISTOGRAM_CUSTOM_COUNTS( |