Chromium Code Reviews| 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 // from .dll loading. The NaCl process will attempt to locate this space by | 174 // from .dll loading. The NaCl process will attempt to locate this space by |
| 175 // scanning the address space using VirtualQuery. | 175 // scanning the address space using VirtualQuery. |
| 176 // TODO(bbudge) Handle the --no-sandbox case. | 176 // TODO(bbudge) Handle the --no-sandbox case. |
| 177 // http://code.google.com/p/nativeclient/issues/detail?id=2131 | 177 // http://code.google.com/p/nativeclient/issues/detail?id=2131 |
| 178 const SIZE_T kNaClSandboxSize = 1 << 30; | 178 const SIZE_T kNaClSandboxSize = 1 << 30; |
| 179 if (!nacl::AllocateAddressSpaceASLR(process, kNaClSandboxSize)) { | 179 if (!nacl::AllocateAddressSpaceASLR(process, kNaClSandboxSize)) { |
| 180 DLOG(WARNING) << "Failed to reserve address space for Native Client"; | 180 DLOG(WARNING) << "Failed to reserve address space for Native Client"; |
| 181 } | 181 } |
| 182 } | 182 } |
| 183 #elif defined(OS_POSIX) | 183 #elif defined(OS_POSIX) |
| 184 bool ShouldUseZygote() override { return true; } | 184 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 185 content::ZygoteHandle* GetZygote() override { | |
| 186 static content::ZygoteHandle zygote; | |
|
Mark Seaborn
2016/01/11 22:42:39
Does this mean the zygote process is launched on d
mdempsky
2016/01/11 22:50:28
Yes. I'm not convinced that's a problem per se (s
| |
| 187 return &zygote; | |
| 188 } | |
| 189 #endif // !defined(OS_MACOSX) && !defined(OS_ANDROID) | |
| 190 | |
| 185 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } | 191 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } |
| 186 #endif // OS_WIN | 192 #endif // OS_WIN |
| 187 | 193 |
| 188 private: | 194 private: |
| 189 #if defined(OS_POSIX) | 195 #if defined(OS_POSIX) |
| 190 base::ScopedFD ipc_fd_; | 196 base::ScopedFD ipc_fd_; |
| 191 #endif // OS_POSIX | 197 #endif // OS_POSIX |
| 192 }; | 198 }; |
| 193 | 199 |
| 194 void SetCloseOnExec(NaClHandle fd) { | 200 void SetCloseOnExec(NaClHandle fd) { |
| (...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1373 NaClStartDebugExceptionHandlerThread( | 1379 NaClStartDebugExceptionHandlerThread( |
| 1374 process.Pass(), info, base::ThreadTaskRunnerHandle::Get(), | 1380 process.Pass(), info, base::ThreadTaskRunnerHandle::Get(), |
| 1375 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1381 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
| 1376 weak_factory_.GetWeakPtr())); | 1382 weak_factory_.GetWeakPtr())); |
| 1377 return true; | 1383 return true; |
| 1378 } | 1384 } |
| 1379 } | 1385 } |
| 1380 #endif | 1386 #endif |
| 1381 | 1387 |
| 1382 } // namespace nacl | 1388 } // namespace nacl |
| OLD | NEW |