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

Side by Side Diff: mojo/edk/system/dispatcher.h

Issue 1880823005: [mojo-edk] Add explicit message object APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « mojo/edk/system/core_unittest.cc ('k') | mojo/edk/system/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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_DISPATCHER_H_ 5 #ifndef MOJO_EDK_SYSTEM_DISPATCHER_H_
6 #define MOJO_EDK_SYSTEM_DISPATCHER_H_ 6 #define MOJO_EDK_SYSTEM_DISPATCHER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "mojo/public/c/system/buffer.h" 24 #include "mojo/public/c/system/buffer.h"
25 #include "mojo/public/c/system/data_pipe.h" 25 #include "mojo/public/c/system/data_pipe.h"
26 #include "mojo/public/c/system/message_pipe.h" 26 #include "mojo/public/c/system/message_pipe.h"
27 #include "mojo/public/c/system/types.h" 27 #include "mojo/public/c/system/types.h"
28 28
29 namespace mojo { 29 namespace mojo {
30 namespace edk { 30 namespace edk {
31 31
32 class Awakable; 32 class Awakable;
33 class Dispatcher; 33 class Dispatcher;
34 class MessageForTransit;
34 35
35 using DispatcherVector = std::vector<scoped_refptr<Dispatcher>>; 36 using DispatcherVector = std::vector<scoped_refptr<Dispatcher>>;
36 37
37 // A |Dispatcher| implements Mojo EDK calls that are associated with a 38 // A |Dispatcher| implements Mojo EDK calls that are associated with a
38 // particular MojoHandle, with the exception of MojoWait and MojoWaitMany ( 39 // particular MojoHandle, with the exception of MojoWait and MojoWaitMany (
39 // which are implemented directly in Core.). 40 // which are implemented directly in Core.).
40 class MOJO_SYSTEM_IMPL_EXPORT Dispatcher 41 class MOJO_SYSTEM_IMPL_EXPORT Dispatcher
41 : public base::RefCountedThreadSafe<Dispatcher> { 42 : public base::RefCountedThreadSafe<Dispatcher> {
42 public: 43 public:
43 struct DispatcherInTransit { 44 struct DispatcherInTransit {
(...skipping 25 matching lines...) Expand all
69 ///////////// Watch API //////////////////// 70 ///////////// Watch API ////////////////////
70 71
71 virtual MojoResult Watch(MojoHandleSignals signals, 72 virtual MojoResult Watch(MojoHandleSignals signals,
72 const Watcher::WatchCallback& callback, 73 const Watcher::WatchCallback& callback,
73 uintptr_t context); 74 uintptr_t context);
74 75
75 virtual MojoResult CancelWatch(uintptr_t context); 76 virtual MojoResult CancelWatch(uintptr_t context);
76 77
77 ///////////// Message pipe API ///////////// 78 ///////////// Message pipe API /////////////
78 79
79 virtual MojoResult WriteMessage(const void* bytes, 80 virtual MojoResult WriteMessage(std::unique_ptr<MessageForTransit> message,
80 uint32_t num_bytes,
81 const DispatcherInTransit* dispatchers,
82 uint32_t num_dispatchers,
83 MojoWriteMessageFlags flags); 81 MojoWriteMessageFlags flags);
84 82
85 virtual MojoResult ReadMessage(void* bytes, 83 virtual MojoResult ReadMessage(std::unique_ptr<MessageForTransit>* message,
86 uint32_t* num_bytes, 84 uint32_t* num_bytes,
87 MojoHandle* handles, 85 MojoHandle* handles,
88 uint32_t* num_handles, 86 uint32_t* num_handles,
89 MojoReadMessageFlags flags); 87 MojoReadMessageFlags flags,
88 bool read_any_size);
90 89
91 ///////////// Shared buffer API ///////////// 90 ///////////// Shared buffer API /////////////
92 91
93 // |options| may be null. |new_dispatcher| must not be null, but 92 // |options| may be null. |new_dispatcher| must not be null, but
94 // |*new_dispatcher| should be null (and will contain the dispatcher for the 93 // |*new_dispatcher| should be null (and will contain the dispatcher for the
95 // new handle on success). 94 // new handle on success).
96 virtual MojoResult DuplicateBufferHandle( 95 virtual MojoResult DuplicateBufferHandle(
97 const MojoDuplicateBufferHandleOptions* options, 96 const MojoDuplicateBufferHandleOptions* options,
98 scoped_refptr<Dispatcher>* new_dispatcher); 97 scoped_refptr<Dispatcher>* new_dispatcher);
99 98
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 // So logging macros and |DCHECK_EQ()|, etc. work. 249 // So logging macros and |DCHECK_EQ()|, etc. work.
251 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out, 250 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out,
252 Dispatcher::Type type) { 251 Dispatcher::Type type) {
253 return out << static_cast<int>(type); 252 return out << static_cast<int>(type);
254 } 253 }
255 254
256 } // namespace edk 255 } // namespace edk
257 } // namespace mojo 256 } // namespace mojo
258 257
259 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_ 258 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/core_unittest.cc ('k') | mojo/edk/system/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698