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

Unified Diff: components/nacl/browser/nacl_process_host.cc

Issue 860453002: Move OpenProcessHandleWithAccess to Process::OpenWithAccess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ServiceProcessControlBrowserTest.Setup again 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: components/nacl/browser/nacl_process_host.cc
diff --git a/components/nacl/browser/nacl_process_host.cc b/components/nacl/browser/nacl_process_host.cc
index c9cc5951b4e428d6a5725b24d4036ddf8376dded..e273204194852c306dbadd64996e59d12ffdbd7c 100644
--- a/components/nacl/browser/nacl_process_host.cc
+++ b/components/nacl/browser/nacl_process_host.cc
@@ -1143,7 +1143,6 @@ bool NaClProcessHost::AttachDebugExceptionHandler(const std::string& info,
debug_exception_handler_requested_ = true;
base::ProcessId nacl_pid = base::GetProcId(process_->GetData().handle);
- base::ProcessHandle temp_handle;
// We cannot use process_->GetData().handle because it does not have
// the necessary access rights. We open the new handle here rather
// than in the NaCl broker process in case the NaCl loader process
@@ -1152,21 +1151,20 @@ bool NaClProcessHost::AttachDebugExceptionHandler(const std::string& info,
// but this takes a PID. We need to prevent the NaCl loader's PID
// from being reused before DebugActiveProcess() is called, and
// holding a process handle open achieves this.
- if (!base::OpenProcessHandleWithAccess(
- nacl_pid,
- base::kProcessAccessQueryInformation |
- base::kProcessAccessSuspendResume |
- base::kProcessAccessTerminate |
- base::kProcessAccessVMOperation |
- base::kProcessAccessVMRead |
- base::kProcessAccessVMWrite |
- base::kProcessAccessDuplicateHandle |
- base::kProcessAccessWaitForTermination,
- &temp_handle)) {
+ base::Process process =
+ base::Process::OpenWithAccess(nacl_pid,
+ PROCESS_QUERY_INFORMATION |
+ PROCESS_SUSPEND_RESUME |
+ PROCESS_TERMINATE |
+ PROCESS_VM_OPERATION |
+ PROCESS_VM_READ |
+ PROCESS_VM_WRITE |
+ PROCESS_DUP_HANDLE |
+ SYNCHRONIZE);
+ if (!process.IsValid()) {
LOG(ERROR) << "Failed to get process handle";
return false;
}
- base::win::ScopedHandle process_handle(temp_handle);
attach_debug_exception_handler_reply_msg_.reset(reply_msg);
// If the NaCl loader is 64-bit, the process running its debug
@@ -1175,11 +1173,11 @@ bool NaClProcessHost::AttachDebugExceptionHandler(const std::string& info,
// the 32-bit browser process to run the debug exception handler.
if (RunningOnWOW64()) {
return NaClBrokerService::GetInstance()->LaunchDebugExceptionHandler(
- weak_factory_.GetWeakPtr(), nacl_pid, process_handle.Get(),
+ weak_factory_.GetWeakPtr(), nacl_pid, process.Handle(),
info);
} else {
NaClStartDebugExceptionHandlerThread(
- process_handle.Take(), info,
+ process.Pass(), info,
base::MessageLoopProxy::current(),
base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
weak_factory_.GetWeakPtr()));

Powered by Google App Engine
This is Rietveld 408576698