From 7858145558ddb273f1941014b67233aeba54691e Mon Sep 17 00:00:00 2001 From: Marc-Antoine Courteau Date: Fri, 30 Oct 2015 11:37:15 -0400 Subject: [PATCH 1/3] Update paths in third_party to use DEPTH instead of relative paths. R=mark@chromium.org Review URL: https://codereview.chromium.org/1428973002 . Patch from Marc-Antoine Courteau . --- third_party/gmock/gmock.gyp | 8 ++++---- third_party/gtest/gtest.gyp | 8 ++++---- third_party/mini_chromium/mini_chromium.gyp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) 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', ], }], ], From c1b841442fc96c24945046686062b4021bde1c87 Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Fri, 30 Oct 2015 15:44:40 -0400 Subject: [PATCH 2/3] mac: Add NotifyServer::DefaultInterface, a default no-op implementation Each routine in this implementation returns MIG_BAD_ID. These routines may be overridden. Most things that implement NotifyServer::Interface will only need to implement one of the interface routines. Since another user of NotifyServer will be added soon, it makes sense to provide a default no-op implementation rather than forcing everyone to write the same no-op boilerplate repeatedly. R=rsesek@chromium.org Review URL: https://codereview.chromium.org/1414413006 . --- handler/mac/exception_handler_server.cc | 46 ++--------------------- util/mach/notify_server.cc | 36 ++++++++++++++++++ util/mach/notify_server.h | 49 +++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 43 deletions(-) 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/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. From e86d9bdc55e474c9c31dae9da6b522bcfa33ea28 Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Fri, 30 Oct 2015 18:47:18 -0400 Subject: [PATCH 3/3] =?UTF-8?q?doc:=20=E2=80=9CCrashpad=20issue=20tracker?= =?UTF-8?q?=E2=80=9D=C2=A0should=20go=20to=20the=20list,=20not=20the=20ent?= =?UTF-8?q?ry=20page?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R=rsesek@chromium.org Review URL: https://codereview.chromium.org/1427193002 . --- doc/index.ad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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