| OLD | NEW |
| 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 25 matching lines...) Expand all Loading... |
| 58 | 59 |
| 59 // "Private" types (not exposed via the public interface): | 60 // "Private" types (not exposed via the public interface): |
| 60 PLATFORM_HANDLE = -1, | 61 PLATFORM_HANDLE = -1, |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 // All Dispatchers must minimally implement these methods. | 64 // All Dispatchers must minimally implement these methods. |
| 64 | 65 |
| 65 virtual Type GetType() const = 0; | 66 virtual Type GetType() const = 0; |
| 66 virtual MojoResult Close() = 0; | 67 virtual MojoResult Close() = 0; |
| 67 | 68 |
| 69 ///////////// Watch API //////////////////// |
| 70 |
| 71 virtual MojoResult Watch(MojoHandleSignals signals, |
| 72 const Watcher::WatchCallback& callback, |
| 73 uintptr_t context); |
| 74 |
| 75 virtual MojoResult CancelWatch(uintptr_t context); |
| 76 |
| 68 ///////////// Message pipe API ///////////// | 77 ///////////// Message pipe API ///////////// |
| 69 | 78 |
| 70 virtual MojoResult WriteMessage(const void* bytes, | 79 virtual MojoResult WriteMessage(const void* bytes, |
| 71 uint32_t num_bytes, | 80 uint32_t num_bytes, |
| 72 const DispatcherInTransit* dispatchers, | 81 const DispatcherInTransit* dispatchers, |
| 73 uint32_t num_dispatchers, | 82 uint32_t num_dispatchers, |
| 74 MojoWriteMessageFlags flags); | 83 MojoWriteMessageFlags flags); |
| 75 | 84 |
| 76 virtual MojoResult ReadMessage(void* bytes, | 85 virtual MojoResult ReadMessage(void* bytes, |
| 77 uint32_t* num_bytes, | 86 uint32_t* num_bytes, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // So logging macros and |DCHECK_EQ()|, etc. work. | 250 // So logging macros and |DCHECK_EQ()|, etc. work. |
| 242 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out, | 251 MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out, |
| 243 Dispatcher::Type type) { | 252 Dispatcher::Type type) { |
| 244 return out << static_cast<int>(type); | 253 return out << static_cast<int>(type); |
| 245 } | 254 } |
| 246 | 255 |
| 247 } // namespace edk | 256 } // namespace edk |
| 248 } // namespace mojo | 257 } // namespace mojo |
| 249 | 258 |
| 250 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_ | 259 #endif // MOJO_EDK_SYSTEM_DISPATCHER_H_ |
| OLD | NEW |