OLD | NEW |
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 "chrome/browser/nacl_host/nacl_process_host.h" | 5 #include "chrome/browser/nacl_host/nacl_process_host.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 process_launched_by_broker_(false), | 189 process_launched_by_broker_(false), |
190 #elif defined(OS_LINUX) | 190 #elif defined(OS_LINUX) |
191 wait_for_nacl_gdb_(false), | 191 wait_for_nacl_gdb_(false), |
192 #endif | 192 #endif |
193 reply_msg_(NULL), | 193 reply_msg_(NULL), |
194 #if defined(OS_WIN) | 194 #if defined(OS_WIN) |
195 debug_exception_handler_requested_(false), | 195 debug_exception_handler_requested_(false), |
196 #endif | 196 #endif |
197 internal_(new NaClInternal()), | 197 internal_(new NaClInternal()), |
198 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), | 198 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), |
199 enable_exception_handling_(false), | 199 enable_exception_handling_(true), |
200 enable_debug_stub_(false), | 200 enable_debug_stub_(false), |
201 uses_irt_(uses_irt), | 201 uses_irt_(uses_irt), |
202 off_the_record_(off_the_record), | 202 off_the_record_(off_the_record), |
203 ALLOW_THIS_IN_INITIALIZER_LIST(ipc_plugin_listener_(this)), | 203 ALLOW_THIS_IN_INITIALIZER_LIST(ipc_plugin_listener_(this)), |
204 render_view_id_(render_view_id) { | 204 render_view_id_(render_view_id) { |
205 process_.reset(content::BrowserChildProcessHost::Create( | 205 process_.reset(content::BrowserChildProcessHost::Create( |
206 PROCESS_TYPE_NACL_LOADER, this)); | 206 PROCESS_TYPE_NACL_LOADER, this)); |
207 | 207 |
208 // Set the display name so the user knows what plugin the process is running. | 208 // Set the display name so the user knows what plugin the process is running. |
209 // We aren't on the UI thread so getting the pref locale for language | 209 // We aren't on the UI thread so getting the pref locale for language |
210 // formatting isn't possible, so IDN will be lost, but this is probably OK | 210 // formatting isn't possible, so IDN will be lost, but this is probably OK |
211 // for this use case. | 211 // for this use case. |
212 process_->SetName(net::FormatUrl(manifest_url_, std::string())); | 212 process_->SetName(net::FormatUrl(manifest_url_, std::string())); |
213 | 213 |
214 // We allow untrusted hardware exception handling to be enabled via | |
215 // an env var for consistency with the standalone build of NaCl. | |
216 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
217 switches::kEnableNaClExceptionHandling) || | |
218 getenv("NACL_UNTRUSTED_EXCEPTION_HANDLING") != NULL) { | |
219 enable_exception_handling_ = true; | |
220 } | |
221 enable_debug_stub_ = CommandLine::ForCurrentProcess()->HasSwitch( | 214 enable_debug_stub_ = CommandLine::ForCurrentProcess()->HasSwitch( |
222 switches::kEnableNaClDebug); | 215 switches::kEnableNaClDebug); |
223 } | 216 } |
224 | 217 |
225 NaClProcessHost::~NaClProcessHost() { | 218 NaClProcessHost::~NaClProcessHost() { |
226 int exit_code; | 219 int exit_code; |
227 process_->GetTerminationStatus(&exit_code); | 220 process_->GetTerminationStatus(&exit_code); |
228 std::string message = | 221 std::string message = |
229 base::StringPrintf("NaCl process exited with status %i (0x%x)", | 222 base::StringPrintf("NaCl process exited with status %i (0x%x)", |
230 exit_code, exit_code); | 223 exit_code, exit_code); |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 } else { | 964 } else { |
972 NaClStartDebugExceptionHandlerThread( | 965 NaClStartDebugExceptionHandlerThread( |
973 process_handle.Take(), info, | 966 process_handle.Take(), info, |
974 base::MessageLoopProxy::current(), | 967 base::MessageLoopProxy::current(), |
975 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 968 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
976 weak_factory_.GetWeakPtr())); | 969 weak_factory_.GetWeakPtr())); |
977 return true; | 970 return true; |
978 } | 971 } |
979 } | 972 } |
980 #endif | 973 #endif |
OLD | NEW |