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 <memory> | 10 #include <memory> |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 NaClIPCAdapter::LockedData::~LockedData() { | 336 NaClIPCAdapter::LockedData::~LockedData() { |
337 } | 337 } |
338 | 338 |
339 NaClIPCAdapter::IOThreadData::IOThreadData() { | 339 NaClIPCAdapter::IOThreadData::IOThreadData() { |
340 } | 340 } |
341 | 341 |
342 NaClIPCAdapter::IOThreadData::~IOThreadData() { | 342 NaClIPCAdapter::IOThreadData::~IOThreadData() { |
343 } | 343 } |
344 | 344 |
345 NaClIPCAdapter::NaClIPCAdapter(const IPC::ChannelHandle& handle, | 345 NaClIPCAdapter::NaClIPCAdapter( |
346 base::TaskRunner* runner, | 346 const IPC::ChannelHandle& handle, |
347 ResolveFileTokenCallback resolve_file_token_cb, | 347 const scoped_refptr<base::SingleThreadTaskRunner>& runner, |
348 OpenResourceCallback open_resource_cb) | 348 ResolveFileTokenCallback resolve_file_token_cb, |
| 349 OpenResourceCallback open_resource_cb) |
349 : lock_(), | 350 : lock_(), |
350 cond_var_(&lock_), | 351 cond_var_(&lock_), |
351 task_runner_(runner), | 352 task_runner_(runner), |
352 resolve_file_token_cb_(resolve_file_token_cb), | 353 resolve_file_token_cb_(resolve_file_token_cb), |
353 open_resource_cb_(open_resource_cb), | 354 open_resource_cb_(open_resource_cb), |
354 locked_data_() { | 355 locked_data_() { |
355 io_thread_data_.channel_ = IPC::Channel::CreateServer(handle, this); | 356 io_thread_data_.channel_ = IPC::Channel::CreateServer(handle, this, runner); |
356 // Note, we can not PostTask for ConnectChannelOnIOThread here. If we did, | 357 // Note, we can not PostTask for ConnectChannelOnIOThread here. If we did, |
357 // and that task ran before this constructor completes, the reference count | 358 // and that task ran before this constructor completes, the reference count |
358 // would go to 1 and then to 0 because of the Task, before we've been returned | 359 // would go to 1 and then to 0 because of the Task, before we've been returned |
359 // to the owning scoped_refptr, which is supposed to give us our first | 360 // to the owning scoped_refptr, which is supposed to give us our first |
360 // ref-count. | 361 // ref-count. |
361 } | 362 } |
362 | 363 |
363 NaClIPCAdapter::NaClIPCAdapter(std::unique_ptr<IPC::Channel> channel, | 364 NaClIPCAdapter::NaClIPCAdapter(std::unique_ptr<IPC::Channel> channel, |
364 base::TaskRunner* runner) | 365 base::TaskRunner* runner) |
365 : lock_(), cond_var_(&lock_), task_runner_(runner), locked_data_() { | 366 : lock_(), cond_var_(&lock_), task_runner_(runner), locked_data_() { |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 header.flags = msg.flags(); | 848 header.flags = msg.flags(); |
848 header.num_fds = static_cast<uint16_t>(rewritten_msg->desc_count()); | 849 header.num_fds = static_cast<uint16_t>(rewritten_msg->desc_count()); |
849 | 850 |
850 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); | 851 rewritten_msg->SetData(header, msg.payload(), msg.payload_size()); |
851 locked_data_.to_be_received_.push(rewritten_msg); | 852 locked_data_.to_be_received_.push(rewritten_msg); |
852 } | 853 } |
853 | 854 |
854 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { | 855 int TranslatePepperFileReadWriteOpenFlagsForTesting(int32_t pp_open_flags) { |
855 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); | 856 return TranslatePepperFileReadWriteOpenFlags(pp_open_flags); |
856 } | 857 } |
OLD | NEW |