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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 317 |
318 NaClIPCAdapter::IOThreadData::IOThreadData() { | 318 NaClIPCAdapter::IOThreadData::IOThreadData() { |
319 } | 319 } |
320 | 320 |
321 NaClIPCAdapter::IOThreadData::~IOThreadData() { | 321 NaClIPCAdapter::IOThreadData::~IOThreadData() { |
322 } | 322 } |
323 | 323 |
324 NaClIPCAdapter::NaClIPCAdapter(const IPC::ChannelHandle& handle, | 324 NaClIPCAdapter::NaClIPCAdapter(const IPC::ChannelHandle& handle, |
325 base::TaskRunner* runner, | 325 base::TaskRunner* runner, |
326 ResolveFileTokenCallback resolve_file_token_cb, | 326 ResolveFileTokenCallback resolve_file_token_cb, |
327 OpenResourceCallback open_resource_cb) | 327 OpenResourceCallback open_resource_cb, |
| 328 IPC::AttachmentBroker* broker) |
328 : lock_(), | 329 : lock_(), |
329 cond_var_(&lock_), | 330 cond_var_(&lock_), |
330 task_runner_(runner), | 331 task_runner_(runner), |
331 resolve_file_token_cb_(resolve_file_token_cb), | 332 resolve_file_token_cb_(resolve_file_token_cb), |
332 open_resource_cb_(open_resource_cb), | 333 open_resource_cb_(open_resource_cb), |
333 locked_data_() { | 334 locked_data_() { |
334 io_thread_data_.channel_ = IPC::Channel::CreateServer(handle, this); | 335 io_thread_data_.channel_ = IPC::Channel::CreateServer(handle, this, broker); |
335 // Note, we can not PostTask for ConnectChannelOnIOThread here. If we did, | 336 // Note, we can not PostTask for ConnectChannelOnIOThread here. If we did, |
336 // and that task ran before this constructor completes, the reference count | 337 // and that task ran before this constructor completes, the reference count |
337 // would go to 1 and then to 0 because of the Task, before we've been returned | 338 // would go to 1 and then to 0 because of the Task, before we've been returned |
338 // to the owning scoped_refptr, which is supposed to give us our first | 339 // to the owning scoped_refptr, which is supposed to give us our first |
339 // ref-count. | 340 // ref-count. |
340 } | 341 } |
341 | 342 |
342 NaClIPCAdapter::NaClIPCAdapter(scoped_ptr<IPC::Channel> channel, | 343 NaClIPCAdapter::NaClIPCAdapter(scoped_ptr<IPC::Channel> channel, |
343 base::TaskRunner* runner) | 344 base::TaskRunner* runner) |
344 : lock_(), | 345 : lock_(), |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 header.flags = msg.flags(); | 827 header.flags = msg.flags(); |
827 header.num_fds = static_cast<uint16>(rewritten_msg->desc_count()); | 828 header.num_fds = static_cast<uint16>(rewritten_msg->desc_count()); |
828 | 829 |
829 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); | 830 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); |
830 locked_data_.to_be_received_.push(rewritten_msg); | 831 locked_data_.to_be_received_.push(rewritten_msg); |
831 } | 832 } |
832 | 833 |
833 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { | 834 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { |
834 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); | 835 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); |
835 } | 836 } |
OLD | NEW |