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

Side by Side Diff: components/nacl/browser/nacl_process_host.cc

Issue 92173002: Merge 237541 "Revert of https://codereview.chromium.org/71013004/" (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1721/src/
Patch Set: Created 7 years 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
« no previous file with comments | « cloud_print/virtual_driver/win/install/setup.cc ('k') | content/common/sandbox_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/nacl/browser/nacl_process_host.h" 5 #include "components/nacl/browser/nacl_process_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 return false; 970 return false;
971 } 971 }
972 if (debug_exception_handler_requested_) { 972 if (debug_exception_handler_requested_) {
973 // The NaCl process should not request this multiple times. 973 // The NaCl process should not request this multiple times.
974 DLOG(ERROR) << "Multiple AttachDebugExceptionHandler requests received"; 974 DLOG(ERROR) << "Multiple AttachDebugExceptionHandler requests received";
975 return false; 975 return false;
976 } 976 }
977 debug_exception_handler_requested_ = true; 977 debug_exception_handler_requested_ = true;
978 978
979 base::ProcessId nacl_pid = base::GetProcId(process_->GetData().handle); 979 base::ProcessId nacl_pid = base::GetProcId(process_->GetData().handle);
980 base::ProcessHandle temp_handle; 980 base::win::ScopedHandle process_handle;
981 // We cannot use process_->GetData().handle because it does not have 981 // We cannot use process_->GetData().handle because it does not have
982 // the necessary access rights. We open the new handle here rather 982 // the necessary access rights. We open the new handle here rather
983 // than in the NaCl broker process in case the NaCl loader process 983 // than in the NaCl broker process in case the NaCl loader process
984 // dies before the NaCl broker process receives the message we send. 984 // dies before the NaCl broker process receives the message we send.
985 // The debug exception handler uses DebugActiveProcess() to attach, 985 // The debug exception handler uses DebugActiveProcess() to attach,
986 // but this takes a PID. We need to prevent the NaCl loader's PID 986 // but this takes a PID. We need to prevent the NaCl loader's PID
987 // from being reused before DebugActiveProcess() is called, and 987 // from being reused before DebugActiveProcess() is called, and
988 // holding a process handle open achieves this. 988 // holding a process handle open achieves this.
989 if (!base::OpenProcessHandleWithAccess( 989 if (!base::OpenProcessHandleWithAccess(
990 nacl_pid, 990 nacl_pid,
991 base::kProcessAccessQueryInformation | 991 base::kProcessAccessQueryInformation |
992 base::kProcessAccessSuspendResume | 992 base::kProcessAccessSuspendResume |
993 base::kProcessAccessTerminate | 993 base::kProcessAccessTerminate |
994 base::kProcessAccessVMOperation | 994 base::kProcessAccessVMOperation |
995 base::kProcessAccessVMRead | 995 base::kProcessAccessVMRead |
996 base::kProcessAccessVMWrite | 996 base::kProcessAccessVMWrite |
997 base::kProcessAccessDuplicateHandle | 997 base::kProcessAccessDuplicateHandle |
998 base::kProcessAccessWaitForTermination, 998 base::kProcessAccessWaitForTermination,
999 &temp_handle)) { 999 process_handle.Receive())) {
1000 LOG(ERROR) << "Failed to get process handle"; 1000 LOG(ERROR) << "Failed to get process handle";
1001 return false; 1001 return false;
1002 } 1002 }
1003 base::win::ScopedHandle process_handle(temp_handle);
1004 1003
1005 attach_debug_exception_handler_reply_msg_.reset(reply_msg); 1004 attach_debug_exception_handler_reply_msg_.reset(reply_msg);
1006 // If the NaCl loader is 64-bit, the process running its debug 1005 // If the NaCl loader is 64-bit, the process running its debug
1007 // exception handler must be 64-bit too, so we use the 64-bit NaCl 1006 // exception handler must be 64-bit too, so we use the 64-bit NaCl
1008 // broker process for this. Otherwise, on a 32-bit system, we use 1007 // broker process for this. Otherwise, on a 32-bit system, we use
1009 // the 32-bit browser process to run the debug exception handler. 1008 // the 32-bit browser process to run the debug exception handler.
1010 if (RunningOnWOW64()) { 1009 if (RunningOnWOW64()) {
1011 return NaClBrokerService::GetInstance()->LaunchDebugExceptionHandler( 1010 return NaClBrokerService::GetInstance()->LaunchDebugExceptionHandler(
1012 weak_factory_.GetWeakPtr(), nacl_pid, process_handle, info); 1011 weak_factory_.GetWeakPtr(), nacl_pid, process_handle, info);
1013 } else { 1012 } else {
1014 NaClStartDebugExceptionHandlerThread( 1013 NaClStartDebugExceptionHandlerThread(
1015 process_handle.Take(), info, 1014 process_handle.Take(), info,
1016 base::MessageLoopProxy::current(), 1015 base::MessageLoopProxy::current(),
1017 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, 1016 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker,
1018 weak_factory_.GetWeakPtr())); 1017 weak_factory_.GetWeakPtr()));
1019 return true; 1018 return true;
1020 } 1019 }
1021 } 1020 }
1022 #endif 1021 #endif
1023 1022
1024 } // namespace nacl 1023 } // namespace nacl
OLDNEW
« no previous file with comments | « cloud_print/virtual_driver/win/install/setup.cc ('k') | content/common/sandbox_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698