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..bd160416d8ff4a80a1d7a895168986b1ff29deea 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,23 @@ 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) { |
+ // If a |metro_viewer_process_host_| exists, it should always be connected |
+ // at this point. |
+ NOTREACHED(); |
robertshield
2013/05/10 16:51:48
what if this gets called twice before OnMetroViewe
gab
2013/05/13 17:46:16
OnMetroViewerProcessTerminated() is called synchro
|
+ 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. |
+ base::KillProcessById(viewer_id, 0, true); |
+ } |
+} |
+ |
void BrowserProcessImpl::PerformInitForWindowsAura( |
const CommandLine& command_line) { |
if (command_line.HasSwitch(switches::kViewerConnection) && |