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> | 10 #include <utility> |
11 | 11 |
12 #include "mojo/edk/embedder/platform_handle_vector.h" | 12 #include "mojo/edk/embedder/platform_handle_vector.h" |
13 #include "mojo/edk/system/data_pipe.h" | 13 #include "mojo/edk/system/data_pipe.h" |
14 #include "mojo/edk/system/handle_signals_state.h" | 14 #include "mojo/edk/system/handle_signals_state.h" |
15 #include "mojo/edk/system/memory.h" | 15 #include "mojo/edk/system/memory.h" |
16 #include "mojo/edk/system/system_impl_export.h" | |
17 #include "mojo/edk/system/thread_annotations.h" | 16 #include "mojo/edk/system/thread_annotations.h" |
18 #include "mojo/public/c/system/data_pipe.h" | 17 #include "mojo/public/c/system/data_pipe.h" |
19 #include "mojo/public/c/system/macros.h" | 18 #include "mojo/public/c/system/macros.h" |
20 #include "mojo/public/c/system/types.h" | 19 #include "mojo/public/c/system/types.h" |
21 | 20 |
22 namespace mojo { | 21 namespace mojo { |
23 namespace system { | 22 namespace system { |
24 | 23 |
25 class Channel; | 24 class Channel; |
26 class MessageInTransit; | 25 class MessageInTransit; |
(...skipping 16 matching lines...) Expand all Loading... |
43 // required to hold |mutex_| since |impl_| marked as being guarded by it) and by | 42 // required to hold |mutex_| since |impl_| marked as being guarded by it) and by |
44 // |DataPipeImpl| and subclasses' methods (which are all transitively under | 43 // |DataPipeImpl| and subclasses' methods (which are all transitively under |
45 // |mutex_|, having originated from a call from |DataPipe|), we choose to turn | 44 // |mutex_|, having originated from a call from |DataPipe|), we choose to turn |
46 // off thread-safety analysis for our methods, which are trivial (they just | 45 // off thread-safety analysis for our methods, which are trivial (they just |
47 // thunk to |owner_|), rather than turn off thread-safety analysis for | 46 // thunk to |owner_|), rather than turn off thread-safety analysis for |
48 // |DataPipe|'s methods, which aren't. | 47 // |DataPipe|'s methods, which aren't. |
49 | 48 |
50 // Note that subclasses do not have access to the owning |DataPipe| (except as a | 49 // Note that subclasses do not have access to the owning |DataPipe| (except as a |
51 // |ChannelEndpointClient|), so that their methods should never need | 50 // |ChannelEndpointClient|), so that their methods should never need |
52 // |MOJO_NO_THREAD_SAFETY_ANALYSIS| annotations. | 51 // |MOJO_NO_THREAD_SAFETY_ANALYSIS| annotations. |
53 class MOJO_SYSTEM_IMPL_EXPORT DataPipeImpl { | 52 class DataPipeImpl { |
54 public: | 53 public: |
55 virtual ~DataPipeImpl() {} | 54 virtual ~DataPipeImpl() {} |
56 | 55 |
57 // This is only called by |DataPipe| during its construction. | 56 // This is only called by |DataPipe| during its construction. |
58 void set_owner(DataPipe* owner) { owner_ = owner; } | 57 void set_owner(DataPipe* owner) { owner_ = owner; } |
59 | 58 |
60 virtual void ProducerClose() = 0; | 59 virtual void ProducerClose() = 0; |
61 // |num_bytes.Get()| will be a nonzero multiple of |element_num_bytes()|. | 60 // |num_bytes.Get()| will be a nonzero multiple of |element_num_bytes()|. |
62 virtual MojoResult ProducerWriteData(UserPointer<const void> elements, | 61 virtual MojoResult ProducerWriteData(UserPointer<const void> elements, |
63 UserPointer<uint32_t> num_bytes, | 62 UserPointer<uint32_t> num_bytes, |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 struct MOJO_ALIGNAS(8) SerializedDataPipeConsumerDispatcher { | 194 struct MOJO_ALIGNAS(8) SerializedDataPipeConsumerDispatcher { |
196 // Only validated (and thus canonicalized) options should be serialized. | 195 // Only validated (and thus canonicalized) options should be serialized. |
197 // However, the deserializer must revalidate (as with everything received). | 196 // However, the deserializer must revalidate (as with everything received). |
198 MojoCreateDataPipeOptions validated_options; | 197 MojoCreateDataPipeOptions validated_options; |
199 }; | 198 }; |
200 | 199 |
201 } // namespace system | 200 } // namespace system |
202 } // namespace mojo | 201 } // namespace mojo |
203 | 202 |
204 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ | 203 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_IMPL_H_ |
OLD | NEW |