| 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 "components/nacl/browser/nacl_process_host.h" | 5 #include "components/nacl/browser/nacl_process_host.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 return (base::win::OSInfo::GetInstance()->wow64_status() == | 152 return (base::win::OSInfo::GetInstance()->wow64_status() == |
| 153 base::win::OSInfo::WOW64_ENABLED); | 153 base::win::OSInfo::WOW64_ENABLED); |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace | 156 } // namespace |
| 157 | 157 |
| 158 #endif // defined(OS_WIN) | 158 #endif // defined(OS_WIN) |
| 159 | 159 |
| 160 namespace { | 160 namespace { |
| 161 | 161 |
| 162 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
| 163 content::ZygoteHandle g_nacl_zygote; | |
| 164 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | |
| 165 | |
| 166 // NOTE: changes to this class need to be reviewed by the security team. | 162 // NOTE: changes to this class need to be reviewed by the security team. |
| 167 class NaClSandboxedProcessLauncherDelegate | 163 class NaClSandboxedProcessLauncherDelegate |
| 168 : public content::SandboxedProcessLauncherDelegate { | 164 : public content::SandboxedProcessLauncherDelegate { |
| 169 public: | 165 public: |
| 170 NaClSandboxedProcessLauncherDelegate() {} | 166 NaClSandboxedProcessLauncherDelegate() {} |
| 171 | 167 |
| 172 ~NaClSandboxedProcessLauncherDelegate() override {} | 168 ~NaClSandboxedProcessLauncherDelegate() override {} |
| 173 | 169 |
| 174 #if defined(OS_WIN) | 170 #if defined(OS_WIN) |
| 175 void PostSpawnTarget(base::ProcessHandle process) override { | 171 void PostSpawnTarget(base::ProcessHandle process) override { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 326 cmd->GetSwitchValueASCII(switches::kNaClDebugMask); | 322 cmd->GetSwitchValueASCII(switches::kNaClDebugMask); |
| 327 // By default, exclude debugging SSH and the PNaCl translator. | 323 // By default, exclude debugging SSH and the PNaCl translator. |
| 328 // about::flags only allows empty flags as the default, so replace | 324 // about::flags only allows empty flags as the default, so replace |
| 329 // the empty setting with the default. To debug all apps, use a wild-card. | 325 // the empty setting with the default. To debug all apps, use a wild-card. |
| 330 if (nacl_debug_mask.empty()) { | 326 if (nacl_debug_mask.empty()) { |
| 331 nacl_debug_mask = "!*://*/*ssh_client.nmf,chrome://pnacl-translator/*"; | 327 nacl_debug_mask = "!*://*/*ssh_client.nmf,chrome://pnacl-translator/*"; |
| 332 } | 328 } |
| 333 NaClBrowser::GetDelegate()->SetDebugPatterns(nacl_debug_mask); | 329 NaClBrowser::GetDelegate()->SetDebugPatterns(nacl_debug_mask); |
| 334 } | 330 } |
| 335 | 331 |
| 336 #if defined(OS_POSIX) && !defined(OS_MACOSX) | |
| 337 // static | |
| 338 void NaClProcessHost::EarlyZygoteLaunch() { | |
| 339 DCHECK(!g_nacl_zygote); | |
| 340 g_nacl_zygote = content::CreateZygote(); | |
| 341 } | |
| 342 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) | |
| 343 | |
| 344 void NaClProcessHost::Launch( | 332 void NaClProcessHost::Launch( |
| 345 NaClHostMessageFilter* nacl_host_message_filter, | 333 NaClHostMessageFilter* nacl_host_message_filter, |
| 346 IPC::Message* reply_msg, | 334 IPC::Message* reply_msg, |
| 347 const base::FilePath& manifest_path) { | 335 const base::FilePath& manifest_path) { |
| 348 nacl_host_message_filter_ = nacl_host_message_filter; | 336 nacl_host_message_filter_ = nacl_host_message_filter; |
| 349 reply_msg_ = reply_msg; | 337 reply_msg_ = reply_msg; |
| 350 manifest_path_ = manifest_path; | 338 manifest_path_ = manifest_path; |
| 351 | 339 |
| 352 // Do not launch the requested NaCl module if NaCl is marked "unstable" due | 340 // Do not launch the requested NaCl module if NaCl is marked "unstable" due |
| 353 // to too many crashes within a given time period. | 341 // to too many crashes within a given time period. |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1141 NaClStartDebugExceptionHandlerThread( | 1129 NaClStartDebugExceptionHandlerThread( |
| 1142 std::move(process), info, base::ThreadTaskRunnerHandle::Get(), | 1130 std::move(process), info, base::ThreadTaskRunnerHandle::Get(), |
| 1143 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1131 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 1144 weak_factory_.GetWeakPtr())); | 1132 weak_factory_.GetWeakPtr())); |
| 1145 return true; | 1133 return true; |
| 1146 } | 1134 } |
| 1147 } | 1135 } |
| 1148 #endif | 1136 #endif |
| 1149 | 1137 |
| 1150 } // namespace nacl | 1138 } // namespace nacl |
| OLD | NEW |