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/core.h" | 5 #include "mojo/edk/system/core.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 if (num_handles > GetConfiguration().max_message_num_handles) | 284 if (num_handles > GetConfiguration().max_message_num_handles) |
285 return MOJO_RESULT_RESOURCE_EXHAUSTED; | 285 return MOJO_RESULT_RESOURCE_EXHAUSTED; |
286 | 286 |
287 UserPointer<const MojoHandle>::Reader handles_reader(handles, num_handles); | 287 UserPointer<const MojoHandle>::Reader handles_reader(handles, num_handles); |
288 | 288 |
289 // We'll need to hold on to the dispatchers so that we can pass them on to | 289 // We'll need to hold on to the dispatchers so that we can pass them on to |
290 // |WriteMessage()| and also so that we can unlock their locks afterwards | 290 // |WriteMessage()| and also so that we can unlock their locks afterwards |
291 // without accessing the handle table. These can be dumb pointers, since their | 291 // without accessing the handle table. These can be dumb pointers, since their |
292 // entries in the handle table won't get removed (since they'll be marked as | 292 // entries in the handle table won't get removed (since they'll be marked as |
293 // busy). | 293 // busy). |
294 std::vector<DispatcherTransport> transports(num_handles); | 294 std::vector<HandleTransport> transports(num_handles); |
295 | 295 |
296 // When we pass handles, we have to try to take all their dispatchers' locks | 296 // When we pass handles, we have to try to take all their dispatchers' locks |
297 // and mark the handles as busy. If the call succeeds, we then remove the | 297 // and mark the handles as busy. If the call succeeds, we then remove the |
298 // handles from the handle table. | 298 // handles from the handle table. |
299 { | 299 { |
300 MutexLocker locker(&handle_table_mutex_); | 300 MutexLocker locker(&handle_table_mutex_); |
301 MojoResult result = handle_table_.MarkBusyAndStartTransport( | 301 MojoResult result = handle_table_.MarkBusyAndStartTransport( |
302 message_pipe_handle, handles_reader.GetPointer(), num_handles, | 302 message_pipe_handle, handles_reader.GetPointer(), num_handles, |
303 &transports); | 303 &transports); |
304 if (result != MOJO_RESULT_OK) | 304 if (result != MOJO_RESULT_OK) |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 if (signals_states) { | 702 if (signals_states) { |
703 for (; i < num_handles; i++) | 703 for (; i < num_handles; i++) |
704 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); | 704 signals_states[i] = dispatchers[i]->GetHandleSignalsState(); |
705 } | 705 } |
706 | 706 |
707 return result; | 707 return result; |
708 } | 708 } |
709 | 709 |
710 } // namespace system | 710 } // namespace system |
711 } // namespace mojo | 711 } // namespace mojo |
OLD | NEW |