| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_launcher_thread.h" | 5 #include "chrome/nacl/nacl_launcher_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/memory/scoped_ptr.h" | 10 #include "base/memory/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 "content/renderer/renderer_sandbox_support_linux.h" | 15 #include "content/common/child_process_sandbox_support_linux.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
| 19 #include <fcntl.h> | 19 #include <fcntl.h> |
| 20 #include <io.h> | 20 #include <io.h> |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 #if defined(OS_MACOSX) | 23 #if defined(OS_MACOSX) |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 IPC_MESSAGE_UNHANDLED(handled = false) | 90 IPC_MESSAGE_UNHANDLED(handled = false) |
| 91 IPC_END_MESSAGE_MAP() | 91 IPC_END_MESSAGE_MAP() |
| 92 return handled; | 92 return handled; |
| 93 } | 93 } |
| 94 | 94 |
| 95 void NaClLauncherThread::OnStartSelLdr( | 95 void NaClLauncherThread::OnStartSelLdr( |
| 96 std::vector<nacl::FileDescriptor> handles, | 96 std::vector<nacl::FileDescriptor> handles, |
| 97 bool have_irt_file) { | 97 bool have_irt_file) { |
| 98 #if defined(OS_LINUX) | 98 #if defined(OS_LINUX) |
| 99 nacl::SetCreateMemoryObjectFunc( | 99 nacl::SetCreateMemoryObjectFunc( |
| 100 renderer_sandbox_support::MakeSharedMemorySegmentViaIPC); | 100 child_process_sandbox_support::MakeSharedMemorySegmentViaIPC); |
| 101 #elif defined(OS_MACOSX) | 101 #elif defined(OS_MACOSX) |
| 102 nacl::SetCreateMemoryObjectFunc(CreateMemoryObject); | 102 nacl::SetCreateMemoryObjectFunc(CreateMemoryObject); |
| 103 CHECK(handles.size() >= 1); | 103 CHECK(handles.size() >= 1); |
| 104 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); | 104 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); |
| 105 handles.pop_back(); | 105 handles.pop_back(); |
| 106 #endif | 106 #endif |
| 107 | 107 |
| 108 if (have_irt_file) { | 108 if (have_irt_file) { |
| 109 CHECK(handles.size() >= 1); | 109 CHECK(handles.size() >= 1); |
| 110 NaClHandle irt_handle = nacl::ToNativeHandle(handles[handles.size() - 1]); | 110 NaClHandle irt_handle = nacl::ToNativeHandle(handles[handles.size() - 1]); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 122 NaClSetIrtFileDesc(irt_desc); | 122 NaClSetIrtFileDesc(irt_desc); |
| 123 } | 123 } |
| 124 | 124 |
| 125 scoped_array<NaClHandle> array(new NaClHandle[handles.size()]); | 125 scoped_array<NaClHandle> array(new NaClHandle[handles.size()]); |
| 126 for (size_t i = 0; i < handles.size(); i++) { | 126 for (size_t i = 0; i < handles.size(); i++) { |
| 127 array[i] = nacl::ToNativeHandle(handles[i]); | 127 array[i] = nacl::ToNativeHandle(handles[i]); |
| 128 } | 128 } |
| 129 NaClMainForChromium(static_cast<int>(handles.size()), array.get(), | 129 NaClMainForChromium(static_cast<int>(handles.size()), array.get(), |
| 130 debug_enabled_); | 130 debug_enabled_); |
| 131 } | 131 } |
| OLD | NEW |