| 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 <utility> |
| 11 |
| 10 #include "mojo/edk/embedder/platform_handle_vector.h" | 12 #include "mojo/edk/embedder/platform_handle_vector.h" |
| 11 #include "mojo/edk/system/data_pipe.h" | 13 #include "mojo/edk/system/data_pipe.h" |
| 12 #include "mojo/edk/system/handle_signals_state.h" | 14 #include "mojo/edk/system/handle_signals_state.h" |
| 13 #include "mojo/edk/system/memory.h" | 15 #include "mojo/edk/system/memory.h" |
| 14 #include "mojo/edk/system/system_impl_export.h" | 16 #include "mojo/edk/system/system_impl_export.h" |
| 15 #include "mojo/edk/system/thread_annotations.h" | 17 #include "mojo/edk/system/thread_annotations.h" |
| 16 #include "mojo/public/c/system/data_pipe.h" | 18 #include "mojo/public/c/system/data_pipe.h" |
| 17 #include "mojo/public/c/system/macros.h" | 19 #include "mojo/public/c/system/macros.h" |
| 18 #include "mojo/public/c/system/types.h" | 20 #include "mojo/public/c/system/types.h" |
| 19 | 21 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 115 |
| 114 // Helper to convert the given circular buffer into messages. The input is a | 116 // Helper to convert the given circular buffer into messages. The input is a |
| 115 // circular buffer |buffer| (with appropriate element size and capacity), with | 117 // circular buffer |buffer| (with appropriate element size and capacity), with |
| 116 // current contents starting at |start_index| of length |current_num_bytes|. | 118 // current contents starting at |start_index| of length |current_num_bytes|. |
| 117 // This will convert all of the contents. | 119 // This will convert all of the contents. |
| 118 void ConvertDataToMessages(const char* buffer, | 120 void ConvertDataToMessages(const char* buffer, |
| 119 size_t* start_index, | 121 size_t* start_index, |
| 120 size_t* current_num_bytes, | 122 size_t* current_num_bytes, |
| 121 MessageInTransitQueue* message_queue); | 123 MessageInTransitQueue* message_queue); |
| 122 | 124 |
| 123 scoped_ptr<DataPipeImpl> ReplaceImpl(scoped_ptr<DataPipeImpl> new_impl) | 125 std::unique_ptr<DataPipeImpl> ReplaceImpl( |
| 124 MOJO_NO_THREAD_SAFETY_ANALYSIS { | 126 std::unique_ptr<DataPipeImpl> new_impl) MOJO_NO_THREAD_SAFETY_ANALYSIS { |
| 125 return owner_->ReplaceImplNoLock(new_impl.Pass()); | 127 return owner_->ReplaceImplNoLock(std::move(new_impl)); |
| 126 } | 128 } |
| 127 void SetProducerClosed() MOJO_NO_THREAD_SAFETY_ANALYSIS { | 129 void SetProducerClosed() MOJO_NO_THREAD_SAFETY_ANALYSIS { |
| 128 owner_->SetProducerClosedNoLock(); | 130 owner_->SetProducerClosedNoLock(); |
| 129 } | 131 } |
| 130 void SetConsumerClosed() MOJO_NO_THREAD_SAFETY_ANALYSIS { | 132 void SetConsumerClosed() MOJO_NO_THREAD_SAFETY_ANALYSIS { |
| 131 owner_->SetConsumerClosedNoLock(); | 133 owner_->SetConsumerClosedNoLock(); |
| 132 } | 134 } |
| 133 | 135 |
| 134 ChannelEndpointClient* channel_endpoint_client() const { return owner_; } | 136 ChannelEndpointClient* channel_endpoint_client() const { return owner_; } |
| 135 | 137 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 struct MOJO_ALIGNAS(8) SerializedDataPipeConsumerDispatcher { | 195 struct MOJO_ALIGNAS(8) SerializedDataPipeConsumerDispatcher { |
| 194 // Only validated (and thus canonicalized) options should be serialized. | 196 // Only validated (and thus canonicalized) options should be serialized. |
| 195 // However, the deserializer must revalidate (as with everything received). | 197 // However, the deserializer must revalidate (as with everything received). |
| 196 MojoCreateDataPipeOptions validated_options; | 198 MojoCreateDataPipeOptions validated_options; |
| 197 }; | 199 }; |
| 198 | 200 |
| 199 } // namespace system | 201 } // namespace system |
| 200 } // namespace mojo | 202 } // namespace mojo |
| 201 | 203 |
| 202 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ | 204 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ |
| OLD | NEW |