Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: mojo/system/shared_buffer_dispatcher.h

Issue 304233005: Mojo: Implement passing of shared buffers across processes on POSIX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/system/remote_message_pipe_unittest.cc ('k') | mojo/system/shared_buffer_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ 5 #ifndef MOJO_SYSTEM_SHARED_BUFFER_DISPATCHER_H_
6 #define MOJO_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ 6 #define MOJO_SYSTEM_SHARED_BUFFER_DISPATCHER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "mojo/system/raw_shared_buffer.h" 9 #include "mojo/system/raw_shared_buffer.h"
10 #include "mojo/system/simple_dispatcher.h" 10 #include "mojo/system/simple_dispatcher.h"
(...skipping 17 matching lines...) Expand all
28 // Static factory method: |validated_options| must be validated (obviously). 28 // Static factory method: |validated_options| must be validated (obviously).
29 // On failure, |*result| will be left as-is. 29 // On failure, |*result| will be left as-is.
30 static MojoResult Create( 30 static MojoResult Create(
31 const MojoCreateSharedBufferOptions& validated_options, 31 const MojoCreateSharedBufferOptions& validated_options,
32 uint64_t num_bytes, 32 uint64_t num_bytes,
33 scoped_refptr<SharedBufferDispatcher>* result); 33 scoped_refptr<SharedBufferDispatcher>* result);
34 34
35 // |Dispatcher| public methods: 35 // |Dispatcher| public methods:
36 virtual Type GetType() const OVERRIDE; 36 virtual Type GetType() const OVERRIDE;
37 37
38 // The "opposite" of |SerializeAndClose()|. (Typically this is called by
39 // |Dispatcher::Deserialize()|.)
40 static scoped_refptr<SharedBufferDispatcher> Deserialize(
41 Channel* channel,
42 const void* source,
43 size_t size,
44 embedder::PlatformHandleVector* platform_handles);
45
38 private: 46 private:
39 explicit SharedBufferDispatcher( 47 explicit SharedBufferDispatcher(
40 scoped_refptr<RawSharedBuffer> shared_buffer_); 48 scoped_refptr<RawSharedBuffer> shared_buffer_);
41 virtual ~SharedBufferDispatcher(); 49 virtual ~SharedBufferDispatcher();
42 50
43 // |Dispatcher| protected methods: 51 // |Dispatcher| protected methods:
44 virtual void CloseImplNoLock() OVERRIDE; 52 virtual void CloseImplNoLock() OVERRIDE;
45 virtual scoped_refptr<Dispatcher> 53 virtual scoped_refptr<Dispatcher>
46 CreateEquivalentDispatcherAndCloseImplNoLock() OVERRIDE; 54 CreateEquivalentDispatcherAndCloseImplNoLock() OVERRIDE;
47 virtual MojoResult DuplicateBufferHandleImplNoLock( 55 virtual MojoResult DuplicateBufferHandleImplNoLock(
48 const MojoDuplicateBufferHandleOptions* options, 56 const MojoDuplicateBufferHandleOptions* options,
49 scoped_refptr<Dispatcher>* new_dispatcher) OVERRIDE; 57 scoped_refptr<Dispatcher>* new_dispatcher) OVERRIDE;
50 virtual MojoResult MapBufferImplNoLock( 58 virtual MojoResult MapBufferImplNoLock(
51 uint64_t offset, 59 uint64_t offset,
52 uint64_t num_bytes, 60 uint64_t num_bytes,
53 MojoMapBufferFlags flags, 61 MojoMapBufferFlags flags,
54 scoped_ptr<RawSharedBufferMapping>* mapping) OVERRIDE; 62 scoped_ptr<RawSharedBufferMapping>* mapping) OVERRIDE;
63 virtual void StartSerializeImplNoLock(Channel* channel,
64 size_t* max_size,
65 size_t* max_platform_handles) OVERRIDE;
66 virtual bool EndSerializeAndCloseImplNoLock(
67 Channel* channel,
68 void* destination,
69 size_t* actual_size,
70 embedder::PlatformHandleVector* platform_handles) OVERRIDE;
55 71
56 // |SimpleDispatcher| methods: 72 // |SimpleDispatcher| methods:
57 virtual MojoWaitFlags SatisfiedFlagsNoLock() const OVERRIDE; 73 virtual MojoWaitFlags SatisfiedFlagsNoLock() const OVERRIDE;
58 virtual MojoWaitFlags SatisfiableFlagsNoLock() const OVERRIDE; 74 virtual MojoWaitFlags SatisfiableFlagsNoLock() const OVERRIDE;
59 75
60 scoped_refptr<RawSharedBuffer> shared_buffer_; 76 scoped_refptr<RawSharedBuffer> shared_buffer_;
61 77
62 DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher); 78 DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher);
63 }; 79 };
64 80
65 } // namespace system 81 } // namespace system
66 } // namespace mojo 82 } // namespace mojo
67 83
68 #endif // MOJO_SYSTEM_SHARED_BUFFER_DISPATCHER_H_ 84 #endif // MOJO_SYSTEM_SHARED_BUFFER_DISPATCHER_H_
OLDNEW
« no previous file with comments | « mojo/system/remote_message_pipe_unittest.cc ('k') | mojo/system/shared_buffer_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698