Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4262)

Unified Diff: mojo/edk/system/core.h

Issue 1953293003: EDK: Add handle rights checking to the various entrypoints. (Closed) Base URL: https://github.com/domokit/mojo.git@work788_edk_handle_13.9-x-work787_edk_handle_13.8
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/edk/system/core.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | mojo/edk/system/core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698