diff options
Diffstat (limited to 'chromium/mojo/public/c/system/invitation.h')
-rw-r--r-- | chromium/mojo/public/c/system/invitation.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/chromium/mojo/public/c/system/invitation.h b/chromium/mojo/public/c/system/invitation.h index e63001eb0be..f95bcc4e096 100644 --- a/chromium/mojo/public/c/system/invitation.h +++ b/chromium/mojo/public/c/system/invitation.h @@ -251,6 +251,25 @@ struct MOJO_ALIGNAS(8) MojoAcceptInvitationOptions { MOJO_STATIC_ASSERT(sizeof(struct MojoAcceptInvitationOptions) == 8, "MojoAcceptInvitationOptions has wrong size"); +// Flags passed to |MojoSetDefaultProcessErrorHandler()| via +// |MojoSetDefaultProcessErrorHandlerOptions|. +typedef uint32_t MojoSetDefaultProcessErrorHandlerFlags; + +// No flags. Default behavior. +#define MOJO_SET_DEFAULT_PROCESS_ERROR_HANDLER_FLAG_NONE \ + ((MojoSetDefaultProcessErrorHandlerFlags)0) + +// Options passed to |MojoSetDefaultProcessErrorHandler()|. +struct MOJO_ALIGNAS(8) MojoSetDefaultProcessErrorHandlerOptions { + // The size of this structure, used for versioning. + uint32_t struct_size; + + // See |MojoSetDefaultProcessErrorHandlerFlags|. + MojoSetDefaultProcessErrorHandlerFlags flags; +}; +MOJO_STATIC_ASSERT(sizeof(struct MojoSetDefaultProcessErrorHandlerOptions) == 8, + "MojoSetDefaultProcessErrorHandlerOptions has wrong size"); + #ifdef __cplusplus extern "C" { #endif @@ -266,6 +285,12 @@ typedef void (*MojoProcessErrorHandler)( uintptr_t context, const struct MojoProcessErrorDetails* details); +// Similar to above, but registered globally via +// |MojoSetDefaultProcessErrorHandler()| and invoked only for communication +// errors regarding processes NOT invited by the calling process. +typedef void (*MojoDefaultProcessErrorHandler)( + const struct MojoProcessErrorDetails* details); + // Creates a new invitation to be sent to another process. // // An invitation is used to invite another process to join this process's @@ -474,6 +499,31 @@ MOJO_SYSTEM_EXPORT MojoResult MojoAcceptInvitation( const struct MojoAcceptInvitationOptions* options, MojoHandle* invitation_handle); +// Registers a process-wide handler to be invoked when an error is raised on a +// connection to a peer process. Such errors can be raised if the peer process +// sends malformed data to this process. +// +// Note that this handler is only invoked for connections to processes NOT +// explicitly invited by this process. To handle errors concerning processes +// invited by this process, see the MojoProcessErrorHandler argument to +// |MojoSendInvitation()|. +// +// The general use case for this API is to be able to log or report instances of +// bad IPCs received by a client process which no real ability or authority to +// identify the source. +// +// Returns: +// |MOJO_RESULT_OK| if |handler| is successfully registered as the global +// default process error handler within the calling process. If |handler| +// is null, any registered default process error handler is removed. +// |MOJO_RESULT_ALREADY_EXISTS| if |handler| is non-null and there is already +// a registered error handler. Callers wishing to replace an existing +// handler must first call |MojoSetDefaultProcessErrorHandler()| with null +// in order to do so. +MOJO_SYSTEM_EXPORT MojoResult MojoSetDefaultProcessErrorHandler( + MojoDefaultProcessErrorHandler handler, + const struct MojoSetDefaultProcessErrorHandlerOptions* options); + #ifdef __cplusplus } // extern "C" #endif |