| 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 #include "mojo/edk/system/dispatcher.h" | 5 #include "mojo/edk/system/dispatcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "mojo/edk/system/configuration.h" | 8 #include "mojo/edk/system/configuration.h" |
| 9 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" | 9 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
| 10 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" | 10 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" |
| 11 #include "mojo/edk/system/message_pipe_dispatcher.h" | 11 #include "mojo/edk/system/message_pipe_dispatcher.h" |
| 12 #include "mojo/edk/system/platform_handle_dispatcher.h" | 12 #include "mojo/edk/system/platform_handle_dispatcher.h" |
| 13 #include "mojo/edk/system/shared_buffer_dispatcher.h" | 13 #include "mojo/edk/system/shared_buffer_dispatcher.h" |
| 14 | 14 |
| 15 namespace mojo { | 15 namespace mojo { |
| 16 namespace edk { | 16 namespace edk { |
| 17 | 17 |
| 18 Dispatcher::RequestContext::RequestContext() {} |
| 19 |
| 20 Dispatcher::RequestContext::~RequestContext() { |
| 21 for (const auto& finalizer : finalizers_.container()) |
| 22 finalizer.Run(); |
| 23 } |
| 24 |
| 25 void Dispatcher::RequestContext::AddFinalizer(const base::Closure& callback) { |
| 26 finalizers_->push_back(callback); |
| 27 } |
| 28 |
| 18 Dispatcher::DispatcherInTransit::DispatcherInTransit() {} | 29 Dispatcher::DispatcherInTransit::DispatcherInTransit() {} |
| 19 | 30 |
| 20 Dispatcher::DispatcherInTransit::~DispatcherInTransit() {} | 31 Dispatcher::DispatcherInTransit::~DispatcherInTransit() {} |
| 21 | 32 |
| 33 MojoResult Dispatcher::Watch(MojoHandleSignals signals, |
| 34 const WatchCallback& callback, |
| 35 uintptr_t context, |
| 36 RequestContext* request_context) { |
| 37 return MOJO_RESULT_INVALID_ARGUMENT; |
| 38 } |
| 39 |
| 40 MojoResult Dispatcher::CancelWatch(uintptr_t context) { |
| 41 return MOJO_RESULT_INVALID_ARGUMENT; |
| 42 } |
| 43 |
| 22 MojoResult Dispatcher::WriteMessage(const void* bytes, | 44 MojoResult Dispatcher::WriteMessage(const void* bytes, |
| 23 uint32_t num_bytes, | 45 uint32_t num_bytes, |
| 24 const DispatcherInTransit* dispatchers, | 46 const DispatcherInTransit* dispatchers, |
| 25 uint32_t num_dispatchers, | 47 uint32_t num_dispatchers, |
| 26 MojoWriteMessageFlags flags) { | 48 MojoWriteMessageFlags flags, |
| 49 RequestContext* request_context) { |
| 27 return MOJO_RESULT_INVALID_ARGUMENT; | 50 return MOJO_RESULT_INVALID_ARGUMENT; |
| 28 } | 51 } |
| 29 | 52 |
| 30 MojoResult Dispatcher::ReadMessage(void* bytes, | 53 MojoResult Dispatcher::ReadMessage(void* bytes, |
| 31 uint32_t* num_bytes, | 54 uint32_t* num_bytes, |
| 32 MojoHandle* handles, | 55 MojoHandle* handles, |
| 33 uint32_t* num_handles, | 56 uint32_t* num_handles, |
| 34 MojoReadMessageFlags flags) { | 57 MojoReadMessageFlags flags, |
| 58 RequestContext* request_context) { |
| 35 return MOJO_RESULT_INVALID_ARGUMENT; | 59 return MOJO_RESULT_INVALID_ARGUMENT; |
| 36 } | 60 } |
| 37 | 61 |
| 38 MojoResult Dispatcher::DuplicateBufferHandle( | 62 MojoResult Dispatcher::DuplicateBufferHandle( |
| 39 const MojoDuplicateBufferHandleOptions* options, | 63 const MojoDuplicateBufferHandleOptions* options, |
| 40 scoped_refptr<Dispatcher>* new_dispatcher) { | 64 scoped_refptr<Dispatcher>* new_dispatcher) { |
| 41 return MOJO_RESULT_INVALID_ARGUMENT; | 65 return MOJO_RESULT_INVALID_ARGUMENT; |
| 42 } | 66 } |
| 43 | 67 |
| 44 MojoResult Dispatcher::MapBuffer( | 68 MojoResult Dispatcher::MapBuffer( |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 *num_platform_handles = 0; | 148 *num_platform_handles = 0; |
| 125 } | 149 } |
| 126 | 150 |
| 127 bool Dispatcher::EndSerialize(void* destination, | 151 bool Dispatcher::EndSerialize(void* destination, |
| 128 ports::PortName* ports, | 152 ports::PortName* ports, |
| 129 PlatformHandle* handles) { | 153 PlatformHandle* handles) { |
| 130 LOG(ERROR) << "Attempting to serialize a non-transferrable dispatcher."; | 154 LOG(ERROR) << "Attempting to serialize a non-transferrable dispatcher."; |
| 131 return true; | 155 return true; |
| 132 } | 156 } |
| 133 | 157 |
| 134 bool Dispatcher::BeginTransit() { return true; } | 158 bool Dispatcher::BeginTransit(RequestContext* request_context) { return true; } |
| 135 | 159 |
| 136 void Dispatcher::CompleteTransitAndClose() {} | 160 void Dispatcher::CompleteTransitAndClose(RequestContext* request_context) {} |
| 137 | 161 |
| 138 void Dispatcher::CancelTransit() {} | 162 void Dispatcher::CancelTransit(RequestContext* request_context) {} |
| 139 | 163 |
| 140 // static | 164 // static |
| 141 scoped_refptr<Dispatcher> Dispatcher::Deserialize( | 165 scoped_refptr<Dispatcher> Dispatcher::Deserialize( |
| 142 Type type, | 166 Type type, |
| 143 const void* bytes, | 167 const void* bytes, |
| 144 size_t num_bytes, | 168 size_t num_bytes, |
| 145 const ports::PortName* ports, | 169 const ports::PortName* ports, |
| 146 size_t num_ports, | 170 size_t num_ports, |
| 147 PlatformHandle* platform_handles, | 171 PlatformHandle* platform_handles, |
| 148 size_t num_platform_handles) { | 172 size_t num_platform_handles) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 172 return nullptr; | 196 return nullptr; |
| 173 } | 197 } |
| 174 } | 198 } |
| 175 | 199 |
| 176 Dispatcher::Dispatcher() {} | 200 Dispatcher::Dispatcher() {} |
| 177 | 201 |
| 178 Dispatcher::~Dispatcher() {} | 202 Dispatcher::~Dispatcher() {} |
| 179 | 203 |
| 180 } // namespace edk | 204 } // namespace edk |
| 181 } // namespace mojo | 205 } // namespace mojo |
| OLD | NEW |