| 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 "mojo/edk/system/core.h" | 5 #include "mojo/edk/system/core.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 398 |
| 399 auto data_pipe = DataPipe::CreateLocal(validated_options); | 399 auto data_pipe = DataPipe::CreateLocal(validated_options); |
| 400 producer_dispatcher->Init(data_pipe.Clone()); | 400 producer_dispatcher->Init(data_pipe.Clone()); |
| 401 consumer_dispatcher->Init(std::move(data_pipe)); | 401 consumer_dispatcher->Init(std::move(data_pipe)); |
| 402 | 402 |
| 403 data_pipe_producer_handle.Put(handle_pair.first); | 403 data_pipe_producer_handle.Put(handle_pair.first); |
| 404 data_pipe_consumer_handle.Put(handle_pair.second); | 404 data_pipe_consumer_handle.Put(handle_pair.second); |
| 405 return MOJO_RESULT_OK; | 405 return MOJO_RESULT_OK; |
| 406 } | 406 } |
| 407 | 407 |
| 408 MojoResult Core::SetDataPipeProducerOptions( |
| 409 MojoHandle data_pipe_producer_handle, |
| 410 UserPointer<const MojoDataPipeProducerOptions> options) { |
| 411 RefPtr<Dispatcher> dispatcher; |
| 412 MojoResult result = GetDispatcher(data_pipe_producer_handle, &dispatcher); |
| 413 if (result != MOJO_RESULT_OK) |
| 414 return result; |
| 415 |
| 416 return dispatcher->SetDataPipeProducerOptions(options); |
| 417 } |
| 418 |
| 419 MojoResult Core::GetDataPipeProducerOptions( |
| 420 MojoHandle data_pipe_producer_handle, |
| 421 UserPointer<MojoDataPipeProducerOptions> options, |
| 422 uint32_t options_num_bytes) { |
| 423 RefPtr<Dispatcher> dispatcher; |
| 424 MojoResult result = GetDispatcher(data_pipe_producer_handle, &dispatcher); |
| 425 if (result != MOJO_RESULT_OK) |
| 426 return result; |
| 427 |
| 428 return dispatcher->GetDataPipeProducerOptions(options, options_num_bytes); |
| 429 } |
| 430 |
| 408 MojoResult Core::WriteData(MojoHandle data_pipe_producer_handle, | 431 MojoResult Core::WriteData(MojoHandle data_pipe_producer_handle, |
| 409 UserPointer<const void> elements, | 432 UserPointer<const void> elements, |
| 410 UserPointer<uint32_t> num_bytes, | 433 UserPointer<uint32_t> num_bytes, |
| 411 MojoWriteDataFlags flags) { | 434 MojoWriteDataFlags flags) { |
| 412 RefPtr<Dispatcher> dispatcher; | 435 RefPtr<Dispatcher> dispatcher; |
| 413 MojoResult result = GetDispatcher(data_pipe_producer_handle, &dispatcher); | 436 MojoResult result = GetDispatcher(data_pipe_producer_handle, &dispatcher); |
| 414 if (result != MOJO_RESULT_OK) | 437 if (result != MOJO_RESULT_OK) |
| 415 return result; | 438 return result; |
| 416 | 439 |
| 417 return dispatcher->WriteData(elements, num_bytes, flags); | 440 return dispatcher->WriteData(elements, num_bytes, flags); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 if (signals_states) { | 682 if (signals_states) { |
| 660 for (; i < num_handles; i++) | 683 for (; i < num_handles; i++) |
| 661 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); | 684 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); |
| 662 } | 685 } |
| 663 | 686 |
| 664 return result; | 687 return result; |
| 665 } | 688 } |
| 666 | 689 |
| 667 } // namespace system | 690 } // namespace system |
| 668 } // namespace mojo | 691 } // namespace mojo |
| OLD | NEW |