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 <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // http://code.google.com/p/nativeclient/issues/detail?id=2131 | 172 // http://code.google.com/p/nativeclient/issues/detail?id=2131 |
173 const SIZE_T kNaClSandboxSize = 1 << 30; | 173 const SIZE_T kNaClSandboxSize = 1 << 30; |
174 if (!nacl::AllocateAddressSpaceASLR(process, kNaClSandboxSize)) { | 174 if (!nacl::AllocateAddressSpaceASLR(process, kNaClSandboxSize)) { |
175 DLOG(WARNING) << "Failed to reserve address space for Native Client"; | 175 DLOG(WARNING) << "Failed to reserve address space for Native Client"; |
176 } | 176 } |
177 } | 177 } |
178 #elif defined(OS_POSIX) | 178 #elif defined(OS_POSIX) |
179 virtual bool ShouldUseZygote() override { | 179 virtual bool ShouldUseZygote() override { |
180 return true; | 180 return true; |
181 } | 181 } |
182 virtual int GetIpcFd() override { | 182 virtual base::ScopedFD TakeIpcFd() override { |
183 return ipc_fd_; | 183 return ipc_fd_.Pass(); |
184 } | 184 } |
185 #endif // OS_WIN | 185 #endif // OS_WIN |
186 | 186 |
187 private: | 187 private: |
188 #if defined(OS_POSIX) | 188 #if defined(OS_POSIX) |
189 int ipc_fd_; | 189 base::ScopedFD ipc_fd_; |
190 #endif // OS_POSIX | 190 #endif // OS_POSIX |
191 }; | 191 }; |
192 | 192 |
193 void SetCloseOnExec(NaClHandle fd) { | 193 void SetCloseOnExec(NaClHandle fd) { |
194 #if defined(OS_POSIX) | 194 #if defined(OS_POSIX) |
195 int flags = fcntl(fd, F_GETFD); | 195 int flags = fcntl(fd, F_GETFD); |
196 CHECK_NE(flags, -1); | 196 CHECK_NE(flags, -1); |
197 int rc = fcntl(fd, F_SETFD, flags | FD_CLOEXEC); | 197 int rc = fcntl(fd, F_SETFD, flags | FD_CLOEXEC); |
198 CHECK_EQ(rc, 0); | 198 CHECK_EQ(rc, 0); |
199 #endif | 199 #endif |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 process_handle.Take(), info, | 1194 process_handle.Take(), info, |
1195 base::MessageLoopProxy::current(), | 1195 base::MessageLoopProxy::current(), |
1196 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, | 1196 base::Bind(&NaClProcessHost::OnDebugExceptionHandlerLaunchedByBroker, |
1197 weak_factory_.GetWeakPtr())); | 1197 weak_factory_.GetWeakPtr())); |
1198 return true; | 1198 return true; |
1199 } | 1199 } |
1200 } | 1200 } |
1201 #endif | 1201 #endif |
1202 | 1202 |
1203 } // namespace nacl | 1203 } // namespace nacl |
OLD | NEW |