Chromium Code Reviews| Index: mojo/edk/system/shared_buffer_dispatcher.cc |
| diff --git a/mojo/edk/system/shared_buffer_dispatcher.cc b/mojo/edk/system/shared_buffer_dispatcher.cc |
| index 576a4283210a889c7d7b8f65747d818a7f39be46..92273e188935b32745ae902093d7dff1f23239b5 100644 |
| --- a/mojo/edk/system/shared_buffer_dispatcher.cc |
| +++ b/mojo/edk/system/shared_buffer_dispatcher.cc |
| @@ -232,6 +232,29 @@ MojoResult SharedBufferDispatcher::DuplicateBufferHandleImplNoLock( |
| return MOJO_RESULT_OK; |
| } |
| +MojoResult SharedBufferDispatcher::GetBufferInformationImplNoLock( |
| + UserPointer<MojoBufferInformation> info, |
| + uint32_t info_num_bytes) { |
| + mutex().AssertHeld(); |
| + |
| + // Note: If/when |MojoBufferInformation| is extended beyond its initial |
| + // definition, more work will be necessary. (See the definition of |
|
vardhan
2016/03/08 21:36:56
nit: forgot to close the "(" (the one before "See"
|
| + // |MojoGetBufferInformation()| in mojo/public/c/system/buffer.h. |
| + static_assert(sizeof(MojoBufferInformation) == 16u, |
| + "MojoBufferInformation has been extended!"); |
| + |
| + if (info_num_bytes < sizeof(MojoBufferInformation)) |
| + return MOJO_RESULT_INVALID_ARGUMENT; |
| + |
| + MojoBufferInformation model_info = { |
| + sizeof(MojoBufferInformation), // |struct_size|. |
| + MOJO_BUFFER_INFORMATION_FLAG_NONE, // |flags|. |
| + static_cast<uint64_t>(shared_buffer_->GetNumBytes()), // |num_bytes|. |
| + }; |
| + info.Put(model_info); |
| + return MOJO_RESULT_OK; |
| +} |
| + |
| MojoResult SharedBufferDispatcher::MapBufferImplNoLock( |
| uint64_t offset, |
| uint64_t num_bytes, |