| 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' | 31 // The default options for |MojoCreateDataPipe()|. (Real uses should obtain |
| 32 // constructors). (Real uses should obtain this via |ValidateCreateOptions()| | 32 // this via |ValidateCreateOptions()| with a null |in_options|; this is |
| 33 // with a null |in_options|; this is exposed directly for testing | 33 // exposed directly for testing convenience.) |
| 34 // convenience.) | |
| 35 static const MojoCreateDataPipeOptions kDefaultCreateOptions; | 34 static const MojoCreateDataPipeOptions kDefaultCreateOptions; |
| 36 | 35 |
| 37 // Validates and/or sets default options for |MojoCreateDataPipeOptions|. If | 36 // Validates and/or sets default options for |MojoCreateDataPipeOptions|. If |
| 38 // non-null, |in_options| must point to a struct of at least | 37 // non-null, |in_options| must point to a struct of at least |
| 39 // |in_options->struct_size| bytes. |out_options| must point to a (current) | 38 // |in_options->struct_size| bytes. |out_options| must point to a (current) |
| 40 // |MojoCreateDataPipeOptions| and will be entirely overwritten on success (it | 39 // |MojoCreateDataPipeOptions| and will be entirely overwritten on success (it |
| 41 // may be partly overwritten on failure). | 40 // may be partly overwritten on failure). |
| 42 static MojoResult ValidateCreateOptions( | 41 static MojoResult ValidateCreateOptions( |
| 43 const MojoCreateDataPipeOptions* in_options, | 42 const MojoCreateDataPipeOptions* in_options, |
| 44 MojoCreateDataPipeOptions* out_options); | 43 MojoCreateDataPipeOptions* out_options); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 uint32_t producer_two_phase_max_num_bytes_written_; | 193 uint32_t producer_two_phase_max_num_bytes_written_; |
| 195 uint32_t consumer_two_phase_max_num_bytes_read_; | 194 uint32_t consumer_two_phase_max_num_bytes_read_; |
| 196 | 195 |
| 197 DISALLOW_COPY_AND_ASSIGN(DataPipe); | 196 DISALLOW_COPY_AND_ASSIGN(DataPipe); |
| 198 }; | 197 }; |
| 199 | 198 |
| 200 } // namespace system | 199 } // namespace system |
| 201 } // namespace mojo | 200 } // namespace mojo |
| 202 | 201 |
| 203 #endif // MOJO_SYSTEM_DATA_PIPE_H_ | 202 #endif // MOJO_SYSTEM_DATA_PIPE_H_ |
| OLD | NEW |