| Index: mojo/edk/system/core.h
|
| diff --git a/mojo/edk/system/core.h b/mojo/edk/system/core.h
|
| index 18ad059ecce4cfeec4dad196b23836fc655b43b2..fbb289cb276874a0f34b871f6972e299cd298aa7 100644
|
| --- a/mojo/edk/system/core.h
|
| +++ b/mojo/edk/system/core.h
|
| @@ -9,6 +9,7 @@
|
|
|
| #include <functional>
|
|
|
| +#include "mojo/edk/system/entrypoint_class.h"
|
| #include "mojo/edk/system/handle.h"
|
| #include "mojo/edk/system/handle_table.h"
|
| #include "mojo/edk/system/mapping_table.h"
|
| @@ -55,19 +56,43 @@ class Core {
|
| // if the handle table is full.
|
| MojoHandle AddHandle(Handle&& h);
|
|
|
| - // Looks up the dispatcher for the given handle value. On success, gets the
|
| - // dispatcher for a given handle value. On failure, returns an appropriate
|
| - // result and leaves |dispatcher| alone), namely
|
| - // |MOJO_RESULT_INVALID_ARGUMENT| if the handle value is invalid or
|
| - // |MOJO_RESULT_BUSY| if the handle is marked as busy.
|
| + // Gets the handle for the given handle value. On success, returns
|
| + // |MOJO_RESULT_OK| (and sets |*h|). On failure, returns an appropriate result
|
| + // (and leaves |*h| alone), namely |MOJO_RESULT_INVALID_ARGUMENT| if the
|
| + // handle value is invalid or |MOJO_RESULT_BUSY| if the handle is marked as
|
| + // busy.
|
| + MojoResult GetHandle(MojoHandle handle, Handle* h);
|
| + // TODO(vtl): Remove this.
|
| MojoResult GetDispatcher(MojoHandle handle,
|
| util::RefPtr<Dispatcher>* dispatcher);
|
|
|
| + // TODO(vtl): Convert this to |GetAndRemoveHandle()|.
|
| // Like |GetDispatcher()|, but on success also removes the handle from the
|
| // handle table.
|
| MojoResult GetAndRemoveDispatcher(MojoHandle handle,
|
| util::RefPtr<Dispatcher>* dispatcher);
|
|
|
| + // Gets the dispatcher for the given handle value, which must have (all of)
|
| + // the rights in |required_handle_rights|.
|
| + //
|
| + // On success, returns |MOJO_RESULT_OK| and sets |*dispatcher| appropriately.
|
| + // On failure, returns:
|
| + // - |MOJO_RESULT_INVALID_ARGUMENT| if there's no handle for the given
|
| + // handle value (or the handle value was |MOJO_HANDLE_INVALID|),
|
| + // - |MOJO_RESULT_BUSY| if the handle is marked as busy,
|
| + // - |MOJO_RESULT_PERMISSION_DENIED| if the handle does not have the
|
| + // required rights *and* the dispatcher supports the specified
|
| + // |entrypoint_class|, or
|
| + // - |MOJO_RESULT_INVALID_ARGUMENT| if the handle does not have the required
|
| + // rights *but* the dispatcher does not support |entrypoint_class|.
|
| + // (Warning: if the handle has the required rights, then its dispatcher will
|
| + // be returned even if the dispatcher does not support |entrypoint_class|.)
|
| + MojoResult GetDispatcherAndCheckRights(
|
| + MojoHandle handle_value,
|
| + MojoHandleRights required_handle_rights,
|
| + EntrypointClass entrypoint_class,
|
| + util::RefPtr<Dispatcher>* dispatcher);
|
| +
|
| // Watches on the given handle for the given signals, calling |callback| when
|
| // a signal is satisfied or when all signals become unsatisfiable. |callback|
|
| // must satisfy stringent requirements -- see |Awakable::Awake()| in
|
|
|