| 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 "mojo/edk/embedder/platform_shared_buffer.h" | 8 #include "mojo/edk/embedder/platform_shared_buffer.h" |
| 9 #include "mojo/edk/system/memory.h" | 9 #include "mojo/edk/system/memory.h" |
| 10 #include "mojo/edk/system/simple_dispatcher.h" | 10 #include "mojo/edk/system/simple_dispatcher.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 const MojoCreateSharedBufferOptions& validated_options, | 48 const MojoCreateSharedBufferOptions& validated_options, |
| 49 uint64_t num_bytes, | 49 uint64_t num_bytes, |
| 50 scoped_refptr<SharedBufferDispatcher>* result); | 50 scoped_refptr<SharedBufferDispatcher>* result); |
| 51 | 51 |
| 52 // |Dispatcher| public methods: | 52 // |Dispatcher| public methods: |
| 53 Type GetType() const override; | 53 Type GetType() const override; |
| 54 | 54 |
| 55 // The "opposite" of |SerializeAndClose()|. (Typically this is called by | 55 // The "opposite" of |SerializeAndClose()|. (Typically this is called by |
| 56 // |Dispatcher::Deserialize()|.) | 56 // |Dispatcher::Deserialize()|.) |
| 57 static scoped_refptr<SharedBufferDispatcher> Deserialize( | 57 static scoped_refptr<SharedBufferDispatcher> Deserialize( |
| 58 Channel* channel, | |
| 59 const void* source, | 58 const void* source, |
| 60 size_t size, | 59 size_t size, |
| 61 embedder::PlatformHandleVector* platform_handles); | 60 embedder::PlatformHandleVector* platform_handles); |
| 62 | 61 |
| 63 private: | 62 private: |
| 64 static scoped_refptr<SharedBufferDispatcher> CreateInternal( | 63 static scoped_refptr<SharedBufferDispatcher> CreateInternal( |
| 65 scoped_refptr<embedder::PlatformSharedBuffer> shared_buffer) { | 64 scoped_refptr<embedder::PlatformSharedBuffer> shared_buffer) { |
| 66 return make_scoped_refptr(new SharedBufferDispatcher(shared_buffer.Pass())); | 65 return make_scoped_refptr(new SharedBufferDispatcher(shared_buffer.Pass())); |
| 67 } | 66 } |
| 68 | 67 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 84 scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock() | 83 scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock() |
| 85 override; | 84 override; |
| 86 MojoResult DuplicateBufferHandleImplNoLock( | 85 MojoResult DuplicateBufferHandleImplNoLock( |
| 87 UserPointer<const MojoDuplicateBufferHandleOptions> options, | 86 UserPointer<const MojoDuplicateBufferHandleOptions> options, |
| 88 scoped_refptr<Dispatcher>* new_dispatcher) override; | 87 scoped_refptr<Dispatcher>* new_dispatcher) override; |
| 89 MojoResult MapBufferImplNoLock( | 88 MojoResult MapBufferImplNoLock( |
| 90 uint64_t offset, | 89 uint64_t offset, |
| 91 uint64_t num_bytes, | 90 uint64_t num_bytes, |
| 92 MojoMapBufferFlags flags, | 91 MojoMapBufferFlags flags, |
| 93 scoped_ptr<embedder::PlatformSharedBufferMapping>* mapping) override; | 92 scoped_ptr<embedder::PlatformSharedBufferMapping>* mapping) override; |
| 94 void StartSerializeImplNoLock(Channel* channel, | 93 void StartSerializeImplNoLock(size_t* max_size, |
| 95 size_t* max_size, | 94 size_t* max_platform_handles) override; |
| 96 size_t* max_platform_handles) override | |
| 97 MOJO_NOT_THREAD_SAFE; | |
| 98 bool EndSerializeAndCloseImplNoLock( | 95 bool EndSerializeAndCloseImplNoLock( |
| 99 Channel* channel, | |
| 100 void* destination, | 96 void* destination, |
| 101 size_t* actual_size, | 97 size_t* actual_size, |
| 102 embedder::PlatformHandleVector* platform_handles) override | 98 embedder::PlatformHandleVector* platform_handles) override; |
| 103 MOJO_NOT_THREAD_SAFE; | |
| 104 | 99 |
| 105 scoped_refptr<embedder::PlatformSharedBuffer> shared_buffer_ | 100 scoped_refptr<embedder::PlatformSharedBuffer> shared_buffer_; |
| 106 MOJO_GUARDED_BY(mutex()); | |
| 107 | 101 |
| 108 MOJO_DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher); | 102 MOJO_DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher); |
| 109 }; | 103 }; |
| 110 | 104 |
| 111 } // namespace system | 105 } // namespace system |
| 112 } // namespace mojo | 106 } // namespace mojo |
| 113 | 107 |
| 114 #endif // MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ | 108 #endif // MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ |
| OLD | NEW |