| 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/message_pipe_dispatcher.h" | 5 #include "mojo/edk/system/message_pipe_dispatcher.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "mojo/edk/system/configuration.h" | 10 #include "mojo/edk/system/configuration.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // too. | 155 // too. |
| 156 auto dispatcher = MessagePipeDispatcher::Create(kDefaultCreateOptions); | 156 auto dispatcher = MessagePipeDispatcher::Create(kDefaultCreateOptions); |
| 157 dispatcher->Init(std::move(message_pipe_), port_); | 157 dispatcher->Init(std::move(message_pipe_), port_); |
| 158 port_ = kInvalidPort; | 158 port_ = kInvalidPort; |
| 159 return dispatcher; | 159 return dispatcher; |
| 160 } | 160 } |
| 161 | 161 |
| 162 MojoResult MessagePipeDispatcher::WriteMessageImplNoLock( | 162 MojoResult MessagePipeDispatcher::WriteMessageImplNoLock( |
| 163 UserPointer<const void> bytes, | 163 UserPointer<const void> bytes, |
| 164 uint32_t num_bytes, | 164 uint32_t num_bytes, |
| 165 std::vector<DispatcherTransport>* transports, | 165 std::vector<HandleTransport>* transports, |
| 166 MojoWriteMessageFlags flags) { | 166 MojoWriteMessageFlags flags) { |
| 167 DCHECK(!transports || | 167 DCHECK(!transports || |
| 168 (transports->size() > 0 && | 168 (transports->size() > 0 && |
| 169 transports->size() <= GetConfiguration().max_message_num_handles)); | 169 transports->size() <= GetConfiguration().max_message_num_handles)); |
| 170 | 170 |
| 171 mutex().AssertHeld(); | 171 mutex().AssertHeld(); |
| 172 | 172 |
| 173 if (num_bytes > GetConfiguration().max_message_num_bytes) | 173 if (num_bytes > GetConfiguration().max_message_num_bytes) |
| 174 return MOJO_RESULT_RESOURCE_EXHAUSTED; | 174 return MOJO_RESULT_RESOURCE_EXHAUSTED; |
| 175 | 175 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 bool rv = message_pipe_->EndSerialize(port_, channel, destination, | 230 bool rv = message_pipe_->EndSerialize(port_, channel, destination, |
| 231 actual_size, platform_handles); | 231 actual_size, platform_handles); |
| 232 message_pipe_ = nullptr; | 232 message_pipe_ = nullptr; |
| 233 port_ = kInvalidPort; | 233 port_ = kInvalidPort; |
| 234 return rv; | 234 return rv; |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace system | 237 } // namespace system |
| 238 } // namespace mojo | 238 } // namespace mojo |
| OLD | NEW |