diff --git a/doc/index.ad b/doc/index.ad index 5bb16f8f..3b06292e 100644 --- a/doc/index.ad +++ b/doc/index.ad @@ -34,8 +34,8 @@ https://chromium.googlesource.com/crashpad/crashpad. == Other Links - * Bugs can be reported at the https://crashpad.chromium.org/bug/new[Crashpad - issue tracker]. + * Bugs can be reported at the https://crashpad.chromium.org/bug/[Crashpad issue + tracker]. * The https://build.chromium.org/p/client.crashpad[Crashpad Buildbot] performs automated builds and tests. * https://groups.google.com/a/chromium.org/group/crashpad-dev[crashpad-dev] is diff --git a/handler/mac/exception_handler_server.cc b/handler/mac/exception_handler_server.cc index 400df562..3757c454 100644 --- a/handler/mac/exception_handler_server.cc +++ b/handler/mac/exception_handler_server.cc @@ -27,13 +27,13 @@ namespace crashpad { namespace { class ExceptionHandlerServerRun : public UniversalMachExcServer::Interface, - public NotifyServer::Interface { + public NotifyServer::DefaultInterface { public: ExceptionHandlerServerRun( mach_port_t exception_port, UniversalMachExcServer::Interface* exception_interface) : UniversalMachExcServer::Interface(), - NotifyServer::Interface(), + NotifyServer::DefaultInterface(), mach_exc_server_(this), notify_server_(this), composite_mach_message_server_(), @@ -144,22 +144,7 @@ class ExceptionHandlerServerRun : public UniversalMachExcServer::Interface, destroy_complex_request); } - // NotifyServer::Interface: - - kern_return_t DoMachNotifyPortDeleted( - notify_port_t notify, - mach_port_name_t name, - const mach_msg_trailer_t* trailer) override { - return UnimplementedNotifyRoutine(notify); - } - - kern_return_t DoMachNotifyPortDestroyed(notify_port_t notify, - mach_port_t rights, - const mach_msg_trailer_t* trailer, - bool* destroy_request) override { - *destroy_request = true; - return UnimplementedNotifyRoutine(notify); - } + // NotifyServer::DefaultInterface: kern_return_t DoMachNotifyNoSenders( notify_port_t notify, @@ -180,32 +165,7 @@ class ExceptionHandlerServerRun : public UniversalMachExcServer::Interface, return KERN_SUCCESS; } - kern_return_t DoMachNotifySendOnce( - notify_port_t notify, - const mach_msg_trailer_t* trailer) override { - return UnimplementedNotifyRoutine(notify); - } - - kern_return_t DoMachNotifyDeadName( - notify_port_t notify, - mach_port_name_t name, - const mach_msg_trailer_t* trailer) override { - return UnimplementedNotifyRoutine(notify); - } - private: - kern_return_t UnimplementedNotifyRoutine(notify_port_t notify) { - // Most of the routines in the notify subsystem are not expected to be - // called. - if (notify != notify_port_) { - LOG(WARNING) << "notify port mismatch"; - return KERN_FAILURE; - } - - NOTREACHED(); - return MIG_BAD_ID; - } - UniversalMachExcServer mach_exc_server_; NotifyServer notify_server_; CompositeMachMessageServer composite_mach_message_server_; diff --git a/third_party/gmock/gmock.gyp b/third_party/gmock/gmock.gyp index 22c22b14..d034ef72 100644 --- a/third_party/gmock/gmock.gyp +++ b/third_party/gmock/gmock.gyp @@ -198,20 +198,20 @@ 'target_name': 'gmock', 'type': 'none', 'dependencies': [ - '../../../../../testing/gmock.gyp:gmock', + '<(DEPTH)/testing/gmock.gyp:gmock', ], 'export_dependent_settings': [ - '../../../../../testing/gmock.gyp:gmock', + '<(DEPTH)/testing/gmock.gyp:gmock', ], }, { 'target_name': 'gmock_main', 'type': 'none', 'dependencies': [ - '../../../../../testing/gmock.gyp:gmock_main', + '<(DEPTH)/testing/gmock.gyp:gmock_main', ], 'export_dependent_settings': [ - '../../../../../testing/gmock.gyp:gmock_main', + '<(DEPTH)/testing/gmock.gyp:gmock_main', ], }, ], diff --git a/third_party/gtest/gtest.gyp b/third_party/gtest/gtest.gyp index b9f23565..9bcb5f36 100644 --- a/third_party/gtest/gtest.gyp +++ b/third_party/gtest/gtest.gyp @@ -233,20 +233,20 @@ 'target_name': 'gtest', 'type': 'none', 'dependencies': [ - '../../../../../testing/gtest.gyp:gtest', + '<(DEPTH)/testing/gtest.gyp:gtest', ], 'export_dependent_settings': [ - '../../../../../testing/gtest.gyp:gtest', + '<(DEPTH)/testing/gtest.gyp:gtest', ], }, { 'target_name': 'gtest_main', 'type': 'none', 'dependencies': [ - '../../../../../testing/gtest.gyp:gtest_main', + '<(DEPTH)/testing/gtest.gyp:gtest_main', ], 'export_dependent_settings': [ - '../../../../../testing/gtest.gyp:gtest_main', + '<(DEPTH)/testing/gtest.gyp:gtest_main', ], }, ], diff --git a/third_party/mini_chromium/mini_chromium.gyp b/third_party/mini_chromium/mini_chromium.gyp index 29f12635..56f897d3 100644 --- a/third_party/mini_chromium/mini_chromium.gyp +++ b/third_party/mini_chromium/mini_chromium.gyp @@ -34,10 +34,10 @@ ], }, { # else: crashpad_in_chromium!=0 'dependencies': [ - '../../../../../base/base.gyp:base', + '<(DEPTH)/base/base.gyp:base', ], 'export_dependent_settings': [ - '../../../../../base/base.gyp:base', + '<(DEPTH)/base/base.gyp:base', ], }], ], diff --git a/util/mach/notify_server.cc b/util/mach/notify_server.cc index 05495c65..48a4a9e9 100644 --- a/util/mach/notify_server.cc +++ b/util/mach/notify_server.cc @@ -105,6 +105,42 @@ kern_return_t MIGCheckRequestMachNotifyDeadName( namespace crashpad { +kern_return_t NotifyServer::DefaultInterface::DoMachNotifyPortDeleted( + notify_port_t notify, + mach_port_name_t name, + const mach_msg_trailer_t* trailer) { + return MIG_BAD_ID; +} + +kern_return_t NotifyServer::DefaultInterface::DoMachNotifyPortDestroyed( + notify_port_t notify, + mach_port_t rights, + const mach_msg_trailer_t* trailer, + bool* destroy_request) { + *destroy_request = true; + return MIG_BAD_ID; +} + +kern_return_t NotifyServer::DefaultInterface::DoMachNotifyNoSenders( + notify_port_t notify, + mach_port_mscount_t mscount, + const mach_msg_trailer_t* trailer) { + return MIG_BAD_ID; +} + +kern_return_t NotifyServer::DefaultInterface::DoMachNotifySendOnce( + notify_port_t notify, + const mach_msg_trailer_t* trailer) { + return MIG_BAD_ID; +} + +kern_return_t NotifyServer::DefaultInterface::DoMachNotifyDeadName( + notify_port_t notify, + mach_port_name_t name, + const mach_msg_trailer_t* trailer) { + return MIG_BAD_ID; +} + NotifyServer::NotifyServer(NotifyServer::Interface* interface) : MachMessageServer::Interface(), interface_(interface) { diff --git a/util/mach/notify_server.h b/util/mach/notify_server.h index 311ad3a0..ce33b21b 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.