Merge master e86d9bdc55e4 into doc

This commit is contained in:
Mark Mentovai 2015-10-30 18:47:50 -04:00
commit cc62ba47ad
7 changed files with 100 additions and 55 deletions

View File

@ -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

View File

@ -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_;

View File

@ -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',
],
},
],

View File

@ -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',
],
},
],

View File

@ -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',
],
}],
],

View File

@ -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) {

View File

@ -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.