| 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_ipc_adapter.h" | 5 #include "chrome/nacl/nacl_ipc_adapter.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 cond_var_.Signal(); | 274 cond_var_.Signal(); |
| 275 | 275 |
| 276 task_runner_->PostTask(FROM_HERE, | 276 task_runner_->PostTask(FROM_HERE, |
| 277 base::Bind(&NaClIPCAdapter::CloseChannelOnIOThread, this)); | 277 base::Bind(&NaClIPCAdapter::CloseChannelOnIOThread, this)); |
| 278 } | 278 } |
| 279 | 279 |
| 280 NaClDesc* NaClIPCAdapter::MakeNaClDesc() { | 280 NaClDesc* NaClIPCAdapter::MakeNaClDesc() { |
| 281 return MakeNaClDescCustom(this); | 281 return MakeNaClDescCustom(this); |
| 282 } | 282 } |
| 283 | 283 |
| 284 #if defined(OS_POSIX) |
| 285 int NaClIPCAdapter::TakeClientFileDescriptor() { |
| 286 return io_thread_data_.channel_->TakeClientFileDescriptor(); |
| 287 } |
| 288 #endif |
| 289 |
| 284 bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& message) { | 290 bool NaClIPCAdapter::OnMessageReceived(const IPC::Message& message) { |
| 285 { | 291 { |
| 286 base::AutoLock lock(lock_); | 292 base::AutoLock lock(lock_); |
| 287 | 293 |
| 288 // There is some padding in this structure (the "padding" member is 16 | 294 // There is some padding in this structure (the "padding" member is 16 |
| 289 // bits but this then gets padded to 32 bits). We want to be sure not to | 295 // bits but this then gets padded to 32 bits). We want to be sure not to |
| 290 // leak data to the untrusted plugin, so zero everything out first. | 296 // leak data to the untrusted plugin, so zero everything out first. |
| 291 NaClMessageHeader header; | 297 NaClMessageHeader header; |
| 292 memset(&header, 0, sizeof(NaClMessageHeader)); | 298 memset(&header, 0, sizeof(NaClMessageHeader)); |
| 293 | 299 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 NOTREACHED(); | 399 NOTREACHED(); |
| 394 } | 400 } |
| 395 | 401 |
| 396 void NaClIPCAdapter::CloseChannelOnIOThread() { | 402 void NaClIPCAdapter::CloseChannelOnIOThread() { |
| 397 io_thread_data_.channel_->Close(); | 403 io_thread_data_.channel_->Close(); |
| 398 } | 404 } |
| 399 | 405 |
| 400 void NaClIPCAdapter::SendMessageOnIOThread(scoped_ptr<IPC::Message> message) { | 406 void NaClIPCAdapter::SendMessageOnIOThread(scoped_ptr<IPC::Message> message) { |
| 401 io_thread_data_.channel_->Send(message.release()); | 407 io_thread_data_.channel_->Send(message.release()); |
| 402 } | 408 } |
| OLD | NEW |