| 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/dispatcher.h" | 5 #include "mojo/system/dispatcher.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "mojo/system/limits.h" | 8 #include "mojo/system/limits.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 return MOJO_RESULT_INVALID_ARGUMENT; | 31 return MOJO_RESULT_INVALID_ARGUMENT; |
| 32 | 32 |
| 33 return WriteMessageImplNoLock(bytes, num_bytes, dispatchers, flags); | 33 return WriteMessageImplNoLock(bytes, num_bytes, dispatchers, flags); |
| 34 } | 34 } |
| 35 | 35 |
| 36 MojoResult Dispatcher::ReadMessage( | 36 MojoResult Dispatcher::ReadMessage( |
| 37 void* bytes, uint32_t* num_bytes, | 37 void* bytes, uint32_t* num_bytes, |
| 38 uint32_t max_num_dispatchers, | 38 uint32_t max_num_dispatchers, |
| 39 std::vector<scoped_refptr<Dispatcher> >* dispatchers, | 39 std::vector<scoped_refptr<Dispatcher> >* dispatchers, |
| 40 MojoReadMessageFlags flags) { | 40 MojoReadMessageFlags flags) { |
| 41 DCHECK(max_num_dispatchers == 0 || !!dispatchers); | 41 DCHECK(max_num_dispatchers == 0 || (dispatchers && dispatchers->empty())); |
| 42 | 42 |
| 43 base::AutoLock locker(lock_); | 43 base::AutoLock locker(lock_); |
| 44 if (is_closed_) | 44 if (is_closed_) |
| 45 return MOJO_RESULT_INVALID_ARGUMENT; | 45 return MOJO_RESULT_INVALID_ARGUMENT; |
| 46 | 46 |
| 47 return ReadMessageImplNoLock(bytes, num_bytes, | 47 return ReadMessageImplNoLock(bytes, num_bytes, |
| 48 max_num_dispatchers, dispatchers, | 48 max_num_dispatchers, dispatchers, |
| 49 flags); | 49 flags); |
| 50 } | 50 } |
| 51 | 51 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 | 127 |
| 128 void Dispatcher::RemoveWaiterImplNoLock(Waiter* waiter) { | 128 void Dispatcher::RemoveWaiterImplNoLock(Waiter* waiter) { |
| 129 lock_.AssertAcquired(); | 129 lock_.AssertAcquired(); |
| 130 DCHECK(!is_closed_); | 130 DCHECK(!is_closed_); |
| 131 // By default, waiting isn't supported. Only dispatchers that can be waited on | 131 // By default, waiting isn't supported. Only dispatchers that can be waited on |
| 132 // will do something nontrivial. | 132 // will do something nontrivial. |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace system | 135 } // namespace system |
| 136 } // namespace mojo | 136 } // namespace mojo |
| OLD | NEW |