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/core_impl.h" | 5 #include "mojo/system/core_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "mojo/system/dispatcher.h" | 10 #include "mojo/system/dispatcher.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 MojoResult CoreImpl::Wait(MojoHandle handle, | 99 MojoResult CoreImpl::Wait(MojoHandle handle, |
100 MojoWaitFlags flags, | 100 MojoWaitFlags flags, |
101 MojoDeadline deadline) { | 101 MojoDeadline deadline) { |
102 return WaitManyInternal(&handle, &flags, 1, deadline); | 102 return WaitManyInternal(&handle, &flags, 1, deadline); |
103 } | 103 } |
104 | 104 |
105 MojoResult CoreImpl::WaitMany(const MojoHandle* handles, | 105 MojoResult CoreImpl::WaitMany(const MojoHandle* handles, |
106 const MojoWaitFlags* flags, | 106 const MojoWaitFlags* flags, |
107 uint32_t num_handles, | 107 uint32_t num_handles, |
108 MojoDeadline deadline) { | 108 MojoDeadline deadline) { |
109 if (!VerifyUserPointer(handles, num_handles, sizeof(handles[0]))) | 109 if (!VerifyUserPointer<MojoHandle>(handles, num_handles)) |
110 return MOJO_RESULT_INVALID_ARGUMENT; | 110 return MOJO_RESULT_INVALID_ARGUMENT; |
111 if (!VerifyUserPointer(flags, num_handles, sizeof(flags[0]))) | 111 if (!VerifyUserPointer<MojoWaitFlags>(flags, num_handles)) |
112 return MOJO_RESULT_INVALID_ARGUMENT; | 112 return MOJO_RESULT_INVALID_ARGUMENT; |
113 if (num_handles < 1) | 113 if (num_handles < 1) |
114 return MOJO_RESULT_INVALID_ARGUMENT; | 114 return MOJO_RESULT_INVALID_ARGUMENT; |
115 if (num_handles > kMaxWaitManyNumHandles) | 115 if (num_handles > kMaxWaitManyNumHandles) |
116 return MOJO_RESULT_RESOURCE_EXHAUSTED; | 116 return MOJO_RESULT_RESOURCE_EXHAUSTED; |
117 return WaitManyInternal(handles, flags, num_handles, deadline); | 117 return WaitManyInternal(handles, flags, num_handles, deadline); |
118 } | 118 } |
119 | 119 |
120 MojoResult CoreImpl::CreateMessagePipe(MojoHandle* handle_0, | 120 MojoResult CoreImpl::CreateMessagePipe(MojoHandle* handle_0, |
121 MojoHandle* handle_1) { | 121 MojoHandle* handle_1) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be | 266 // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be |
267 // destroyed, but this would still be required if the waiter were in TLS.) | 267 // destroyed, but this would still be required if the waiter were in TLS.) |
268 for (i = 0; i < num_added; i++) | 268 for (i = 0; i < num_added; i++) |
269 dispatchers[i]->RemoveWaiter(&waiter); | 269 dispatchers[i]->RemoveWaiter(&waiter); |
270 | 270 |
271 return rv; | 271 return rv; |
272 } | 272 } |
273 | 273 |
274 } // namespace system | 274 } // namespace system |
275 } // namespace mojo | 275 } // namespace mojo |
OLD | NEW |