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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/browser_process_platform_part_aurawin.h" 5 #include "chrome/browser/browser_process_platform_part_aurawin.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h"
9 #include "base/process_util.h"
10 #include "base/win/windows_version.h"
11 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h" 12 #include "chrome/browser/metro_viewer/metro_viewer_process_host_win.h"
9 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
10 14
11 BrowserProcessPlatformPart::BrowserProcessPlatformPart() { 15 BrowserProcessPlatformPart::BrowserProcessPlatformPart() {
12 } 16 }
13 17
14 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() { 18 BrowserProcessPlatformPart::~BrowserProcessPlatformPart() {
15 } 19 }
16 20
17 void BrowserProcessPlatformPart::OnMetroViewerProcessTerminated() { 21 void BrowserProcessPlatformPart::OnMetroViewerProcessTerminated() {
18 metro_viewer_process_host_.reset(NULL); 22 metro_viewer_process_host_.reset(NULL);
19 } 23 }
20 24
21 void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing( 25 void BrowserProcessPlatformPart::PlatformSpecificCommandLineProcessing(
22 const CommandLine& command_line) { 26 const CommandLine& command_line) {
23 if (command_line.HasSwitch(switches::kViewerConnection) && 27 if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
28 command_line.HasSwitch(switches::kViewerConnection) &&
24 !metro_viewer_process_host_.get()) { 29 !metro_viewer_process_host_.get()) {
25 // Tell the metro viewer process host to connect to the given IPC channel. 30 // Tell the metro viewer process host to connect to the given IPC channel.
26 metro_viewer_process_host_.reset( 31 metro_viewer_process_host_.reset(
27 new MetroViewerProcessHost( 32 new MetroViewerProcessHost(
28 command_line.GetSwitchValueASCII(switches::kViewerConnection))); 33 command_line.GetSwitchValueASCII(switches::kViewerConnection)));
29 } 34 }
30 } 35 }
36
37 void BrowserProcessPlatformPart::AttemptExit() {
38 // On WinAura, the regular exit path is fine except on Win8+, where Ash might
39 // be active in Metro and won't go away even if all browsers are closed. The
40 // viewer process, whose host holds a reference to g_browser_process, needs to
41 // be killed as well.
42 BrowserProcessPlatformPartBase::AttemptExit();
43
44 if (base::win::GetVersion() >= base::win::VERSION_WIN8 &&
45 metro_viewer_process_host_) {
46 base::ProcessId viewer_id =
47 metro_viewer_process_host_->GetViewerProcessId();
48 if (viewer_id == base::kNullProcessId)
49 return;
50 // The viewer doesn't hold any state so it is fine to kill it before it
51 // cleanly exits. This will trigger MetroViewerProcessHost::OnChannelError()
52 // which will cleanup references to g_browser_process.
53 bool success = base::KillProcessById(viewer_id, 0, true);
54 DCHECK(success);
55 }
56 }
OLDNEW
« 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