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 #ifndef MOJO_EDK_SYSTEM_DATA_PIPE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_DATA_PIPE_H_ |
6 #define MOJO_EDK_SYSTEM_DATA_PIPE_H_ | 6 #define MOJO_EDK_SYSTEM_DATA_PIPE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "mojo/edk/embedder/platform_handle_vector.h" | 13 #include "mojo/edk/embedder/platform_handle_vector.h" |
14 #include "mojo/edk/system/channel_endpoint_client.h" | 14 #include "mojo/edk/system/channel_endpoint_client.h" |
15 #include "mojo/edk/system/handle_signals_state.h" | 15 #include "mojo/edk/system/handle_signals_state.h" |
16 #include "mojo/edk/system/memory.h" | 16 #include "mojo/edk/system/memory.h" |
17 #include "mojo/edk/system/mutex.h" | 17 #include "mojo/edk/system/mutex.h" |
18 #include "mojo/edk/system/system_impl_export.h" | |
19 #include "mojo/edk/system/thread_annotations.h" | 18 #include "mojo/edk/system/thread_annotations.h" |
20 #include "mojo/public/c/system/data_pipe.h" | 19 #include "mojo/public/c/system/data_pipe.h" |
21 #include "mojo/public/c/system/types.h" | 20 #include "mojo/public/c/system/types.h" |
22 #include "mojo/public/cpp/system/macros.h" | 21 #include "mojo/public/cpp/system/macros.h" |
23 | 22 |
24 namespace mojo { | 23 namespace mojo { |
25 namespace system { | 24 namespace system { |
26 | 25 |
27 class Awakable; | 26 class Awakable; |
28 class AwakableList; | 27 class AwakableList; |
29 class Channel; | 28 class Channel; |
30 class ChannelEndpoint; | 29 class ChannelEndpoint; |
31 class DataPipeImpl; | 30 class DataPipeImpl; |
32 class MessageInTransitQueue; | 31 class MessageInTransitQueue; |
33 | 32 |
34 // |DataPipe| is a base class for secondary objects implementing data pipes, | 33 // |DataPipe| is a base class for secondary objects implementing data pipes, |
35 // similar to |MessagePipe| (see the explanatory comment in core.cc). It is | 34 // similar to |MessagePipe| (see the explanatory comment in core.cc). It is |
36 // typically owned by the dispatcher(s) corresponding to the local endpoints. | 35 // typically owned by the dispatcher(s) corresponding to the local endpoints. |
37 // Its subclasses implement the three cases: local producer and consumer, local | 36 // Its subclasses implement the three cases: local producer and consumer, local |
38 // producer and remote consumer, and remote producer and local consumer. This | 37 // producer and remote consumer, and remote producer and local consumer. This |
39 // class is thread-safe. | 38 // class is thread-safe. |
40 class MOJO_SYSTEM_IMPL_EXPORT DataPipe final : public ChannelEndpointClient { | 39 class DataPipe final : public ChannelEndpointClient { |
41 public: | 40 public: |
42 // The default options for |MojoCreateDataPipe()|. (Real uses should obtain | 41 // The default options for |MojoCreateDataPipe()|. (Real uses should obtain |
43 // this via |ValidateCreateOptions()| with a null |in_options|; this is | 42 // this via |ValidateCreateOptions()| with a null |in_options|; this is |
44 // exposed directly for testing convenience.) | 43 // exposed directly for testing convenience.) |
45 static MojoCreateDataPipeOptions GetDefaultCreateOptions(); | 44 static MojoCreateDataPipeOptions GetDefaultCreateOptions(); |
46 | 45 |
47 // Validates and/or sets default options for |MojoCreateDataPipeOptions|. If | 46 // Validates and/or sets default options for |MojoCreateDataPipeOptions|. If |
48 // non-null, |in_options| must point to a struct of at least | 47 // non-null, |in_options| must point to a struct of at least |
49 // |in_options->struct_size| bytes. |out_options| must point to a (current) | 48 // |in_options->struct_size| bytes. |out_options| must point to a (current) |
50 // |MojoCreateDataPipeOptions| and will be entirely overwritten on success (it | 49 // |MojoCreateDataPipeOptions| and will be entirely overwritten on success (it |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 uint32_t consumer_two_phase_max_num_bytes_read_ MOJO_GUARDED_BY(mutex_); | 278 uint32_t consumer_two_phase_max_num_bytes_read_ MOJO_GUARDED_BY(mutex_); |
280 std::unique_ptr<DataPipeImpl> impl_ MOJO_GUARDED_BY(mutex_); | 279 std::unique_ptr<DataPipeImpl> impl_ MOJO_GUARDED_BY(mutex_); |
281 | 280 |
282 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipe); | 281 MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipe); |
283 }; | 282 }; |
284 | 283 |
285 } // namespace system | 284 } // namespace system |
286 } // namespace mojo | 285 } // namespace mojo |
287 | 286 |
288 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_ | 287 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_H_ |
OLD | NEW |