| 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_GET_OPTIONS | MOJO_HANDLE_RIGHT_SET_OPTIONS | |
| 40 MOJO_HANDLE_RIGHT_MAP_READABLE | MOJO_HANDLE_RIGHT_MAP_WRITABLE | |
| 41 MOJO_HANDLE_RIGHT_MAP_EXECUTABLE; |
| 40 | 42 |
| 41 // The default options to use for |MojoCreateSharedBuffer()|. (Real uses | 43 // The default options to use for |MojoCreateSharedBuffer()|. (Real uses |
| 42 // should obtain this via |ValidateCreateOptions()| with a null |in_options|; | 44 // should obtain this via |ValidateCreateOptions()| with a null |in_options|; |
| 43 // this is exposed directly for testing convenience.) | 45 // this is exposed directly for testing convenience.) |
| 44 static const MojoCreateSharedBufferOptions kDefaultCreateOptions; | 46 static const MojoCreateSharedBufferOptions kDefaultCreateOptions; |
| 45 | 47 |
| 46 // Validates and/or sets default options for |MojoCreateSharedBufferOptions|. | 48 // Validates and/or sets default options for |MojoCreateSharedBufferOptions|. |
| 47 // If non-null, |in_options| must point to a struct of at least | 49 // If non-null, |in_options| must point to a struct of at least |
| 48 // |in_options->struct_size| bytes. |out_options| must point to a (current) | 50 // |in_options->struct_size| bytes. |out_options| must point to a (current) |
| 49 // |MojoCreateSharedBufferOptions| and will be entirely overwritten on success | 51 // |MojoCreateSharedBufferOptions| and will be entirely overwritten on success |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 util::RefPtr<platform::PlatformSharedBuffer> shared_buffer_ | 124 util::RefPtr<platform::PlatformSharedBuffer> shared_buffer_ |
| 123 MOJO_GUARDED_BY(mutex()); | 125 MOJO_GUARDED_BY(mutex()); |
| 124 | 126 |
| 125 MOJO_DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher); | 127 MOJO_DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher); |
| 126 }; | 128 }; |
| 127 | 129 |
| 128 } // namespace system | 130 } // namespace system |
| 129 } // namespace mojo | 131 } // namespace mojo |
| 130 | 132 |
| 131 #endif // MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ | 133 #endif // MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ |
| OLD | NEW |