| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ |
| 6 #define MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ | 6 #define MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <unordered_map> | 10 #include <unordered_map> |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // Adds the given vector of handles (of size at most | 68 // Adds the given vector of handles (of size at most |
| 69 // |kMaxMessageNumHandles|). |handle_values| must point to an array of size at | 69 // |kMaxMessageNumHandles|). |handle_values| must point to an array of size at |
| 70 // least |handles->size()|. Unlike the other |AddHandle...()| functions, some | 70 // least |handles->size()|. Unlike the other |AddHandle...()| functions, some |
| 71 // of the handles may be invalid ("null"). Returns true on success in which | 71 // of the handles may be invalid ("null"). Returns true on success in which |
| 72 // case all the handles in |*handles| are moved from, and false on failure (if | 72 // case all the handles in |*handles| are moved from, and false on failure (if |
| 73 // the handle table is full), in which case it leaves all |handles->at(...)|| | 73 // the handle table is full), in which case it leaves all |handles->at(...)|| |
| 74 // (and all the handles unadded) and |handle_values[...]| untouched. | 74 // (and all the handles unadded) and |handle_values[...]| untouched. |
| 75 bool AddHandleVector(HandleVector* handles, MojoHandle* handle_values); | 75 bool AddHandleVector(HandleVector* handles, MojoHandle* handle_values); |
| 76 | 76 |
| 77 // Tries to mark the given handle values as busy and start transport on them | 77 // Tries to mark the given handle values as busy and start transport on them |
| 78 // (i.e., take their dispatcher locks); |transports| must be sized to contain | 78 // (i.e., take their dispatcher locks). The handles to be transported must all |
| 79 // |num_handles| elements. On failure, returns them to their original | 79 // have the |MOJO_HANDLE_RIGHT_TRANSFER| right. |transports| must be sized to |
| 80 // contain |num_handles| elements. On failure, returns them to their original |
| 80 // (non-busy, unlocked state). | 81 // (non-busy, unlocked state). |
| 81 MojoResult MarkBusyAndStartTransport( | 82 MojoResult MarkBusyAndStartTransport( |
| 82 MojoHandle disallowed_handle, | 83 MojoHandle disallowed_handle, |
| 83 const MojoHandle* handle_values, | 84 const MojoHandle* handle_values, |
| 84 uint32_t num_handles, | 85 uint32_t num_handles, |
| 85 std::vector<HandleTransport>* transports); | 86 std::vector<HandleTransport>* transports); |
| 86 | 87 |
| 87 // Remove the given handle values, which must all be present and which should | 88 // Remove the given handle values, which must all be present and which should |
| 88 // have previously been marked busy by |MarkBusyAndStartTransport()|. | 89 // have previously been marked busy by |MarkBusyAndStartTransport()|. |
| 89 void RemoveBusyHandles(const MojoHandle* handle_values, uint32_t num_handles); | 90 void RemoveBusyHandles(const MojoHandle* handle_values, uint32_t num_handles); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 HandleToEntryMap handle_to_entry_map_; | 132 HandleToEntryMap handle_to_entry_map_; |
| 132 MojoHandle next_handle_value_; // Invariant: never |MOJO_HANDLE_INVALID|. | 133 MojoHandle next_handle_value_; // Invariant: never |MOJO_HANDLE_INVALID|. |
| 133 | 134 |
| 134 MOJO_DISALLOW_COPY_AND_ASSIGN(HandleTable); | 135 MOJO_DISALLOW_COPY_AND_ASSIGN(HandleTable); |
| 135 }; | 136 }; |
| 136 | 137 |
| 137 } // namespace system | 138 } // namespace system |
| 138 } // namespace mojo | 139 } // namespace mojo |
| 139 | 140 |
| 140 #endif // MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ | 141 #endif // MOJO_EDK_SYSTEM_HANDLE_TABLE_H_ |
| OLD | NEW |