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_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ | 5 #ifndef MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ |
6 #define MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ | 6 #define MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "mojo/edk/system/memory.h" | 10 #include "mojo/edk/system/memory.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // TODO(vtl): We derive from SimpleDispatcher, even though we don't currently | 30 // TODO(vtl): We derive from SimpleDispatcher, even though we don't currently |
31 // have anything that's waitable. I want to add a "transferrable" wait flag | 31 // have anything that's waitable. I want to add a "transferrable" wait flag |
32 // (which would entail overriding |GetHandleSignalsStateImplNoLock()|, etc.). | 32 // (which would entail overriding |GetHandleSignalsStateImplNoLock()|, etc.). |
33 class SharedBufferDispatcher final : public SimpleDispatcher { | 33 class SharedBufferDispatcher final : public SimpleDispatcher { |
34 public: | 34 public: |
35 // The default/standard rights for a shared buffer handle. Note that they're | 35 // The default/standard rights for a shared buffer handle. Note that they're |
36 // duplicable by default. | 36 // duplicable by default. |
37 static constexpr MojoHandleRights kDefaultHandleRights = | 37 static constexpr MojoHandleRights kDefaultHandleRights = |
38 MOJO_HANDLE_RIGHT_DUPLICATE | MOJO_HANDLE_RIGHT_TRANSFER | | 38 MOJO_HANDLE_RIGHT_DUPLICATE | MOJO_HANDLE_RIGHT_TRANSFER | |
39 MOJO_HANDLE_RIGHT_READ | MOJO_HANDLE_RIGHT_WRITE | | 39 MOJO_HANDLE_RIGHT_READ | MOJO_HANDLE_RIGHT_WRITE; |
40 MOJO_HANDLE_RIGHT_EXECUTE; | |
41 | 40 |
42 // The default options to use for |MojoCreateSharedBuffer()|. (Real uses | 41 // The default options to use for |MojoCreateSharedBuffer()|. (Real uses |
43 // should obtain this via |ValidateCreateOptions()| with a null |in_options|; | 42 // should obtain this via |ValidateCreateOptions()| with a null |in_options|; |
44 // this is exposed directly for testing convenience.) | 43 // this is exposed directly for testing convenience.) |
45 static const MojoCreateSharedBufferOptions kDefaultCreateOptions; | 44 static const MojoCreateSharedBufferOptions kDefaultCreateOptions; |
46 | 45 |
47 // Validates and/or sets default options for |MojoCreateSharedBufferOptions|. | 46 // Validates and/or sets default options for |MojoCreateSharedBufferOptions|. |
48 // If non-null, |in_options| must point to a struct of at least | 47 // If 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 // |MojoCreateSharedBufferOptions| and will be entirely overwritten on success | 49 // |MojoCreateSharedBufferOptions| and will be entirely overwritten on success |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 util::RefPtr<platform::PlatformSharedBuffer> shared_buffer_ | 122 util::RefPtr<platform::PlatformSharedBuffer> shared_buffer_ |
124 MOJO_GUARDED_BY(mutex()); | 123 MOJO_GUARDED_BY(mutex()); |
125 | 124 |
126 MOJO_DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher); | 125 MOJO_DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher); |
127 }; | 126 }; |
128 | 127 |
129 } // namespace system | 128 } // namespace system |
130 } // namespace mojo | 129 } // namespace mojo |
131 | 130 |
132 #endif // MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ | 131 #endif // MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ |
OLD | NEW |