| 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> |
| 9 |
| 8 #include "mojo/edk/embedder/platform_shared_buffer.h" | 10 #include "mojo/edk/embedder/platform_shared_buffer.h" |
| 9 #include "mojo/edk/system/simple_dispatcher.h" | 11 #include "mojo/edk/system/simple_dispatcher.h" |
| 10 #include "mojo/edk/system/system_impl_export.h" | 12 #include "mojo/edk/system/system_impl_export.h" |
| 11 #include "mojo/public/cpp/system/macros.h" | 13 #include "mojo/public/cpp/system/macros.h" |
| 12 | 14 |
| 13 namespace mojo { | 15 namespace mojo { |
| 14 | 16 |
| 15 namespace edk { | 17 namespace edk { |
| 16 class PlatformSupport; | 18 class PlatformSupport; |
| 17 | 19 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // The "opposite" of |SerializeAndClose()|. (Typically this is called by | 53 // The "opposite" of |SerializeAndClose()|. (Typically this is called by |
| 52 // |Dispatcher::Deserialize()|.) | 54 // |Dispatcher::Deserialize()|.) |
| 53 static scoped_refptr<SharedBufferDispatcher> Deserialize( | 55 static scoped_refptr<SharedBufferDispatcher> Deserialize( |
| 54 const void* source, | 56 const void* source, |
| 55 size_t size, | 57 size_t size, |
| 56 PlatformHandleVector* platform_handles); | 58 PlatformHandleVector* platform_handles); |
| 57 | 59 |
| 58 private: | 60 private: |
| 59 static scoped_refptr<SharedBufferDispatcher> CreateInternal( | 61 static scoped_refptr<SharedBufferDispatcher> CreateInternal( |
| 60 scoped_refptr<PlatformSharedBuffer> shared_buffer) { | 62 scoped_refptr<PlatformSharedBuffer> shared_buffer) { |
| 61 return make_scoped_refptr(new SharedBufferDispatcher(shared_buffer.Pass())); | 63 return make_scoped_refptr( |
| 64 new SharedBufferDispatcher(std::move(shared_buffer))); |
| 62 } | 65 } |
| 63 | 66 |
| 64 explicit SharedBufferDispatcher( | 67 explicit SharedBufferDispatcher( |
| 65 scoped_refptr<PlatformSharedBuffer> shared_buffer); | 68 scoped_refptr<PlatformSharedBuffer> shared_buffer); |
| 66 ~SharedBufferDispatcher() override; | 69 ~SharedBufferDispatcher() override; |
| 67 | 70 |
| 68 // Validates and/or sets default options for | 71 // Validates and/or sets default options for |
| 69 // |MojoDuplicateBufferHandleOptions|. If non-null, |in_options| must point to | 72 // |MojoDuplicateBufferHandleOptions|. If non-null, |in_options| must point to |
| 70 // a struct of at least |in_options->struct_size| bytes. |out_options| must | 73 // a struct of at least |in_options->struct_size| bytes. |out_options| must |
| 71 // point to a (current) |MojoDuplicateBufferHandleOptions| and will be | 74 // point to a (current) |MojoDuplicateBufferHandleOptions| and will be |
| (...skipping 23 matching lines...) Expand all Loading... |
| 95 | 98 |
| 96 scoped_refptr<PlatformSharedBuffer> shared_buffer_; | 99 scoped_refptr<PlatformSharedBuffer> shared_buffer_; |
| 97 | 100 |
| 98 MOJO_DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher); | 101 MOJO_DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher); |
| 99 }; | 102 }; |
| 100 | 103 |
| 101 } // namespace edk | 104 } // namespace edk |
| 102 } // namespace mojo | 105 } // namespace mojo |
| 103 | 106 |
| 104 #endif // MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ | 107 #endif // MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ |
| OLD | NEW |