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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 data_pipe_producer_handle.Put(handle_pair.first); | 434 data_pipe_producer_handle.Put(handle_pair.first); |
435 data_pipe_consumer_handle.Put(handle_pair.second); | 435 data_pipe_consumer_handle.Put(handle_pair.second); |
436 return MOJO_RESULT_OK; | 436 return MOJO_RESULT_OK; |
437 } | 437 } |
438 | 438 |
439 MojoResult Core::SetDataPipeProducerOptions( | 439 MojoResult Core::SetDataPipeProducerOptions( |
440 MojoHandle data_pipe_producer_handle, | 440 MojoHandle data_pipe_producer_handle, |
441 UserPointer<const MojoDataPipeProducerOptions> options) { | 441 UserPointer<const MojoDataPipeProducerOptions> options) { |
442 RefPtr<Dispatcher> dispatcher; | 442 RefPtr<Dispatcher> dispatcher; |
443 MojoResult result = GetDispatcherAndCheckRights( | 443 MojoResult result = GetDispatcherAndCheckRights( |
444 data_pipe_producer_handle, MOJO_HANDLE_RIGHT_WRITE, | 444 data_pipe_producer_handle, MOJO_HANDLE_RIGHT_SET_OPTIONS, |
445 EntrypointClass::DATA_PIPE_PRODUCER, &dispatcher); | 445 EntrypointClass::DATA_PIPE_PRODUCER, &dispatcher); |
446 if (result != MOJO_RESULT_OK) | 446 if (result != MOJO_RESULT_OK) |
447 return result; | 447 return result; |
448 | 448 |
449 return dispatcher->SetDataPipeProducerOptions(options); | 449 return dispatcher->SetDataPipeProducerOptions(options); |
450 } | 450 } |
451 | 451 |
452 MojoResult Core::GetDataPipeProducerOptions( | 452 MojoResult Core::GetDataPipeProducerOptions( |
453 MojoHandle data_pipe_producer_handle, | 453 MojoHandle data_pipe_producer_handle, |
454 UserPointer<MojoDataPipeProducerOptions> options, | 454 UserPointer<MojoDataPipeProducerOptions> options, |
455 uint32_t options_num_bytes) { | 455 uint32_t options_num_bytes) { |
456 RefPtr<Dispatcher> dispatcher; | 456 RefPtr<Dispatcher> dispatcher; |
457 MojoResult result = GetDispatcherAndCheckRights( | 457 MojoResult result = GetDispatcherAndCheckRights( |
458 data_pipe_producer_handle, MOJO_HANDLE_RIGHT_READ, | 458 data_pipe_producer_handle, MOJO_HANDLE_RIGHT_GET_OPTIONS, |
459 EntrypointClass::DATA_PIPE_PRODUCER, &dispatcher); | 459 EntrypointClass::DATA_PIPE_PRODUCER, &dispatcher); |
460 if (result != MOJO_RESULT_OK) | 460 if (result != MOJO_RESULT_OK) |
461 return result; | 461 return result; |
462 | 462 |
463 return dispatcher->GetDataPipeProducerOptions(options, options_num_bytes); | 463 return dispatcher->GetDataPipeProducerOptions(options, options_num_bytes); |
464 } | 464 } |
465 | 465 |
466 MojoResult Core::WriteData(MojoHandle data_pipe_producer_handle, | 466 MojoResult Core::WriteData(MojoHandle data_pipe_producer_handle, |
467 UserPointer<const void> elements, | 467 UserPointer<const void> elements, |
468 UserPointer<uint32_t> num_bytes, | 468 UserPointer<uint32_t> num_bytes, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 return result; | 501 return result; |
502 | 502 |
503 return dispatcher->EndWriteData(num_bytes_written); | 503 return dispatcher->EndWriteData(num_bytes_written); |
504 } | 504 } |
505 | 505 |
506 MojoResult Core::SetDataPipeConsumerOptions( | 506 MojoResult Core::SetDataPipeConsumerOptions( |
507 MojoHandle data_pipe_consumer_handle, | 507 MojoHandle data_pipe_consumer_handle, |
508 UserPointer<const MojoDataPipeConsumerOptions> options) { | 508 UserPointer<const MojoDataPipeConsumerOptions> options) { |
509 RefPtr<Dispatcher> dispatcher; | 509 RefPtr<Dispatcher> dispatcher; |
510 MojoResult result = GetDispatcherAndCheckRights( | 510 MojoResult result = GetDispatcherAndCheckRights( |
511 data_pipe_consumer_handle, MOJO_HANDLE_RIGHT_WRITE, | 511 data_pipe_consumer_handle, MOJO_HANDLE_RIGHT_SET_OPTIONS, |
512 EntrypointClass::DATA_PIPE_CONSUMER, &dispatcher); | 512 EntrypointClass::DATA_PIPE_CONSUMER, &dispatcher); |
513 if (result != MOJO_RESULT_OK) | 513 if (result != MOJO_RESULT_OK) |
514 return result; | 514 return result; |
515 | 515 |
516 return dispatcher->SetDataPipeConsumerOptions(options); | 516 return dispatcher->SetDataPipeConsumerOptions(options); |
517 } | 517 } |
518 | 518 |
519 MojoResult Core::GetDataPipeConsumerOptions( | 519 MojoResult Core::GetDataPipeConsumerOptions( |
520 MojoHandle data_pipe_consumer_handle, | 520 MojoHandle data_pipe_consumer_handle, |
521 UserPointer<MojoDataPipeConsumerOptions> options, | 521 UserPointer<MojoDataPipeConsumerOptions> options, |
522 uint32_t options_num_bytes) { | 522 uint32_t options_num_bytes) { |
523 RefPtr<Dispatcher> dispatcher; | 523 RefPtr<Dispatcher> dispatcher; |
524 MojoResult result = GetDispatcherAndCheckRights( | 524 MojoResult result = GetDispatcherAndCheckRights( |
525 data_pipe_consumer_handle, MOJO_HANDLE_RIGHT_READ, | 525 data_pipe_consumer_handle, MOJO_HANDLE_RIGHT_GET_OPTIONS, |
526 EntrypointClass::DATA_PIPE_CONSUMER, &dispatcher); | 526 EntrypointClass::DATA_PIPE_CONSUMER, &dispatcher); |
527 if (result != MOJO_RESULT_OK) | 527 if (result != MOJO_RESULT_OK) |
528 return result; | 528 return result; |
529 | 529 |
530 return dispatcher->GetDataPipeConsumerOptions(options, options_num_bytes); | 530 return dispatcher->GetDataPipeConsumerOptions(options, options_num_bytes); |
531 } | 531 } |
532 | 532 |
533 MojoResult Core::ReadData(MojoHandle data_pipe_consumer_handle, | 533 MojoResult Core::ReadData(MojoHandle data_pipe_consumer_handle, |
534 UserPointer<void> elements, | 534 UserPointer<void> elements, |
535 UserPointer<uint32_t> num_bytes, | 535 UserPointer<uint32_t> num_bytes, |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 if (signals_states) { | 748 if (signals_states) { |
749 for (; i < num_handles; i++) | 749 for (; i < num_handles; i++) |
750 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); | 750 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); |
751 } | 751 } |
752 | 752 |
753 return result; | 753 return result; |
754 } | 754 } |
755 | 755 |
756 } // namespace system | 756 } // namespace system |
757 } // namespace mojo | 757 } // namespace mojo |
OLD | NEW |