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

Side by Side Diff: mojo/edk/system/message_pipe_dispatcher.cc

Issue 728553002: Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « mojo/edk/system/message_pipe.cc ('k') | mojo/edk/system/message_pipe_dispatcher_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "mojo/edk/system/message_pipe_dispatcher.h" 5 #include "mojo/edk/system/message_pipe_dispatcher.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "mojo/edk/system/channel.h" 8 #include "mojo/edk/system/channel.h"
9 #include "mojo/edk/system/channel_endpoint.h" 9 #include "mojo/edk/system/channel_endpoint.h"
10 #include "mojo/edk/system/channel_endpoint_id.h" 10 #include "mojo/edk/system/channel_endpoint_id.h"
11 #include "mojo/edk/system/constants.h" 11 #include "mojo/edk/system/configuration.h"
12 #include "mojo/edk/system/local_message_pipe_endpoint.h" 12 #include "mojo/edk/system/local_message_pipe_endpoint.h"
13 #include "mojo/edk/system/memory.h" 13 #include "mojo/edk/system/memory.h"
14 #include "mojo/edk/system/message_pipe.h" 14 #include "mojo/edk/system/message_pipe.h"
15 #include "mojo/edk/system/options_validation.h" 15 #include "mojo/edk/system/options_validation.h"
16 #include "mojo/edk/system/proxy_message_pipe_endpoint.h" 16 #include "mojo/edk/system/proxy_message_pipe_endpoint.h"
17 17
18 namespace mojo { 18 namespace mojo {
19 namespace system { 19 namespace system {
20 20
21 namespace { 21 namespace {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 message_pipe_ = nullptr; 166 message_pipe_ = nullptr;
167 port_ = kInvalidPort; 167 port_ = kInvalidPort;
168 return scoped_refptr<Dispatcher>(rv.get()); 168 return scoped_refptr<Dispatcher>(rv.get());
169 } 169 }
170 170
171 MojoResult MessagePipeDispatcher::WriteMessageImplNoLock( 171 MojoResult MessagePipeDispatcher::WriteMessageImplNoLock(
172 UserPointer<const void> bytes, 172 UserPointer<const void> bytes,
173 uint32_t num_bytes, 173 uint32_t num_bytes,
174 std::vector<DispatcherTransport>* transports, 174 std::vector<DispatcherTransport>* transports,
175 MojoWriteMessageFlags flags) { 175 MojoWriteMessageFlags flags) {
176 DCHECK(!transports || (transports->size() > 0 && 176 DCHECK(!transports ||
177 transports->size() <= kMaxMessageNumHandles)); 177 (transports->size() > 0 &&
178 transports->size() <= GetConfiguration().max_message_num_handles));
178 179
179 lock().AssertAcquired(); 180 lock().AssertAcquired();
180 181
181 if (num_bytes > kMaxMessageNumBytes) 182 if (num_bytes > GetConfiguration().max_message_num_bytes)
182 return MOJO_RESULT_RESOURCE_EXHAUSTED; 183 return MOJO_RESULT_RESOURCE_EXHAUSTED;
183 184
184 return message_pipe_->WriteMessage( 185 return message_pipe_->WriteMessage(port_, bytes, num_bytes, transports,
185 port_, bytes, num_bytes, transports, flags); 186 flags);
186 } 187 }
187 188
188 MojoResult MessagePipeDispatcher::ReadMessageImplNoLock( 189 MojoResult MessagePipeDispatcher::ReadMessageImplNoLock(
189 UserPointer<void> bytes, 190 UserPointer<void> bytes,
190 UserPointer<uint32_t> num_bytes, 191 UserPointer<uint32_t> num_bytes,
191 DispatcherVector* dispatchers, 192 DispatcherVector* dispatchers,
192 uint32_t* num_dispatchers, 193 uint32_t* num_dispatchers,
193 MojoReadMessageFlags flags) { 194 MojoReadMessageFlags flags) {
194 lock().AssertAcquired(); 195 lock().AssertAcquired();
195 return message_pipe_->ReadMessage( 196 return message_pipe_->ReadMessage(port_, bytes, num_bytes, dispatchers,
196 port_, bytes, num_bytes, dispatchers, num_dispatchers, flags); 197 num_dispatchers, flags);
197 } 198 }
198 199
199 HandleSignalsState MessagePipeDispatcher::GetHandleSignalsStateImplNoLock() 200 HandleSignalsState MessagePipeDispatcher::GetHandleSignalsStateImplNoLock()
200 const { 201 const {
201 lock().AssertAcquired(); 202 lock().AssertAcquired();
202 return message_pipe_->GetHandleSignalsState(port_); 203 return message_pipe_->GetHandleSignalsState(port_);
203 } 204 }
204 205
205 MojoResult MessagePipeDispatcher::AddWaiterImplNoLock( 206 MojoResult MessagePipeDispatcher::AddWaiterImplNoLock(
206 Waiter* waiter, 207 Waiter* waiter,
207 MojoHandleSignals signals, 208 MojoHandleSignals signals,
208 uint32_t context, 209 uint32_t context,
209 HandleSignalsState* signals_state) { 210 HandleSignalsState* signals_state) {
210 lock().AssertAcquired(); 211 lock().AssertAcquired();
211 return message_pipe_->AddWaiter( 212 return message_pipe_->AddWaiter(port_, waiter, signals, context,
212 port_, waiter, signals, context, signals_state); 213 signals_state);
213 } 214 }
214 215
215 void MessagePipeDispatcher::RemoveWaiterImplNoLock( 216 void MessagePipeDispatcher::RemoveWaiterImplNoLock(
216 Waiter* waiter, 217 Waiter* waiter,
217 HandleSignalsState* signals_state) { 218 HandleSignalsState* signals_state) {
218 lock().AssertAcquired(); 219 lock().AssertAcquired();
219 message_pipe_->RemoveWaiter(port_, waiter, signals_state); 220 message_pipe_->RemoveWaiter(port_, waiter, signals_state);
220 } 221 }
221 222
222 void MessagePipeDispatcher::StartSerializeImplNoLock( 223 void MessagePipeDispatcher::StartSerializeImplNoLock(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 // MessagePipeDispatcherTransport ---------------------------------------------- 256 // MessagePipeDispatcherTransport ----------------------------------------------
256 257
257 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport( 258 MessagePipeDispatcherTransport::MessagePipeDispatcherTransport(
258 DispatcherTransport transport) 259 DispatcherTransport transport)
259 : DispatcherTransport(transport) { 260 : DispatcherTransport(transport) {
260 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe); 261 DCHECK_EQ(message_pipe_dispatcher()->GetType(), Dispatcher::kTypeMessagePipe);
261 } 262 }
262 263
263 } // namespace system 264 } // namespace system
264 } // namespace mojo 265 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/message_pipe.cc ('k') | mojo/edk/system/message_pipe_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698