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 #ifndef MOJO_EDK_SYSTEM_CORE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_CORE_H_ |
6 #define MOJO_EDK_SYSTEM_CORE_H_ | 6 #define MOJO_EDK_SYSTEM_CORE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <functional> | 10 #include <functional> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // if the handle table is full. | 56 // if the handle table is full. |
57 MojoHandle AddHandle(Handle&& h); | 57 MojoHandle AddHandle(Handle&& h); |
58 | 58 |
59 // Gets the handle for the given handle value. On success, returns | 59 // Gets the handle for the given handle value. On success, returns |
60 // |MOJO_RESULT_OK| (and sets |*h|). On failure, returns an appropriate result | 60 // |MOJO_RESULT_OK| (and sets |*h|). On failure, returns an appropriate result |
61 // (and leaves |*h| alone), namely |MOJO_RESULT_INVALID_ARGUMENT| if the | 61 // (and leaves |*h| alone), namely |MOJO_RESULT_INVALID_ARGUMENT| if the |
62 // handle value is invalid or |MOJO_RESULT_BUSY| if the handle is marked as | 62 // handle value is invalid or |MOJO_RESULT_BUSY| if the handle is marked as |
63 // busy. | 63 // busy. |
64 MojoResult GetHandle(MojoHandle handle, Handle* h); | 64 MojoResult GetHandle(MojoHandle handle, Handle* h); |
65 | 65 |
66 // TODO(vtl): Convert this to |GetAndRemoveHandle()|. | 66 // Like |GetHandle()|, but on success also removes the handle from the |
67 // Like |GetDispatcher()|, but on success also removes the handle from the | |
68 // handle table. | 67 // handle table. |
69 MojoResult GetAndRemoveDispatcher(MojoHandle handle, | 68 MojoResult GetAndRemoveHandle(MojoHandle handle, Handle* h); |
70 util::RefPtr<Dispatcher>* dispatcher); | |
71 | 69 |
72 // Gets the dispatcher for the given handle value, which must have (all of) | 70 // Gets the dispatcher for the given handle value, which must have (all of) |
73 // the rights in |required_handle_rights|. | 71 // the rights in |required_handle_rights|. |
74 // | 72 // |
75 // On success, returns |MOJO_RESULT_OK| and sets |*dispatcher| appropriately. | 73 // On success, returns |MOJO_RESULT_OK| and sets |*dispatcher| appropriately. |
76 // On failure, returns: | 74 // On failure, returns: |
77 // - |MOJO_RESULT_INVALID_ARGUMENT| if there's no handle for the given | 75 // - |MOJO_RESULT_INVALID_ARGUMENT| if there's no handle for the given |
78 // handle value (or the handle value was |MOJO_HANDLE_INVALID|), | 76 // handle value (or the handle value was |MOJO_HANDLE_INVALID|), |
79 // - |MOJO_RESULT_BUSY| if the handle is marked as busy, | 77 // - |MOJO_RESULT_BUSY| if the handle is marked as busy, |
80 // - |MOJO_RESULT_PERMISSION_DENIED| if the handle does not have the | 78 // - |MOJO_RESULT_PERMISSION_DENIED| if the handle does not have the |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 util::Mutex mapping_table_mutex_; | 234 util::Mutex mapping_table_mutex_; |
237 MappingTable mapping_table_ MOJO_GUARDED_BY(mapping_table_mutex_); | 235 MappingTable mapping_table_ MOJO_GUARDED_BY(mapping_table_mutex_); |
238 | 236 |
239 MOJO_DISALLOW_COPY_AND_ASSIGN(Core); | 237 MOJO_DISALLOW_COPY_AND_ASSIGN(Core); |
240 }; | 238 }; |
241 | 239 |
242 } // namespace system | 240 } // namespace system |
243 } // namespace mojo | 241 } // namespace mojo |
244 | 242 |
245 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 243 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
OLD | NEW |