OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/nacl/loader/nacl_ipc_adapter.h" | 5 #include "components/nacl/loader/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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 322 |
323 NaClIPCAdapter::IOThreadData::~IOThreadData() { | 323 NaClIPCAdapter::IOThreadData::~IOThreadData() { |
324 } | 324 } |
325 | 325 |
326 NaClIPCAdapter::NaClIPCAdapter(const IPC::ChannelHandle& handle, | 326 NaClIPCAdapter::NaClIPCAdapter(const IPC::ChannelHandle& handle, |
327 base::TaskRunner* runner) | 327 base::TaskRunner* runner) |
328 : lock_(), | 328 : lock_(), |
329 cond_var_(&lock_), | 329 cond_var_(&lock_), |
330 task_runner_(runner), | 330 task_runner_(runner), |
331 locked_data_() { | 331 locked_data_() { |
332 io_thread_data_.channel_ = IPC::Channel::CreateServer(handle, this); | 332 io_thread_data_.channel_.reset( |
| 333 new IPC::Channel(handle, IPC::Channel::MODE_SERVER, this)); |
333 // Note, we can not PostTask for ConnectChannelOnIOThread here. If we did, | 334 // Note, we can not PostTask for ConnectChannelOnIOThread here. If we did, |
334 // and that task ran before this constructor completes, the reference count | 335 // and that task ran before this constructor completes, the reference count |
335 // would go to 1 and then to 0 because of the Task, before we've been returned | 336 // would go to 1 and then to 0 because of the Task, before we've been returned |
336 // to the owning scoped_refptr, which is supposed to give us our first | 337 // to the owning scoped_refptr, which is supposed to give us our first |
337 // ref-count. | 338 // ref-count. |
338 } | 339 } |
339 | 340 |
340 NaClIPCAdapter::NaClIPCAdapter(scoped_ptr<IPC::Channel> channel, | 341 NaClIPCAdapter::NaClIPCAdapter(scoped_ptr<IPC::Channel> channel, |
341 base::TaskRunner* runner) | 342 base::TaskRunner* runner) |
342 : lock_(), | 343 : lock_(), |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 header.flags = msg.flags(); | 665 header.flags = msg.flags(); |
665 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); | 666 header.num_fds = static_cast<int>(rewritten_msg->desc_count()); |
666 | 667 |
667 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); | 668 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); |
668 locked_data_.to_be_received_.push(rewritten_msg); | 669 locked_data_.to_be_received_.push(rewritten_msg); |
669 } | 670 } |
670 | 671 |
671 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { | 672 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { |
672 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); | 673 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); |
673 } | 674 } |
OLD | NEW |