| 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 "base/atomicops.h" | 7 #include "base/atomicops.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "chrome/common/notification_service.h" | 9 #include "chrome/common/notification_service.h" |
| 10 #include "chrome/common/nacl_messages.h" | 10 #include "chrome/common/nacl_messages.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 void NaClThread::OnControlMessageReceived(const IPC::Message& msg) { | 78 void NaClThread::OnControlMessageReceived(const IPC::Message& msg) { |
| 79 IPC_BEGIN_MESSAGE_MAP(NaClThread, msg) | 79 IPC_BEGIN_MESSAGE_MAP(NaClThread, msg) |
| 80 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnStartSelLdr) | 80 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnStartSelLdr) |
| 81 IPC_END_MESSAGE_MAP() | 81 IPC_END_MESSAGE_MAP() |
| 82 } | 82 } |
| 83 | 83 |
| 84 void NaClThread::OnStartSelLdr(std::vector<nacl::FileDescriptor> handles) { | 84 void NaClThread::OnStartSelLdr(std::vector<nacl::FileDescriptor> handles) { |
| 85 #if defined(OS_LINUX) | 85 #if defined(OS_LINUX) |
| 86 nacl::SetCreateMemoryObjectFunc( | 86 nacl::SetCreateMemoryObjectFunc( |
| 87 renderer_sandbox_support::MakeSharedMemorySegmentViaIPCExecutable); | 87 renderer_sandbox_support::MakeSharedMemorySegmentViaIPC); |
| 88 #elif defined(OS_MACOSX) | 88 #elif defined(OS_MACOSX) |
| 89 nacl::SetCreateMemoryObjectFunc(CreateMemoryObject); | 89 nacl::SetCreateMemoryObjectFunc(CreateMemoryObject); |
| 90 CHECK(handles.size() >= 1); | 90 CHECK(handles.size() >= 1); |
| 91 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); | 91 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); |
| 92 handles.pop_back(); | 92 handles.pop_back(); |
| 93 #endif | 93 #endif |
| 94 scoped_array<NaClHandle> array(new NaClHandle[handles.size()]); | 94 scoped_array<NaClHandle> array(new NaClHandle[handles.size()]); |
| 95 for (size_t i = 0; i < handles.size(); i++) { | 95 for (size_t i = 0; i < handles.size(); i++) { |
| 96 array[i] = nacl::ToNativeHandle(handles[i]); | 96 array[i] = nacl::ToNativeHandle(handles[i]); |
| 97 } | 97 } |
| 98 NaClMainForChromium(static_cast<int>(handles.size()), array.get(), | 98 NaClMainForChromium(static_cast<int>(handles.size()), array.get(), |
| 99 debug_enabled_); | 99 debug_enabled_); |
| 100 } | 100 } |
| OLD | NEW |