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/system/message_pipe_dispatcher.h" | 5 #include "mojo/system/message_pipe_dispatcher.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "mojo/system/channel.h" | 8 #include "mojo/system/channel.h" |
9 #include "mojo/system/constants.h" | 9 #include "mojo/system/constants.h" |
10 #include "mojo/system/local_message_pipe_endpoint.h" | 10 #include "mojo/system/local_message_pipe_endpoint.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 if (num_bytes > kMaxMessageNumBytes) | 155 if (num_bytes > kMaxMessageNumBytes) |
156 return MOJO_RESULT_RESOURCE_EXHAUSTED; | 156 return MOJO_RESULT_RESOURCE_EXHAUSTED; |
157 | 157 |
158 return message_pipe_->WriteMessage(port_, bytes, num_bytes, transports, | 158 return message_pipe_->WriteMessage(port_, bytes, num_bytes, transports, |
159 flags); | 159 flags); |
160 } | 160 } |
161 | 161 |
162 MojoResult MessagePipeDispatcher::ReadMessageImplNoLock( | 162 MojoResult MessagePipeDispatcher::ReadMessageImplNoLock( |
163 void* bytes, | 163 void* bytes, |
164 uint32_t* num_bytes, | 164 uint32_t* num_bytes, |
165 std::vector<scoped_refptr<Dispatcher> >* dispatchers, | 165 DispatcherVector* dispatchers, |
166 uint32_t* num_dispatchers, | 166 uint32_t* num_dispatchers, |
167 MojoReadMessageFlags flags) { | 167 MojoReadMessageFlags flags) { |
168 lock().AssertAcquired(); | 168 lock().AssertAcquired(); |
169 | 169 |
170 if (num_bytes) { | 170 if (num_bytes) { |
171 if (!VerifyUserPointer<uint32_t>(num_bytes, 1)) | 171 if (!VerifyUserPointer<uint32_t>(num_bytes, 1)) |
172 return MOJO_RESULT_INVALID_ARGUMENT; | 172 return MOJO_RESULT_INVALID_ARGUMENT; |
173 if (!VerifyUserPointer<void>(bytes, *num_bytes)) | 173 if (!VerifyUserPointer<void>(bytes, *num_bytes)) |
174 return MOJO_RESULT_INVALID_ARGUMENT; | 174 return MOJO_RESULT_INVALID_ARGUMENT; |
175 } | 175 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 // MessagePipeDispatcherTransport ---------------------------------------------- | 235 // MessagePipeDispatcherTransport ---------------------------------------------- |
236 | 236 |
237 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( | 237 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( |
238 DispatcherTransport transport) : DispatcherTransport(transport) { | 238 DispatcherTransport transport) : DispatcherTransport(transport) { |
239 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe); | 239 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe); |
240 } | 240 } |
241 | 241 |
242 } // namespace system | 242 } // namespace system |
243 } // namespace mojo | 243 } // namespace mojo |
OLD | NEW |