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

Unified Diff: util/mach/mach_extensions.h

Issue 1383283003: Add and use scoped-right-returning wrappers for Mach bootstrap routines (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Self-review 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
Index: util/mach/mach_extensions.h
diff --git a/util/mach/mach_extensions.h b/util/mach/mach_extensions.h
index c8753035dcf22873f02328cc20b300960fa241b8..5eeca9aeda245599ba3241cb92c9e2b4d75a9cc3 100644
--- a/util/mach/mach_extensions.h
+++ b/util/mach/mach_extensions.h
@@ -17,6 +17,8 @@
#include <mach/mach.h>
+#include <string>
+
#include "base/mac/scoped_mach_port.h"
namespace crashpad {
@@ -117,6 +119,29 @@ exception_mask_t ExcMaskAll();
//! support is present.
exception_mask_t ExcMaskValid();
+//! \brief Makes a `boostrap_check_in()` call to the process’ bootstrap server.
+//!
+//! This function is provided to make it easier to call `bootstrap_check_in()`
+//! while avoiding accidental leaks of the returned receive right.
+//!
+//! \param[in] service_name The service name to check in.
+//!
+//! \return On success, a receive right to the service port. On failure,
+//! `MACH_PORT_NULL` with a message logged.
+base::mac::ScopedMachReceiveRight BootstrapCheckIn(
+ const std::string& service_name);
+
+//! \brief Makes a `boostrap_look_up()` call to the process’ bootstrap server.
+//!
+//! This function is provided to make it easier to call `bootstrap_look_up()`
+//! while avoiding accidental leaks of the returned send right.
+//!
+//! \param[in] service_name The service name to look up.
+//!
+//! \return On success, a send right to the service port. On failure,
+//! `MACH_PORT_NULL` with a message logged.
+base::mac::ScopedMachSendRight BootstrapLookUp(const std::string& service_name);
+
//! \brief Obtains the system’s default Mach exception handler for crash-type
//! exceptions.
//!

Powered by Google App Engine
This is Rietveld 408576698