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_SYSTEM_DATA_PIPE_H_ | 5 #ifndef MOJO_SYSTEM_DATA_PIPE_H_ |
6 #define MOJO_SYSTEM_DATA_PIPE_H_ | 6 #define MOJO_SYSTEM_DATA_PIPE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 // |DataPipe| is a base class for secondary objects implementing data pipes, | 22 // |DataPipe| is a base class for secondary objects implementing data pipes, |
23 // similar to |MessagePipe| (see the explanatory comment in core.cc). It is | 23 // similar to |MessagePipe| (see the explanatory comment in core.cc). It is |
24 // typically owned by the dispatcher(s) corresponding to the local endpoints. | 24 // typically owned by the dispatcher(s) corresponding to the local endpoints. |
25 // Its subclasses implement the three cases: local producer and consumer, local | 25 // Its subclasses implement the three cases: local producer and consumer, local |
26 // producer and remote consumer, and remote producer and local consumer. This | 26 // producer and remote consumer, and remote producer and local consumer. This |
27 // class is thread-safe. | 27 // class is thread-safe. |
28 class MOJO_SYSTEM_IMPL_EXPORT DataPipe : | 28 class MOJO_SYSTEM_IMPL_EXPORT DataPipe : |
29 public base::RefCountedThreadSafe<DataPipe> { | 29 public base::RefCountedThreadSafe<DataPipe> { |
30 public: | 30 public: |
| 31 // The default options to use for the constructor (and subclasses' |
| 32 // constructors). (Real uses should obtain this via |ValidateCreateOptions()| |
| 33 // with a null |in_options|; this is exposed directly for testing |
| 34 // convenience.) |
| 35 static const MojoCreateDataPipeOptions kDefaultCreateOptions; |
| 36 |
31 // Validates and/or sets default options for |MojoCreateDataPipeOptions|. If | 37 // Validates and/or sets default options for |MojoCreateDataPipeOptions|. If |
32 // non-null, |in_options| must point to a struct of at least | 38 // non-null, |in_options| must point to a struct of at least |
33 // |in_options->struct_size| bytes. |out_options| must point to a (current) | 39 // |in_options->struct_size| bytes. |out_options| must point to a (current) |
34 // |MojoCreateDataPipeOptions| and will be entirely overwritten on success (it | 40 // |MojoCreateDataPipeOptions| and will be entirely overwritten on success (it |
35 // may be partly overwritten on failure). | 41 // may be partly overwritten on failure). |
36 static MojoResult ValidateCreateOptions( | 42 static MojoResult ValidateCreateOptions( |
37 const MojoCreateDataPipeOptions* in_options, | 43 const MojoCreateDataPipeOptions* in_options, |
38 MojoCreateDataPipeOptions* out_options); | 44 MojoCreateDataPipeOptions* out_options); |
39 | 45 |
40 // These are called by the producer dispatcher to implement its methods of | 46 // These are called by the producer dispatcher to implement its methods of |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 uint32_t producer_two_phase_max_num_bytes_written_; | 194 uint32_t producer_two_phase_max_num_bytes_written_; |
189 uint32_t consumer_two_phase_max_num_bytes_read_; | 195 uint32_t consumer_two_phase_max_num_bytes_read_; |
190 | 196 |
191 DISALLOW_COPY_AND_ASSIGN(DataPipe); | 197 DISALLOW_COPY_AND_ASSIGN(DataPipe); |
192 }; | 198 }; |
193 | 199 |
194 } // namespace system | 200 } // namespace system |
195 } // namespace mojo | 201 } // namespace mojo |
196 | 202 |
197 #endif // MOJO_SYSTEM_DATA_PIPE_H_ | 203 #endif // MOJO_SYSTEM_DATA_PIPE_H_ |
OLD | NEW |