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 "chrome/nacl/nacl_listener.h" | 5 #include "chrome/nacl/nacl_listener.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
14 #include "base/rand_util_c.h" | 14 #include "base/rand_util.h" |
15 #include "chrome/common/nacl_messages.h" | 15 #include "chrome/common/nacl_messages.h" |
16 #include "chrome/nacl/nacl_validation_db.h" | 16 #include "chrome/nacl/nacl_validation_db.h" |
17 #include "chrome/nacl/nacl_validation_query.h" | 17 #include "chrome/nacl/nacl_validation_query.h" |
18 #include "ipc/ipc_sync_channel.h" | 18 #include "ipc/ipc_sync_channel.h" |
19 #include "ipc/ipc_sync_message_filter.h" | 19 #include "ipc/ipc_sync_message_filter.h" |
20 #include "ipc/ipc_switches.h" | 20 #include "ipc/ipc_switches.h" |
21 #include "native_client/src/trusted/service_runtime/sel_main_chrome.h" | 21 #include "native_client/src/trusted/service_runtime/sel_main_chrome.h" |
22 | 22 |
23 #if defined(OS_LINUX) | 23 #if defined(OS_LINUX) |
24 #include "content/public/common/child_process_sandbox_support_linux.h" | 24 #include "content/public/common/child_process_sandbox_support_linux.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 void NaClListener::OnMsgStart(const nacl::NaClStartParams& params) { | 185 void NaClListener::OnMsgStart(const nacl::NaClStartParams& params) { |
186 struct NaClChromeMainArgs *args = NaClChromeMainArgsCreate(); | 186 struct NaClChromeMainArgs *args = NaClChromeMainArgsCreate(); |
187 if (args == NULL) { | 187 if (args == NULL) { |
188 LOG(ERROR) << "NaClChromeMainArgsCreate() failed"; | 188 LOG(ERROR) << "NaClChromeMainArgsCreate() failed"; |
189 return; | 189 return; |
190 } | 190 } |
191 | 191 |
192 std::vector<nacl::FileDescriptor> handles = params.handles; | 192 std::vector<nacl::FileDescriptor> handles = params.handles; |
193 | 193 |
194 #if defined(OS_LINUX) || defined(OS_MACOSX) | 194 #if defined(OS_LINUX) || defined(OS_MACOSX) |
195 args->urandom_fd = dup(GetUrandomFD()); | 195 args->urandom_fd = dup(base::GetUrandomFD()); |
196 if (args->urandom_fd < 0) { | 196 if (args->urandom_fd < 0) { |
197 LOG(ERROR) << "Failed to dup() the urandom FD"; | 197 LOG(ERROR) << "Failed to dup() the urandom FD"; |
198 return; | 198 return; |
199 } | 199 } |
200 args->create_memory_object_func = CreateMemoryObject; | 200 args->create_memory_object_func = CreateMemoryObject; |
201 # if defined(OS_MACOSX) | 201 # if defined(OS_MACOSX) |
202 CHECK(handles.size() >= 1); | 202 CHECK(handles.size() >= 1); |
203 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); | 203 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); |
204 handles.pop_back(); | 204 handles.pop_back(); |
205 # endif | 205 # endif |
(...skipping 28 matching lines...) Expand all Loading... |
234 args->imc_bootstrap_handle = nacl::ToNativeHandle(handles[0]); | 234 args->imc_bootstrap_handle = nacl::ToNativeHandle(handles[0]); |
235 args->enable_exception_handling = params.enable_exception_handling; | 235 args->enable_exception_handling = params.enable_exception_handling; |
236 args->enable_debug_stub = debug_enabled_; | 236 args->enable_debug_stub = debug_enabled_; |
237 #if defined(OS_WIN) | 237 #if defined(OS_WIN) |
238 args->broker_duplicate_handle_func = BrokerDuplicateHandle; | 238 args->broker_duplicate_handle_func = BrokerDuplicateHandle; |
239 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; | 239 args->attach_debug_exception_handler_func = AttachDebugExceptionHandler; |
240 #endif | 240 #endif |
241 NaClChromeMainStart(args); | 241 NaClChromeMainStart(args); |
242 NOTREACHED(); | 242 NOTREACHED(); |
243 } | 243 } |
OLD | NEW |