OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/nacl/nacl_thread.h" | 5 #include "chrome/nacl/nacl_thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
11 #include "chrome/common/nacl_messages.h" | 11 #include "chrome/common/nacl_messages.h" |
12 #include "native_client/src/shared/imc/nacl_imc.h" | 12 #include "native_client/src/shared/imc/nacl_imc.h" |
13 | 13 |
14 #if defined(OS_LINUX) | 14 #if defined(OS_LINUX) |
15 #include "chrome/renderer/renderer_sandbox_support_linux.h" | 15 #include "content/renderer/renderer_sandbox_support_linux.h" |
16 #endif | 16 #endif |
17 | 17 |
18 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
19 namespace { | 19 namespace { |
20 | 20 |
21 // On Mac OS X, shm_open() works in the sandbox but does not give us | 21 // On Mac OS X, shm_open() works in the sandbox but does not give us |
22 // an FD that we can map as PROT_EXEC. Rather than doing an IPC to | 22 // an FD that we can map as PROT_EXEC. Rather than doing an IPC to |
23 // get an executable SHM region when CreateMemoryObject() is called, | 23 // get an executable SHM region when CreateMemoryObject() is called, |
24 // we preallocate one on startup, since NaCl's sel_ldr only needs one | 24 // we preallocate one on startup, since NaCl's sel_ldr only needs one |
25 // of them. This saves a round trip. | 25 // of them. This saves a round trip. |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); | 95 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); |
96 handles.pop_back(); | 96 handles.pop_back(); |
97 #endif | 97 #endif |
98 scoped_array<NaClHandle> array(new NaClHandle[handles.size()]); | 98 scoped_array<NaClHandle> array(new NaClHandle[handles.size()]); |
99 for (size_t i = 0; i < handles.size(); i++) { | 99 for (size_t i = 0; i < handles.size(); i++) { |
100 array[i] = nacl::ToNativeHandle(handles[i]); | 100 array[i] = nacl::ToNativeHandle(handles[i]); |
101 } | 101 } |
102 NaClMainForChromium(static_cast<int>(handles.size()), array.get(), | 102 NaClMainForChromium(static_cast<int>(handles.size()), array.get(), |
103 debug_enabled_); | 103 debug_enabled_); |
104 } | 104 } |
OLD | NEW |