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" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 debug_enabled_ = debug ? 1 : 0; | 69 debug_enabled_ = debug ? 1 : 0; |
70 } | 70 } |
71 | 71 |
72 NaClThread::~NaClThread() { | 72 NaClThread::~NaClThread() { |
73 } | 73 } |
74 | 74 |
75 NaClThread* NaClThread::current() { | 75 NaClThread* NaClThread::current() { |
76 return static_cast<NaClThread*>(ChildThread::current()); | 76 return static_cast<NaClThread*>(ChildThread::current()); |
77 } | 77 } |
78 | 78 |
79 void NaClThread::OnControlMessageReceived(const IPC::Message& msg) { | 79 bool NaClThread::OnControlMessageReceived(const IPC::Message& msg) { |
| 80 bool handled = true; |
80 IPC_BEGIN_MESSAGE_MAP(NaClThread, msg) | 81 IPC_BEGIN_MESSAGE_MAP(NaClThread, msg) |
81 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnStartSelLdr) | 82 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnStartSelLdr) |
| 83 IPC_MESSAGE_UNHANDLED(handled = false) |
82 IPC_END_MESSAGE_MAP() | 84 IPC_END_MESSAGE_MAP() |
| 85 return handled; |
83 } | 86 } |
84 | 87 |
85 void NaClThread::OnStartSelLdr(std::vector<nacl::FileDescriptor> handles) { | 88 void NaClThread::OnStartSelLdr(std::vector<nacl::FileDescriptor> handles) { |
86 #if defined(OS_LINUX) | 89 #if defined(OS_LINUX) |
87 nacl::SetCreateMemoryObjectFunc( | 90 nacl::SetCreateMemoryObjectFunc( |
88 renderer_sandbox_support::MakeSharedMemorySegmentViaIPC); | 91 renderer_sandbox_support::MakeSharedMemorySegmentViaIPC); |
89 #elif defined(OS_MACOSX) | 92 #elif defined(OS_MACOSX) |
90 nacl::SetCreateMemoryObjectFunc(CreateMemoryObject); | 93 nacl::SetCreateMemoryObjectFunc(CreateMemoryObject); |
91 CHECK(handles.size() >= 1); | 94 CHECK(handles.size() >= 1); |
92 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); | 95 g_shm_fd = nacl::ToNativeHandle(handles[handles.size() - 1]); |
93 handles.pop_back(); | 96 handles.pop_back(); |
94 #endif | 97 #endif |
95 scoped_array<NaClHandle> array(new NaClHandle[handles.size()]); | 98 scoped_array<NaClHandle> array(new NaClHandle[handles.size()]); |
96 for (size_t i = 0; i < handles.size(); i++) { | 99 for (size_t i = 0; i < handles.size(); i++) { |
97 array[i] = nacl::ToNativeHandle(handles[i]); | 100 array[i] = nacl::ToNativeHandle(handles[i]); |
98 } | 101 } |
99 NaClMainForChromium(static_cast<int>(handles.size()), array.get(), | 102 NaClMainForChromium(static_cast<int>(handles.size()), array.get(), |
100 debug_enabled_); | 103 debug_enabled_); |
101 } | 104 } |
OLD | NEW |