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

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

Issue 1748503002: [mojo-edk] Add MojoWatch and MojoCancelWatch APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 9 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
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
11 #include <ostream> 11 #include <ostream>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "mojo/edk/embedder/platform_handle.h" 18 #include "mojo/edk/embedder/platform_handle.h"
19 #include "mojo/edk/embedder/platform_shared_buffer.h" 19 #include "mojo/edk/embedder/platform_shared_buffer.h"
20 #include "mojo/edk/system/handle_signals_state.h" 20 #include "mojo/edk/system/handle_signals_state.h"
21 #include "mojo/edk/system/ports/name.h" 21 #include "mojo/edk/system/ports/name.h"
22 #include "mojo/edk/system/system_impl_export.h" 22 #include "mojo/edk/system/system_impl_export.h"
23 #include "mojo/edk/system/watcher.h"
23 #include "mojo/public/c/system/buffer.h" 24 #include "mojo/public/c/system/buffer.h"
24 #include "mojo/public/c/system/data_pipe.h" 25 #include "mojo/public/c/system/data_pipe.h"
25 #include "mojo/public/c/system/message_pipe.h" 26 #include "mojo/public/c/system/message_pipe.h"
26 #include "mojo/public/c/system/types.h" 27 #include "mojo/public/c/system/types.h"
27 28
28 namespace mojo { 29 namespace mojo {
29 namespace edk { 30 namespace edk {
30 31
31 class Awakable; 32 class Awakable;
32 class Dispatcher; 33 class Dispatcher;
(...skipping 24 matching lines...) Expand all
57 58
58 // "Private" types (not exposed via the public interface): 59 // "Private" types (not exposed via the public interface):
59 PLATFORM_HANDLE = -1, 60 PLATFORM_HANDLE = -1,
60 }; 61 };
61 62
62 // All Dispatchers must minimally implement these methods. 63 // All Dispatchers must minimally implement these methods.
63 64
64 virtual Type GetType() const = 0; 65 virtual Type GetType() const = 0;
65 virtual MojoResult Close() = 0; 66 virtual MojoResult Close() = 0;
66 67
68 ///////////// Watch API ////////////////////
69
70 virtual MojoResult Watch(MojoHandleSignals signals,
71 const Watcher::WatchCallback& callback,
72 uintptr_t context);
73
74 virtual MojoResult CancelWatch(uintptr_t context);
75
67 ///////////// Message pipe API ///////////// 76 ///////////// Message pipe API /////////////
68 77
69 virtual MojoResult WriteMessage(const void* bytes, 78 virtual MojoResult WriteMessage(const void* bytes,
70 uint32_t num_bytes, 79 uint32_t num_bytes,
71 const DispatcherInTransit* dispatchers, 80 const DispatcherInTransit* dispatchers,
72 uint32_t num_dispatchers, 81 uint32_t num_dispatchers,
73 MojoWriteMessageFlags flags); 82 MojoWriteMessageFlags flags);
74 83
75 virtual MojoResult ReadMessage(void* bytes, 84 virtual MojoResult ReadMessage(void* bytes,
76 uint32_t* num_bytes, 85 uint32_t* num_bytes,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // So logging macros and |DCHECK_EQ()|, etc. work. 249 // So logging macros and |DCHECK_EQ()|, etc. work.
241 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out, 250 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out,
242 Dispatcher::Type type) { 251 Dispatcher::Type type) {
243 return out << static_cast<int>(type); 252 return out << static_cast<int>(type);
244 } 253 }
245 254
246 } // namespace edk 255 } // namespace edk
247 } // namespace mojo 256 } // namespace mojo
248 257
249 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_ 258 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698