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

Unified Diff: chrome/browser/browser_process_platform_part_aurawin.cc

Issue 14576015: In WinAura, also kill the Metro viewer process in AttemptExit(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r201426 Created 7 years, 7 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
Index: chrome/browser/browser_process_platform_part_aurawin.cc
diff --git a/chrome/browser/browser_process_platform_part_aurawin.cc b/chrome/browser/browser_process_platform_part_aurawin.cc
index aaca529f7746a5acdde9c607a85029483e916630..f1730f93fbd82de16eeac0dc5a7a0fe37d7a9cf0 100644
--- a/chrome/browser/browser_process_platform_part_aurawin.cc
+++ b/chrome/browser/browser_process_platform_part_aurawin.cc
@@ -5,6 +5,10 @@
#include "chrome/browser/browser_process_platform_part_aurawin.h"
#include "base/command_line.h"
+#include "base/logging.h"
+#include "base/process_util.h"
+#include "base/win/windows_version.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h"
#include "chrome/common/chrome_switches.h"
@@ -20,7 +24,8 @@ void BrowserProcessPlatformPart::OnMetroViewerProcessTerminated() {
void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing(
const CommandLine& command_line) {
- if (command_line.HasSwitch(switches::kViewerConnection) &&
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
+ command_line.HasSwitch(switches::kViewerConnection) &&
!metro_viewer_process_host_.get()) {
// Tell the metro viewer process host to connect to the given IPC channel.
metro_viewer_process_host_.reset(
@@ -28,3 +33,24 @@ void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing(
command_line.GetSwitchValueASCII(switches::kViewerConnection)));
}
}
+
+void BrowserProcessPlatformPart::AttemptExit() {
+ // On WinAura, the regular exit path is fine except on Win8+, where Ash might
+ // be active in Metro and won't go away even if all browsers are closed. The
+ // viewer process, whose host holds a reference to g_browser_process, needs to
+ // be killed as well.
+ BrowserProcessPlatformPartBase::AttemptExit();
+
+ if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
+ 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);
+ }
+}
« no previous file with comments | « chrome/browser/browser_process_platform_part_aurawin.h ('k') | chrome/browser/browser_process_platform_part_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698