| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ | 5 #ifndef MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ |
| 6 #define MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ | 6 #define MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void* destination, | 83 void* destination, |
| 84 size_t* actual_size, | 84 size_t* actual_size, |
| 85 embedder::PlatformHandleVector* platform_handles) = 0; | 85 embedder::PlatformHandleVector* platform_handles) = 0; |
| 86 | 86 |
| 87 virtual bool OnReadMessage(unsigned port, MessageInTransit* message) = 0; | 87 virtual bool OnReadMessage(unsigned port, MessageInTransit* message) = 0; |
| 88 virtual void OnDetachFromChannel(unsigned port) = 0; | 88 virtual void OnDetachFromChannel(unsigned port) = 0; |
| 89 | 89 |
| 90 protected: | 90 protected: |
| 91 DataPipeImpl() : owner_() {} | 91 DataPipeImpl() : owner_() {} |
| 92 | 92 |
| 93 // Helper to convert the given circular buffer into messages. The input is a |
| 94 // circular buffer |buffer| (with appropriate element size and capacity), with |
| 95 // current contents starting at |start_index| of length |current_num_bytes|. |
| 96 // This will convert all of the contents. |
| 97 void ConvertDataToMessages(const char* buffer, |
| 98 size_t* start_index, |
| 99 size_t* current_num_bytes, |
| 100 MessageInTransitQueue* message_queue); |
| 101 |
| 93 DataPipe* owner() const { return owner_; } | 102 DataPipe* owner() const { return owner_; } |
| 94 | 103 |
| 95 const MojoCreateDataPipeOptions& validated_options() const { | 104 const MojoCreateDataPipeOptions& validated_options() const { |
| 96 return owner_->validated_options(); | 105 return owner_->validated_options(); |
| 97 } | 106 } |
| 98 size_t element_num_bytes() const { return owner_->element_num_bytes(); } | 107 size_t element_num_bytes() const { return owner_->element_num_bytes(); } |
| 99 size_t capacity_num_bytes() const { return owner_->capacity_num_bytes(); } | 108 size_t capacity_num_bytes() const { return owner_->capacity_num_bytes(); } |
| 100 bool producer_open() const { return owner_->producer_open_no_lock(); } | 109 bool producer_open() const { return owner_->producer_open_no_lock(); } |
| 101 bool consumer_open() const { return owner_->consumer_open_no_lock(); } | 110 bool consumer_open() const { return owner_->consumer_open_no_lock(); } |
| 102 uint32_t producer_two_phase_max_num_bytes_written() const { | 111 uint32_t producer_two_phase_max_num_bytes_written() const { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 struct ALIGNAS(8) SerializedDataPipeConsumerDispatcher { | 153 struct ALIGNAS(8) SerializedDataPipeConsumerDispatcher { |
| 145 // Only validated (and thus canonicalized) options should be serialized. | 154 // Only validated (and thus canonicalized) options should be serialized. |
| 146 // However, the deserializer must revalidate (as with everything received). | 155 // However, the deserializer must revalidate (as with everything received). |
| 147 MojoCreateDataPipeOptions validated_options; | 156 MojoCreateDataPipeOptions validated_options; |
| 148 }; | 157 }; |
| 149 | 158 |
| 150 } // namespace system | 159 } // namespace system |
| 151 } // namespace mojo | 160 } // namespace mojo |
| 152 | 161 |
| 153 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ | 162 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ |
| OLD | NEW |