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

Unified Diff: remoting/host/ipc_desktop_environment.cc

Issue 859413003: Remove uses of CloseProcessHandle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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: remoting/host/ipc_desktop_environment.cc
diff --git a/remoting/host/ipc_desktop_environment.cc b/remoting/host/ipc_desktop_environment.cc
index f1b1f753ff35d3c736a17755ed03e5e9789cfb71..7015343806caf598446ee5f1dc79d7f02a40282b 100644
--- a/remoting/host/ipc_desktop_environment.cc
+++ b/remoting/host/ipc_desktop_environment.cc
@@ -181,22 +181,28 @@ void IpcDesktopEnvironmentFactory::SetScreenResolution(
void IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached(
int terminal_id,
- base::ProcessHandle desktop_process,
+ base::ProcessHandle desktop_process_handle,
IPC::PlatformFileForTransit desktop_pipe) {
if (!caller_task_runner_->BelongsToCurrentThread()) {
caller_task_runner_->PostTask(FROM_HERE, base::Bind(
&IpcDesktopEnvironmentFactory::OnDesktopSessionAgentAttached,
- base::Unretained(this), terminal_id, desktop_process, desktop_pipe));
+ base::Unretained(this), terminal_id, desktop_process_handle,
+ desktop_pipe));
return;
}
+ base::Process desktop_process;
+ // Unit tests may pass a pseudo-handle.
+ if (desktop_process_handle == base::GetCurrentProcessHandle())
+ desktop_process = base::Process::Current();
Sergey Ulanov 2015/01/24 18:04:29 nit: please add {} here and in the else case Can
rvargas (doing something else) 2015/02/02 20:57:00 done
Sergey Ulanov 2015/02/02 21:36:31 Current process handle is used in tests only, so i
rvargas (doing something else) 2015/02/04 03:21:38 Done.
+ else
+ desktop_process = base::Process(desktop_process_handle);
+
ActiveConnectionsList::iterator i = active_connections_.find(terminal_id);
if (i != active_connections_.end()) {
i->second->DetachFromDesktop();
- i->second->AttachToDesktop(desktop_process, desktop_pipe);
+ i->second->AttachToDesktop(desktop_process.Pass(), desktop_pipe);
} else {
- base::CloseProcessHandle(desktop_process);
-
#if defined(OS_POSIX)
DCHECK(desktop_pipe.auto_close);
base::File pipe_closer(IPC::PlatformFileForTransitToFile(desktop_pipe));

Powered by Google App Engine
This is Rietveld 408576698