Index: chrome/browser/browser_process_impl_win.cc |
diff --git a/chrome/browser/browser_process_impl_win.cc b/chrome/browser/browser_process_impl_win.cc |
index 9d013fdbb23ed98e0356988af2a123a98e4aba3c..2e2c0435163c7c3bf70a5866a13e29729d142aef 100644 |
--- a/chrome/browser/browser_process_impl_win.cc |
+++ b/chrome/browser/browser_process_impl_win.cc |
@@ -4,10 +4,12 @@ |
#include "chrome/browser/browser_process_impl.h" |
#include "base/command_line.h" |
-#include "chrome/common/chrome_switches.h" |
#if defined(USE_AURA) |
+#include "base/logging.h" |
+#include "base/process_util.h" |
#include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h" |
+#include "chrome/common/chrome_switches.h" |
#endif |
void BrowserProcessImpl::PlatformSpecificCommandLineProcessing( |
@@ -22,6 +24,20 @@ void BrowserProcessImpl::OnMetroViewerProcessTerminated() { |
metro_viewer_process_host_.reset(NULL); |
} |
+void BrowserProcessImpl::TerminateMetroViewerProcess() { |
+ if (metro_viewer_process_host_) { |
+ base::ProcessId viewer_id = |
+ metro_viewer_process_host_->GetViewerProcessId(); |
+ if (viewer_id == base::kNullProcessId) |
+ return; |
+ // The viewer doesn't hold any state so it is fine to kill it before it |
+ // cleanly exits. This will trigger MetroViewerProcessHost::OnChannelError() |
+ // which will cleanup references to g_browser_process. |
+ bool success = base::KillProcessById(viewer_id, 0, true); |
+ DCHECK(success); |
+ } |
+} |
+ |
void BrowserProcessImpl::PerformInitForWindowsAura( |
const CommandLine& command_line) { |
if (command_line.HasSwitch(switches::kViewerConnection) && |