OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SHARED_BUFFER_DISPATCHER_H_ | 5 #ifndef MOJO_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ |
6 #define MOJO_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ | 6 #define MOJO_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "mojo/system/raw_shared_buffer.h" | 9 #include "mojo/system/raw_shared_buffer.h" |
10 #include "mojo/system/simple_dispatcher.h" | 10 #include "mojo/system/simple_dispatcher.h" |
11 #include "mojo/system/system_impl_export.h" | 11 #include "mojo/system/system_impl_export.h" |
12 | 12 |
13 namespace mojo { | 13 namespace mojo { |
14 namespace system { | 14 namespace system { |
15 | 15 |
16 // TODO(vtl): We derive from SimpleDispatcher, even though we don't currently | 16 // TODO(vtl): We derive from SimpleDispatcher, even though we don't currently |
17 // have anything that's waitable. I want to add a "transferrable" wait flag. | 17 // have anything that's waitable. I want to add a "transferrable" wait flag. |
18 class MOJO_SYSTEM_IMPL_EXPORT SharedBufferDispatcher : public SimpleDispatcher { | 18 class MOJO_SYSTEM_IMPL_EXPORT SharedBufferDispatcher : public SimpleDispatcher { |
19 public: | 19 public: |
| 20 // The default options to use for |MojoCreateSharedBuffer()|. (Real uses |
| 21 // should obtain this via |ValidateCreateOptions()| with a null |in_options|; |
| 22 // this is exposed directly for testing convenience.) |
| 23 static const MojoCreateSharedBufferOptions kDefaultCreateOptions; |
| 24 |
20 // Validates and/or sets default options for |MojoCreateSharedBufferOptions|. | 25 // Validates and/or sets default options for |MojoCreateSharedBufferOptions|. |
21 // If non-null, |in_options| must point to a struct of at least | 26 // If non-null, |in_options| must point to a struct of at least |
22 // |in_options->struct_size| bytes. |out_options| must point to a (current) | 27 // |in_options->struct_size| bytes. |out_options| must point to a (current) |
23 // |MojoCreateSharedBufferOptions| and will be entirely overwritten on success | 28 // |MojoCreateSharedBufferOptions| and will be entirely overwritten on success |
24 // (it may be partly overwritten on failure). | 29 // (it may be partly overwritten on failure). |
25 static MojoResult ValidateCreateOptions( | 30 static MojoResult ValidateCreateOptions( |
26 const MojoCreateSharedBufferOptions* in_options, | 31 const MojoCreateSharedBufferOptions* in_options, |
27 MojoCreateSharedBufferOptions* out_options); | 32 MojoCreateSharedBufferOptions* out_options); |
28 | 33 |
29 // Static factory method: |validated_options| must be validated (obviously). | 34 // Static factory method: |validated_options| must be validated (obviously). |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 90 |
86 scoped_refptr<RawSharedBuffer> shared_buffer_; | 91 scoped_refptr<RawSharedBuffer> shared_buffer_; |
87 | 92 |
88 DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher); | 93 DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher); |
89 }; | 94 }; |
90 | 95 |
91 } // namespace system | 96 } // namespace system |
92 } // namespace mojo | 97 } // namespace mojo |
93 | 98 |
94 #endif // MOJO_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ | 99 #endif // MOJO_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ |
OLD | NEW |