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

Unified Diff: util/mach/notify_server.h

Issue 1414413006: mac: Add NotifyServer::DefaultInterface, a default no-op implementation (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Created 5 years, 2 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 | « handler/mac/exception_handler_server.cc ('k') | util/mach/notify_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/mach/notify_server.h
diff --git a/util/mach/notify_server.h b/util/mach/notify_server.h
index 311ad3a0af52808504544967f87ef7ae86274c6e..ce33b21bac62257341eabaf660fbd2bf5c7a0a43 100644
--- a/util/mach/notify_server.h
+++ b/util/mach/notify_server.h
@@ -37,6 +37,9 @@ class NotifyServer : public MachMessageServer::Interface {
public:
//! \brief An interface that the different request messages that are a part of
//! the `notify` Mach subsystem can be dispatched to.
+ //!
+ //! Default implementations of all methods are available in the
+ //! DefaultInterface class.
class Interface {
public:
//! \brief Handles port-deleted notifications sent by
@@ -166,6 +169,52 @@ class NotifyServer : public MachMessageServer::Interface {
~Interface() {}
};
+ //! \brief A concrete implementation of Interface that provides a default
+ //! behavior for all `notify` routines.
+ //!
+ //! The Mach `notify` subsystem contains a collection of unrelated routines,
+ //! and a single server would rarely need to implement all of them. To make it
+ //! easier to use NotifyServer, a server can inherit from DefaultInterface
+ //! instead of Interface. Unless overridden, each routine in DefaultInterface
+ //! returns `MIG_BAD_ID` to indicate to the caller that the `notify` message
+ //! was unexpected and not processed.
+ class DefaultInterface : public Interface {
+ public:
+ // Interface:
+
+ kern_return_t DoMachNotifyPortDeleted(
+ notify_port_t notify,
+ mach_port_name_t name,
+ const mach_msg_trailer_t* trailer) override;
+
+ kern_return_t DoMachNotifyPortDestroyed(
+ notify_port_t notify,
+ mach_port_t rights,
+ const mach_msg_trailer_t* trailer,
+ bool* destroy_request) override;
+
+ kern_return_t DoMachNotifyNoSenders(
+ notify_port_t notify,
+ mach_port_mscount_t mscount,
+ const mach_msg_trailer_t* trailer) override;
+
+ kern_return_t DoMachNotifySendOnce(
+ notify_port_t notify,
+ const mach_msg_trailer_t* trailer) override;
+
+ kern_return_t DoMachNotifyDeadName(
+ notify_port_t notify,
+ mach_port_name_t name,
+ const mach_msg_trailer_t* trailer) override;
+
+ protected:
+ DefaultInterface() : Interface() {}
+ ~DefaultInterface() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DefaultInterface);
+ };
+
//! \brief Constructs an object of this class.
//!
//! \param[in] interface The interface to dispatch requests to. Weak.
« no previous file with comments | « handler/mac/exception_handler_server.cc ('k') | util/mach/notify_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698